Page 1 of 1

Current trunk AI changes

Posted: 15 Jan 2010, 18:25
by Per
There has been some interest in my recent changes to the AI loading code, so perhaps I should explain what I am working on. The idea is to build an interface for the user to choose between different AIs in the pre-game dialog. Each AI needs only one .slo, one .vlo and one .ini file, and can optionally have an additional slo/vlo set for common event handling, such as cheating. The .ini file merely describes the name of the AI, and any files it needs to have loaded.

I have added a new script function getPlayer() which replaces the current method of defining a player number by specifying it in the VLO file. You call getPlayer() once in your CALL_GAMEINIT event (and only there) to pick up your player number, and there is no longer any need for maintaining eight copies of the same AI script.

This work is not done yet, and I will describe in more detail how to adapt AIs to this new system when it is completed.

There is also another new scripting function added lately - scavengersActive(), which returns a boolean telling you whether there are active scavengers on this map. I used this to reimplement the scavenger AI loading as well. Scavengers in trunk are now active again - very active. (I will probably have to tone them down a bit, or Zarel will go all out of balance on me ;) Please let me know how they seem to you.)

I also fixed the skDoResearch() function so that allies will not be researching the same techs, and made sure that the CALL_RESEARCHCOMPLETED trigger gets sent correctly when allies send you research and the 'work harder' cheat is used.

Note that all of these change are trunk only at the moment.

Re: Current trunk AI changes

Posted: 15 Jan 2010, 19:13
by Zarel
Per wrote:I also fixed the skDoResearch() function so that allies will not be researching the same techs, and made sure that the CALL_RESEARCHCOMPLETED trigger gets sent correctly when allies send you research and the 'work harder' cheat is used.
This appears to be worth backporting.

Re: Current trunk AI changes

Posted: 19 Jan 2010, 22:58
by DylanDog
Per wrote:You call getPlayer() once in your CALL_GAMEINIT event (and only there) to pick up your player number, and there is no longer any need for maintaining eight copies of the same AI script.
This is a great improvement.
Per wrote:I used this to reimplement the scavenger AI loading as well.
Do you mean there is an AI script which manages scavenger droids only? where can I find it?
Per wrote: and the 'work harder' cheat is used.
Which chet is this one? 'work harder'? can you drop a link to a page which explains this cheat?

Re: Current trunk AI changes

Posted: 19 Jan 2010, 23:17
by Mysteryem
DylanDog wrote:
Per wrote: and the 'work harder' cheat is used.
Which chet is this one? 'work harder'? can you drop a link to a page which explains this cheat?
the work harder cheat completes all of your current research that's being researched.

And I'm not sure which files manage the scavenger ai, but I'm pretty sure data\base\multiplay\script\scavfact.slo and scavfact.vlo are part of it.

Re: Current trunk AI changes

Posted: 19 Jan 2010, 23:56
by KukY
Mysteryem wrote:And I'm not sure which files manage the scavenger ai, but I'm pretty sure data\base\multiplay\script\scavfact.slo and scavfact.vlo are part of it.
I looked at those scripts, and if I remember good, they aren't AI scripts, but something for Scavanger factory.

Re: Current trunk AI changes

Posted: 20 Jan 2010, 00:06
by Per
DylanDog wrote:Do you mean there is an AI script which manages scavenger droids only? where can I find it?
multiplay/script/scavfact.slo
DylanDog wrote:Which chet is this one? 'work harder'? can you drop a link to a page which explains this cheat?
See Cheats

Re: Current trunk AI changes

Posted: 20 Jan 2010, 01:27
by KenAlcock
Per wrote:or Zarel will go all out of balance on me ;)
:D :P

Re: Current trunk AI changes

Posted: 20 Jan 2010, 15:42
by DylanDog
Per wrote: multiplay/script/scavfact.slo
13KukYNexus666 wrote:I looked at those scripts, and if I remember good, they aren't AI scripts, but something for Scavanger factory.
This script does the following:
  • - Build scavengers (trike,buggy,jeep,bloke) and assign them to a group (defendGroup,wanderGroup,attackGroup)
  • - When wanderGroup memebrs are >= 4 move them to the centre of the MAP and un-assign all droids from wanderGroup (to allow the building of anew wanderGroup)
  • - If a scavenger structure is attacked move the attackGroup to that stucture location
...well this script would require some improvement... :)
What I do not understand, is this script called by WZ if scavengers are in a map or you have to do it manually?
Per wrote:See Cheats
Thanks. Sometimes it is hard to move through the documentation.

Re: Current trunk AI changes

Posted: 20 Jan 2010, 16:39
by Per
Note that I can only speak for how it works in trunk.

The scavenger script is run whenever a 2 or 4 player map is loaded. It is not run for 8 player maps. This is controlled from the wrf files. When loaded, it calls scavengersActive() to check if it should be running, and if not, deactivates all its own events (sets their triggers to inactive).

What improvements would you like to see for the scavengers? I removed their ability to randomly attack players, because I thought that was not fair. Especially since I made the scavengers much more deadly by eliminating delays.

Re: Current trunk AI changes

Posted: 21 Jan 2010, 16:02
by DylanDog
Per wrote: What improvements would you like to see for the scavengers? I removed their ability to randomly attack players, because I thought that was not fair. Especially since I made the scavengers much more deadly by eliminating delays.
I do not know precisely because I understand we should keep the scavenger not too "intelligent". Maybe instead of sending the wanderGroup to the middle of the map keep them scouting (not moving) every now and then around the scavenger base attacking everything they meet. I would then join the two groups attackGroup & defendGroup together to defend the base when under attack...this is just an idea.