soundmud / soundrts

A real-time strategy audio game
http://jlpo.free.fr/soundrts
Other
43 stars 31 forks source link

allow to add an AI to computer_only units on maps #136

Open sanslash332 opened 2 years ago

sanslash332 commented 2 years ago

Currently when you want to add computer_only units on the maps for defend some area or other things, currently these units keep in place a don't do nothing until you reach their position and start a battle against them.

Will be awesome if you can add on the map settings a special AI that can control these units. Of course you've to create and set the configs for that AI for that map, but this will allow to create some things like respawning units, enemy that patrols some area, units that can defend treasures spauning skills and not only with brute force, etc.

This will be very awesome because create mods that are like a mova will be very easier :3

Thanks.

MatejGolian commented 2 years ago

I second that = that would be great!

soundmud commented 2 years ago

I recently replied privately to a similar question:

Here are 3 triggers allowed in multiplayer mode too:

trigger computer1 (timer 0) (order (d1 10 dragon) ((patrol d9)))

Will order up to 10 dragons from d1 to patrol between d1 and d9.

timer_coefficient 60 trigger computer1 (timer 20) (order (e3 10 dragon) ((go b2)))

Will order up to 10 dragons from e3 to attack b2 after 20 minutes (normal speed).

trigger computer1 (timer 0) (ai easy)

Switch computer_only AI from "do nothing" mode to the usual "quiet computer" mode. By default it will send a dragon to explore "pacifically" all the map. The AI will retaliate massively to the first real encounter thought. Probably too much.

When I tested I noticed that the map didn't end when a player is eliminated. This is probably a bug when a trigger is added to a multiplayer map. I will fix this bug.

To spawn units, the "add" action is probably working too.

soundmud commented 2 years ago

Note: computer1 is the first computer_only "player"

soundmud commented 2 years ago

The bug is not actually a bug but I may add the following explanation to the map making manual:

If a multiplayer map defines at least one trigger, the default multiplayer triggers are ignored. The goal is to allow custom victory conditions.

To keep the default victory conditions, the following triggers must be explicitly added to the map (or the game won't stop automatically):

trigger players (no_enemy_player_left) (victory) trigger players (no_building_left) (defeat) trigger computers (no_unit_left) (defeat)

Note: the third trigger is not really needed.

Ali-Bueno commented 2 years ago

Actually tested that yesterday. So, I have an other question related to this. Is actually a trigger to for example, when only one unit dies, trigger sometting? Cause looking at campain examples I ave only seen triggers for constructing things or defeat all the enemy units

Ali-Bueno commented 2 years ago

But yea, will be great if that you can create map events to happen at some intervals or something. Like trigger a spell every 30 seconds, that makes meteorites fall to 10 seconds in some zones of the map. I think that can bring a lot of variety to the game, and people will manage to create very diferent game modes inside SoundRTS