Jump to content

Scripting a battle?


pruna
 Share

Recommended Posts

I'd like to know if it's possible (and ideally a rough idea about how-to) create a script for a fixed battle, where I can define what units will participate, what will each do, and the result of it. My objective is that I can then create some kind of demo or story, with a predefined and fixed result, where the user can "see and navigate" the battle, but not change the course of it.

I hope to be clear. Thanks in advance!

--

Andres Ferrando

http://www.pruna.com.ar/

Link to comment
Share on other sites

I'm sure there is some way, after all that sounds more or less like watching two AIs play out a game :) If you want more direct tips for how to do I guess you'll have to wait for someone with more direct knowledge of the scripting, but for now/if you want to take what little advice I can give, I suggest you take a look at how the AIs in the game does things. The two most up-to-date are Jubot and Qbot. Jubot is in the game, and qbot can be found via the links here: http://www.wildfiregames.com/forum/index.php?showtopic=15159

Link to comment
Share on other sites

Hi,

Thanks for your quick answer! Yes, that's exactly what I've imagined. It's like looking someone's else game. The big issue is how to set a fixed match for this other two players (and mainly don't let AI do different things each time) :D

I'm sure there is some way, after all that sounds more or less like watching two AIs play out a game :) If you want more direct tips for how to do I guess you'll have to wait for someone with more direct knowledge of the scripting, but for now/if you want to take what little advice I can give, I suggest you take a look at how the AIs in the game does things. The two most up-to-date are Jubot and Qbot. Jubot is in the game, and qbot can be found via the links here: http://www.wildfireg...showtopic=15159

Link to comment
Share on other sites

AI's are deterministic, so they will play exactly the same way each time unless you introduce a pesky non deterministic human into the game.

./pyrogenesis -quickstart -autostart="Oasis II" -autostart-ai=1:qbot -autostart-ai=2:jubot is an example of how to run an AI vs AI game from the command line (on windows you would need pyrogenesis.exe). This will have a free camera but it wouldn't be too hard to have a scripted camera given a bit of modding, so I wouldn't let that put you off.

The AI scripting isn't perfectly suited to coordinating large battles but it is definitely possible. If you want help I would be happy to answer questions since I know the AI systems pretty well. Also on irc there is often someone around.

Link to comment
Share on other sites

Well, these are great news, and will save me a lot of time!

But, besides starting from a specific situation (regarding units, terrain, etc), I also want a specific development for the battle. I don't need to specifically indicate all the movements, but yes at least to give some hints for different moments (for instance: start going for some specifich path, or retire-reagroup-attack, or start the attack by the middle, etc.). I don't know if this AI engine has some "listeners" to follow this scripted hints (so, as they will also be allways the same, the result will also be the same).

Regards,

Link to comment
Share on other sites

AI scripts get run at regular intervals during the game, several times a second. You get given a list of events which include entity creation/destruction and attacks. You can also access information about every entity in the game so you can use this to look at positions of units etc. You can then give entities commands e.g. move, attack. (Every unit in the game has/is an entity basically, so every tree, soldier, building...). You should be able to use some combination of events, entity information and game time to detect when to give units commands.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...