Current trunk AI changes

For AI and campaign script related discussions and questions
Post Reply
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Current trunk AI changes

Post 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.
User avatar
Zarel
Elite
Elite
Posts: 5770
Joined: 03 Jan 2008, 23:35
Location: Minnesota, USA
Contact:

Re: Current trunk AI changes

Post 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.
User avatar
DylanDog
Code contributor
Code contributor
Posts: 347
Joined: 08 Apr 2009, 15:15
Location: Germany
Contact:

Re: Current trunk AI changes

Post 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?
My Warzone 2100 mods:
Download DyDo-AI for Warzone skirmish/multiplayer games.
Download A2C-HM (Alpha 2 Campaign - Hard Mode).
Download A3C-HM (Alpha 3 Campaign - Hard Mode).
User avatar
Mysteryem
Global Moderator
Global Moderator
Posts: 728
Joined: 22 Sep 2008, 19:44
Location: UK
Contact:

Re: Current trunk AI changes

Post 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.
"...If pure awesomeness were bricks, this would be the Great Wall of China...
The glory of this has collapsed on its self so far, that even the neutrons have collapsed."
KukY
Regular
Regular
Posts: 1859
Joined: 20 Mar 2009, 21:56

Re: Current trunk AI changes

Post 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.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Current trunk AI changes

Post 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
User avatar
KenAlcock
Trained
Trained
Posts: 196
Joined: 25 Nov 2009, 03:50
Location: Detroit, Michigan, USA

Re: Current trunk AI changes

Post by KenAlcock »

Per wrote:or Zarel will go all out of balance on me ;)
:D :P
My game handle is Cosmic Raven or Cosmic Raven 68
User avatar
DylanDog
Code contributor
Code contributor
Posts: 347
Joined: 08 Apr 2009, 15:15
Location: Germany
Contact:

Re: Current trunk AI changes

Post 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.
My Warzone 2100 mods:
Download DyDo-AI for Warzone skirmish/multiplayer games.
Download A2C-HM (Alpha 2 Campaign - Hard Mode).
Download A3C-HM (Alpha 3 Campaign - Hard Mode).
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Current trunk AI changes

Post 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.
User avatar
DylanDog
Code contributor
Code contributor
Posts: 347
Joined: 08 Apr 2009, 15:15
Location: Germany
Contact:

Re: Current trunk AI changes

Post 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.
My Warzone 2100 mods:
Download DyDo-AI for Warzone skirmish/multiplayer games.
Download A2C-HM (Alpha 2 Campaign - Hard Mode).
Download A3C-HM (Alpha 3 Campaign - Hard Mode).
Post Reply