Jump to content

Randomisation of troops possible?


Recommended Posts

Is it generally spoken possible to randomise enemy units composition?

Example: A trigger which calls in enemy reinforcements could contain 2 heavy or four light tanks. Enemy could either get another AT gun or two infantry squads based on some random factor.

I saw something like this in the old "Flying Corps" by Rowan flight sim editor. You could set a probability for either a flight of fighters, bombers or Recce aircraft and some numerical randomness.

Makes replay more interesting.

Also would be interested if a randomisation for different locations is possible, e. g. enemy attacking from the left OR the right.

Inquiring mind wants to know smile.gif .

Link to comment
Share on other sites

If you can come up with a program that will randomly generate an xml file called "mission.xml" with all the required variables in a coherent fashion...then the answer is yes.

Open the mission.xml contained in one of the mission sub-folders and you can easily see what is required....it's all very straight-forward.

Link to comment
Share on other sites

What I'm trying to say is that randomization is possible with an outside application which generates the units and then creates the mission file from those generated variables.....

All units must specified directly in the mission file for the idea to work properly, however, and since unit locations are also specified by coordinates, these variables must also be generated in conjunction with the map that is being utilized...which can also be generated randomly.

Link to comment
Share on other sites

You can't randomize units in the "Trigger.ini" because units aren't specified there....They are specified in the mission.xml file.

Both of these files are a product of the editor, but they are separate from each other and accomplish two different things within the game environment.

Link to comment
Share on other sites

Stoppelhopser

Yes, you can randomize troops. The difficulty is they all have to be set up and placed in advance. You can then script which sets of units or armies to use. Take a look at my Yanovo campaign if you want to see an example of it. It puts a lot of work on the scenario builder.

Oudy

Link to comment
Share on other sites

Oudy

I hadn't thought of that, that is a good approach because the randomize function is in the scripting functions....

The only problem is you have to create every possible troop possibility in the mission.xml file which means that if you want a WIDE variety of variability you have to stuff the mission file full of unit combinations....

Still a very workable approach, however, given the current game tool limitations.

What do you think of the randomly generated mission.xml file concept? I think the biggest hurdle would be properly placing units if the map choice was random as well.....

Link to comment
Share on other sites

SlapHappy

I like the idea of randomly generated mission.xml files but you would have to set up templates for each map to know where to place troops. You don't want to randomly put units on a map. This is what the official campaign generator (DGen) and Lowengrin (DCG) do in Il-2. The problem is that you have to create another program to generate the files and that takes a person with programming skills. I did my scenario the way I did because I didn't want to have to write a whole new program.

The main difference in scenario generation between Theatre of War and Il-2 is the importance of terrain. Each scenario author has to really look at the terrain and ask, "where would you defend on this map?" or "where would you attack?" I think you can make a scenario interesting with 2 or three different randomized events, but the game doesn't lend itself easily to full randomization because of the importance of terrain.

I think it is more important to have an interesting story and make the scenario fit the map rather than have a fully randomized "kill all the enemy troops" scenario. The burden falls on the scenario creator to do a lot of work and with certain missing scripting features like a way to cycle through individual units, it is a big challenge. There have been several "proofs of concept" scenarios that have demonstrated the flexibility and power of the game but it is a lot of work for the scenario creator.

Hopefully, after the patch, we will see more individual scenarios and even campaigns written. It would certainly be nice to see some tools to help authors create their own scenarios.

All the best

Oudy

Link to comment
Share on other sites

You can randomise units as Oudy says, it does put alot of extra time on the scenario development especially in testing it! I know I've been developing a campaign for the last 6 months :D

Although a ton more work it is really rewarding to have an unpredictable mission, especially in terms of playability, I have some missions that now have up to 80 different variants (4-5 Infantry x 4-5 Tanks + random air / arty / mortar support). Anyway here's a trigger called gen_attack that randomly generates 4 different attack profiles & gives a good idea of the sort of thing I've got running successfully.

</font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">

Set @num = RND ( ) Set @num = RND ( )

SetWorkArmy ( Army , 2 )

if ( @num <= 30 ) then

ArtSupportChangeState ( 2 , ENABLE )

ArtSupportCall ( 2 , RECT , "final objective" )

Delay ( 50 )

CreateRectByObject ( RECT , "Mortar Rect" , 100 , ARMY , 1 , HUMAN , 2 , NO_PANIC )

MortarSupportChangeState ( 2 , ENABLE )

MortarSupportCall ( 2 , RECT , "Mortar Rect" )

Delay ( 50 )

ReinforcementLand ( Group , "Group_Panthers" )

Delay ( 5000 )

CreateRectByObject ( RECT , "Panthers Attack Rect" , 100 , ARMY , 1 , TANKS , 2 , NOT_EMPTY , OK_WEAPON , OK_ENGINE )

DamageObject ( GROUP , "Group_Destroyed" , 100 )

Delay ( 3 )

RunCommand ( GROUP , "Group_Panthers" , ATTACK , RECT , "Panthers Attack Rect" )

Delay ( 20000 )

ReinforcementLand ( Group , "Group_Infantry_stugs" )

Delay ( 5 )

RunCommand ( GROUP , "Group_Infantry_stugs" , STORM , RECT , "final objective" )

Delay ( 5 )

ReinforcementLand ( Group , "Group_Flak" )

Delay ( 5 )

RunCommand ( GROUP , "Group_Flak" , STORM , RECT , "final objective" )

halt

endif

if ( @num <= 60 ) then

AviaSupportChangeState ( 2 , BATTLEPLANE , ENABLE )

AviaSupportCall ( 2 , BATTLEPLANE , RECT , "final objective" )

Delay ( 50 )

ArtSupportChangeState ( 2 , ENABLE )

ArtSupportCall ( 2 , RECT , "final objective" )

Delay ( 50 )

CreateRectByObject ( RECT , "Mortar Rect" , 100 , ARMY , 1 , HUMAN , 2 , NO_PANIC )

Delay ( 5 )

MortarSupportChangeState ( 2 , ENABLE )

Delay ( 5 )

MortarSupportCall ( 2 , RECT , "Mortar Rect" )

Delay ( 50000 )

ReinforcementLand ( Group , "Group_Infantry_stugs" )

Delay ( 5 )

RunCommand ( GROUP , "Group_Infantry_stugs" , STORM , RECT , "final objective" )

Delay ( 25000 )

ReinforcementLand ( Group , "Group_Infantry_SPG" )

Delay ( 5 )

RunCommand ( GROUP , "Group_Infantry_SPG" , STORM , RECT , "final objective" )

Delay ( 5 )

ReinforcementLand ( Group , "Group_attack_tiger" )

Delay ( 5 )

RunCommand ( GROUP , "Group_attack_tiger" , STORM , RECT , "final objective" )

Delay ( 180000 )

AviaSupportChangeState ( 3 , BATTLEPLANE , ENABLE )

Delay ( 5 )

CreateRectByObject ( RECT , "Air Attack Rect" , 100 , ARMY , 1 , ALL , 2 , NOT_EMPTY )

Delay ( 50 )

AviaSupportCall ( 3 , BATTLEPLANE , RECT , "Air Attack Rect" )

halt

endif

if ( @num <= 90 ) then

ArtSupportChangeState ( 2 , ENABLE )

CreateRectByObject ( RECT , "Arty Rect" , 100 , ARMY , 1 , HUMAN , 2 , NO_PANIC )

Delay ( 5 )

ArtSupportCall ( 2 , RECT , "Arty Rect" )

ReinforcementLand ( Group , "Group_Panthers" )

Delay ( 15000 )

RunCommand ( GROUP , "Group_Panthers" , STORM , RECT , "final objective" )

Delay ( 5 )

ReinforcementLand ( Group , "Group_Infantry_stugs" )

Delay ( 20000 )

RunCommand ( GROUP , "Group_Infantry_stugs" , STORM , RECT , "final objective" )

Delay ( 5 )

ReinforcementLand ( Group , "Group_Infantry_SPG" )

Delay ( 15000 )

RunCommand ( GROUP , "Group_Infantry_SPG" , STORM , RECT , "final objective" )

Delay ( 50000 )

MortarSupportChangeState ( 2 , ENABLE )

MortarSupportCall ( 2 , RECT , "begin2" )

Delay ( 5 )

ReinforcementLand ( Group , "Group_Flak" )

Delay ( 5 )

RunCommand ( GROUP , "Group_Flak" , STORM , RECT , "final objective" )

halt

endif

if ( @num > 90 ) then

AviaSupportChangeState ( 3 , BATTLEPLANE , ENABLE )

CreateRectByObject ( RECT , "Air Attack Rect" , 100 , ARMY , 1 , ALL , 2 , NOT_EMPTY )

Delay ( 5 )

AviaSupportCall ( 3 , BATTLEPLANE , RECT , "Air Attack Rect" )

Delay ( 5000 )

ReinforcementLand ( Group , "Group_Panthers" )

Delay ( 5 )

RunCommand ( GROUP , "Group_Panthers" , ATTACK , RECT , "final objective" )

Delay ( 15000 )

ReinforcementLand ( Group , "Group_Infantry_stugs" )

Delay ( 5 )

RunCommand ( GROUP , "Group_Infantry_stugs" , STORM , RECT , "final objective" )

Delay ( 20000 )

ReinforcementLand ( Group , "Group_Infantry_SPG" )

Delay ( 5 )

RunCommand ( GROUP , "Group_Infantry_SPG" , STORM , RECT , "final objective" )

Delay ( 5000 )

ReinforcementLand ( Group , "Group_attack_tiger" )

Delay ( 5 )

CreateRectByObject ( RECT , "Tiger Attack Rect" , 100 , ARMY , 1 , TANKS , 2 , NOT_EMPTY , OK_WEAPON , OK_ENGINE )

Delay ( 5 )

RunCommand ( GROUP , "Group_attack_tiger" , ATTACK , RECT , "Tiger Attack Rect" )

halt

ArtSupportChangeState ( 2 , ENABLE )

CreateRectByObject ( RECT , "Arty Rect" , 100 , ARMY , 1 , HUMAN , 2 , NO_PANIC )

Delay ( 5 )

endif

halt</pre>

Link to comment
Share on other sites

Originally posted by Oudy:

SlapHappy

I like the idea of randomly generated mission.xml files but you would have to set up templates for each map to know where to place troops. You don't want to randomly put units on a map. This is what the official campaign generator (DGen) and Lowengrin (DCG) do in Il-2. The problem is that you have to create another program to generate the files and that takes a person with programming skills. I did my scenario the way I did because I didn't want to have to write a whole new program.

The main difference in scenario generation between Theatre of War and Il-2 is the importance of terrain. Each scenario author has to really look at the terrain and ask, "where would you defend on this map?" or "where would you attack?" I think you can make a scenario interesting with 2 or three different randomized events, but the game doesn't lend itself easily to full randomization because of the importance of terrain.

I think it is more important to have an interesting story and make the scenario fit the map rather than have a fully randomized "kill all the enemy troops" scenario. The burden falls on the scenario creator to do a lot of work and with certain missing scripting features like a way to cycle through individual units, it is a big challenge. There have been several "proofs of concept" scenarios that have demonstrated the flexibility and power of the game but it is a lot of work for the scenario creator.

Hopefully, after the patch, we will see more individual scenarios and even campaigns written. It would certainly be nice to see some tools to help authors create their own scenarios.

All the best

Oudy

Yes, I agree...map placement is the problem.

However you can still run into problems with reinforcement type random units in the scripting process because you have to navigate using "points" or "rects" so you have the same problem with anything but pre-chosen maps. Map dependency is definitely the biggest hold-back to true random scenarios.

You're current solution (and Gnashers) is still probably the best way to approach the problem, all in all.

Link to comment
Share on other sites

Gnasher

Couldn't you get even more random variations if you created a routine which picked units from a number of variable infantry, tank, support, etc. tables instead of just a complete list of different army combinations?

For instance, first random generator decides on 5 infantry squads from a random range, then picks those squads randomly from a list of 10 types, then moves on and randomly generates an armor count and then picks from a section of tank groups randomly......The number of combinations would increase dramatically. Although I could definitely see balancing issues with some generations....

Just expanding on what you've shown us......which looks really cool....can't wait to see the finished Campaign!

Link to comment
Share on other sites

It is relatively straight forward to make enemy group combinations. Basically you need global variables to hold the remaining unitID's. Place ALL the possible units on map. Use RND() to deletegroup the units not selected. Then use objectchangeposition to place the remaining units into the position you set. Use the global variables to issue further commands to the remaining units.

I will make a pdf of the process when time permits. I will include how you can randomise the position of units using the objectchangeposition and points, so the enemy doesn't always turn up at the same map location for the player.

It can be fun hunting down a tiger or KVII.

[ December 04, 2007, 03:41 AM: Message edited by: BrassEm ]

Link to comment
Share on other sites

Also another thing to be bourne in mind at the design stage is unit count.....

If truely random unit generation is implemented it will also cover the number of groups, no? Strikes me that there's a distinct possibility that you could end up with > 250 units onscreen which crashes the game every time without fail. So I'm pretty sure that to be stable you would need to mitigate against this from the initial design stage.

Link to comment
Share on other sites

Unit count should be deleted down to managable levels during the init trig. Didn't know about the 250 limit, thanks for the heads up. I am just testing code with small unit numbers. (But stands to reason 250 combating units = major CPU workload!)

EDIT: An example of "random" ( = by design ) unit placement at a single point.

This Trigger would be executed at the init stage...

NOTE: Bare in mind that AI groups can be multiple units and can be placed on map in formation, the selected group will be moved in approximate formation to the set point "StartPos". Hence “Tiger” group could be a tiger with an anti-tank gun and several detachments placed in formation at "StartPos".

// DICEROLL TO DETERMINE GROUP PLACEMENT

// ---------------------------------------------------------------------------------------------

// This example is for an approximate 25% probability that each code section will process.

// 100 - 75%, 74 - 50%, 49 - 25% 24 – 0%

// Change the weighting of percentages and numbers accordingly.

// These groups have been set on map, the points work like a camera position.

// Group “Tiger”

// Group “Jagdpanther”

// Group “Panther”

// Group “PanzerIV”

// Point “StartPos” ; a point set as the starting location for the group.

// Point “StartLook” ; a point to set the groups looking direction.

// --------------------------------------------------------------------------------------------

// Most important. Set a global to the active group selected for future processing.

Set @@EnemyGroup_1 = “” ; Just set a placeholder for the moment.

// get the die roll.

Set @diceroll = RND ( )

// Now the exectution

If @diceroll >= 75 then

// place the code to execute here for the TIGER

ObjectChangePosition ( GROUP , “Tiger” , “StartPos” , “StartLook” )

DeleteGroup ( “Jagdpanther” )

DeleteGroup ( “Panther” )

DeleteGroup ( “PanzerIV” )

Set @@EnemyGroup_1 = “Tiger”

halt

endif

If @diceroll >= 50 then

// place the code to execute here for the Jagdpanther

ObjectChangePosition ( GROUP , “Jagdpanther” , “StartPos” , “StartLook” )

DeleteGroup ( “Tiger” )

DeleteGroup ( “Panther” )

DeleteGroup ( “PanzerIV” )

Set @@EnemyGroup_1 = “Jagdpanther”

halt

endif

If @diceroll >= 25 then

// place the code to execute here for the Panther

ObjectChangePosition ( GROUP , “Panther” , “StartPos” , “StartLook” )

DeleteGroup ( “Tiger” )

DeleteGroup ( “Jagdpanther” )

DeleteGroup ( “PanzerIV” )

Set @@EnemyGroup_1 = “Panther”

halt

endif

If @diceroll >= 0 then

// place the code to execute here for the PanzerIV

ObjectChangePosition ( GROUP , “PanzerIV” , “StartPos” , “StartLook” )

DeleteGroup ( “Tiger” )

DeleteGroup ( “Jagdpanther” )

DeleteGroup ( “Panther” )

Set @@EnemyGroup_1 = “PanzerIV”

halt

endif

halt

[ December 09, 2007, 11:49 PM: Message edited by: BrassEm ]

Link to comment
Share on other sites

The next step is to place likely starting points for your Ai around the map using points “StartPos_1”, “StartLook_1”. StartPos_2”, “StartLook_2”, etc in pairs for each likely setup point on the map. You can then create another RND Trigger routine to set “StartPos” = “StartPos_?”, “StartLook” = “StartLook_?” Use this routine first to determine the starting location of the group, then determine what group will be placed there.

Good Hunting

(Unfortantely there can be no really true randomised maps. A commander will only place his units as tactics dictates, thus reducing the randomness by necessity.)

[ December 10, 2007, 12:23 AM: Message edited by: BrassEm ]

Link to comment
Share on other sites

Unfortantely there can be no really true randomised maps. A commander will only place his units as tactics dictates, thus reducing the randomness by necessity.
Yes you are right, I've also found that you NEED to extensively test scenarios (especially using my solution) to ensure that your randomised mission is both winnable & loosable.
Link to comment
Share on other sites

×
×
  • Create New...