Editing saved game files (*.sgm) to make AI commandeer player's Host Station

For those of us who are curious and like to poke around in the game's data files and scripts as well as glitching. Caters to anything from unit/building stats to level data to telling how to glitch and stories of game errors.
Post Reply
User avatar
Turantul 1 (Veteran)
Turantul 1 (Veteran)
Posts: 376
Joined: Thu Mar 01, 2012 3:00 pm
Location: Schloss Charlottenburg..?

Editing saved game files (*.sgm) to make AI commandeer player's Host Station

Post by CharlotteLabyrinth » Sun Feb 18, 2018 3:42 pm

I have known this trick for a long time since I first discovered it while editing save game files many years ago. AI controlling the player's host station is not a completely new thing since there is already well-known 'faction swapping turret save' trick.

However, this trick only involves changing save file data so there is no need to modify the contents of level files directly. :)


1) Enter any in-game levels you want to make AI control your host station.

2) As soon as the level starts, save the game immediately and exit the level.

3) Now go to your Urban Assault save directory and search for the save file (0.sgm) under the relevant user profile folder.

4) Open it with any text editor (Notepad++ is recommended), and search for the line 'begin_robo'.

5) The first search result (with the line 'is_user_robo = yes' underneath it) is the player's host station. Now find 'user = yes' and change it to 'user = no'. Next, find 'robostate = 16384' and change it to 'robostate = 0'.

6) Lastly, find the budget and delay sections located at below and adjust their values accordingly as you would when modifying or designing levels.

7) Since AI only uses host station life energy battery to conduct every operation, you should optionally increase 'energy' and 'maximum' parts by 4 times higher to make it fair for the conditions of AI.

8) Save the changes. That's it! Re-load your saved game again and your host station will be now fully AI-controlled from the point you saved the game. The host station’s activities will be based on the budget and delay values you have assigned to it.

Further descriptions about AI budget and delay values :arrow: :

There seems to be misconceptions about how the AI budget and delay values really work in the game. The budget values have absolutely no effect whatsoever regarding how much energy the AI will invest into certain actions!

AI energy allocations for each action type are purely hard-coded. :idea: Some algorithm modules use mathematical formulae to calculate the required energy values, whilst the others are based on fixed-size constants.

(If anyone is interested, I could hack some .exe files to change the integer values of these hard limits. ;) )

Instead, the budget values only determine how frequently the AI will perform certain actions. The settings for the budget are given in a percentual value in relation to ten minutes.

For example, 80 def_budget value means that the AI will scan for initiating defence activities for every 2 minutes. Likewise with 95 rec_budget value the AI will send out reconnaissance units for scouting purposes for every 30 seconds.

If the budgets are also used to determine intervals between actions, then what purpose do the delays serve? :?: The delay value is, essentially, a one-time function. This means it will be only evaluated once, and that is when the level starts for the first time.

But if it serves so little purpose, do we really need to assign delay values? Technically you don't. The AI will perform flawlessly without any delay values as long as they are assigned with valid budget values.

The delay values are needed because regardless of assigned budget values, when the level first starts the AI host stations are initially allowed to perform any type of actions that are assigned with valid budget values (non-zero). :!:

So, the AI host station with 'rad_budget = 1' and 'rad_delay = 0' can attempt to build a radar station immediately as soon as the level starts, and will keep making repeated attempts for every 594 seconds.

It can be also used to make the levels more interesting to allow more variations for AI activities, however. So its function cannot be overlooked under any circumstances. :mrgreen:

For example, 'def_budget = 99' and 'def_delay = 300000' will make the AI not defend itself at all for the first 5 minutes, and once the time has passed it will start to fiercely defend itself for every 6 seconds!
; Vielleicht der niedlichste Hubi, Knuddel.

Personal Declaration: I always use different usernames across different websites. Hence if you ever see my username is being used outside of Stoudson Corporation, I absolutely have no affiliation whatsoever with that!

Post Reply