In my map/mod I remove each players starting units when the game starts. and then let players manually chose where to start as well as a bunch of other custom settings.
But once I remove the AIs main building I can't get any of the AI functions to work anymore. If I tell the AI to build a building it will go out into the middle of the map somewhere and build it in a random location. I've tried rerunning all the AI initialization functions, using the allocate town functions, creating the main building at their initial spawn points... the AI just doesn't seem to be able to cope.
I think I'm running the alolocate towns function correctly, there is no documentation for it but I've tried everything I could think of.
If anyone can help me that would be awesome. Thanks.
The Melee AI will usually go into a "defeated" mode where it does stupid things or basically gives up. You need to use the campaign AI and build your own AI on top of that. You might have to use some custom script as the GUI lacks the full AI native list and all constants (especially for advanced AI behaviour customization).
There should be natives letting you set their main base. I am not sure if it will automatically add existing buildings to their main base or if they will need to make their own main building.
It was a long time since I fiddled with this and I no longer have the game installed. From what I can recall I think all units has rebuild options, if they should be "existing" at game launch or built when capacity is ready. I also wrote a summary on some of the ai functions which can be found in a corner of the tutorials section of the "new" wiki.
Are these written down anywhere? Or do you have to use an mpq editor to find the names of functions and then take random guesses in the dark as to what the parameters should be?
Yes you need to extract them with a MPQ editor and you need to make "educated" guesses as to the parameter meaning. You can see many of them in the existing AI however.
Additionally most of the core functionality ones for general AI are in GUI and some even are commented. It is only some of the more obscure core AI features (such as AI options like aggressive civs, dumb tactical AI mode, share civs across all bases etc) that need Galaxy as the constants are missing. The most lacking part is tactical AI where most of the filter calls lack GUI interfaces.
From what I can recall I think all units has rebuild options
The AI will only rebuild units marked as "bullies". This is a very confusing name for this functionality since one would expect "bullies" to mean something like "raider" or "harasser". They are probably called bullies because they bully you when you go near an area, similar to how a kid bullies you in a playground. Bullies work well within reason (limited number of replacements) as infinite replacements can bug resulting in the AI making infinite numbers of the bully unit with no place to go.
The Melee AI does it by checking the current army composition and deciding what to make based on that. It does not replaces losses per say, but instead decides on new units to build which act as reinforcements. These might be from the same army composition as the losses or it might be of a higher tier.
AI is highly fascinating and under utilized area which almost every map can benefit from. If the wiki was not sort of in a state of disrepair (no idea what is going on with it ATM) then it would be great to research the area
FWIW I fixed the problem of the computer not knowing where their town is. So if anyone else is experiencing the issue I was here is how I fixed it.
Do not touch any of the victory/defeat conditions after touching any of the AI stuff. editing those conditions will screw the AI system right up wazoo. Seems pretty damn stupid, but whatever.
You must set up your games victory/enable conditions completely. THEN AND ONLY THEN, can you begin setting any of the parameters for the AI.
What happens if you have a game where the victory conditions change during the game? I dunno. I guess you would have to write your own victory/defeat triggers instead of using the inbuilt ones. But that's not an issue for me so I don't care to figure it out.
Still not sure if I can manually edit the computers towns or not but I'll cross that bridge when I have to cross it.