zwzsg wrote:For Spring missions, I once made an AI whose goal was to rebuild lost units and give them back their order queues. Maybe this doesn't count since ...
No, no! That's exactly what I meant. I agree with you - that's what a proper Campaigns AI is like.
FLOZi wrote:I thought Paulo was meaning an AI to control the opponent in the campaign, not as the protagonist.
Ditto
Silentwings wrote:... I think there are definately use case for mission AIs, but they have to be quite closely tied to the missions. With the ability to specify what/when units are controlled by the AI and what such units can/can't do in general terms, it could work.
AF wrote:What would a mission AI need to do? Perhaps:
- Maintain a quota/inventory of units with an upper limit
- Constrain building within a certain area
- Maintain an economy at a certain level, building towards it but never passing it
- Favour certain units and not build others ( e.g. if a mission introduces a new unit type, an AI might build units vulnerable to that type, or be introduced their own type )
...
Exactly - a campaign focused AI can/should be .. less competent (easier to code) but on the other hand more complex: it needs strong specification of behaviour from an external source instead of having hard-coded one single major override - Explore->Expand->Exterminate. That is, if the AI is to guard the bridge on Mission#1 and attack lightly on Mission#2, it is unreasonable to hard-code that behaviour in the AI (one AI per mission!? Sucks. Recompile the Java AI for each configs change!? Sucks).
So, those behaviour specifications need to come from an external source for it to be feasible. I can think of 2 sources of behaviour specification (and I don't know where any of these is doable in Spring):
#1- configuration files;
#2- instructions from the mission's scripting.
#1
Something like loading a JSON file or Lua config file or whatever, with some variables describing the behaviour, like:
Code: Select all
MaxEnergyProd=200;
Expand=no;
GuardAreaX=123;
GuardAreaZ=456;
This, however, is very limiting as it would be hard to make variable behaviours throughout the mission (like the AI getting "angry" at you stealing their sacred gas - aka: some deity's fart). Is it possible for an AI to load variable config files according to mission?
#2
As far as I know, the mods/content packs are controlled by Lua scripts and that's how the missions are controlled to. Those Lua scripts will trigger victory/lose conditions and what not (player has sniffed the sacred gas) and could then give instructions to the AI:
I seem to remember that there is no way to communicate with the AIs, right? I reckon that if everything was done in Lua then Lua could exchange whatever variables between itself, though not with the missions being controlled in Lua and the AIs controlled in C++/Java, correct?