Jump to content

PETRABOT - how to improve it?


Recommended Posts

I want to improve Petrabot code and test it against the existing one. In order to do it I need to (i) make the game recognize my "new" petrabot (with the logic I will create) and (ii) I need to change petrabot script. I noticed that the petrabot scripts are all in a zip folder when I download the source code. I do not understand the reason why it is compressed. 

How does the code calls petrabot scripts during the system built and when the game is running? I'd like to know it.  

Where should I start? Which function calls Petrabot script? Which source-file do I need to start with?

Edited by roadtripping.ph
Link to comment
Share on other sites

They are part of what is called the public.zip it also includes all of the game assets ie: models and textures which have a large memory footprint so they are zipped to lighten the download size. That and the zip is the default MOD for the game engine which method did you use to get the source code when I last got the code using a svn client it was not zipped.

Enjoy the Choice :) 

Link to comment
Share on other sites

Check the simulation folder sub-folder ai within the public.zip the common api should give you what you need to know as well as the petra folder give your new ai a name and put the code init's own folder for testing the ai may be chosen in the game setup GUI.

Enjoy the Choice :) 

Link to comment
Share on other sites

I would advise looking into the modding guide to see how to create your own mod. There you need to add your new AI (under the same path as in vanilla (i.e. the "public" mod), i.e. "<NAMEOFYOURMOD>/simulation/ai/<NAMEOFYOURAI>"). I would suggest copying the PetraAI (changing its name, also in "data.json") and tinkering with code as you go, watching the effects of your changes. In the "config.js" you can find a variable "this.debug" which can greatly aid you in what is going on during a game.

I hope this helps. If you need more information, please ask.

  • Like 1
  • Thanks 2
Link to comment
Share on other sites

I did it. I have created a mod based on PetraBot, the file is here: Mod_Bot

stored it into the /home/pedro/.local/share/0ad/mods/public folder, as recommended by the documentation.

Additionally I have tried to load it through command line through the command ./pyrogenesis ~/.local/share/0ad/mods/public/sophia.zip. 

However, the game mod is not opened as it should. 

What is wrong? 
 

Edited by roadtripping.ph
Link to comment
Share on other sites

@roadtripping.ph, you can try moving your mod (the link does not work for me) one level up and unzip it there. So that it would read "~/.local/share/0ad/mods/sophia/simulation/" etc. Then you could open 0A.D. normally and go to "Settings", then "Mod Selection", where you should see your mod in the list (if you have a proper mod.json).

Link to comment
Share on other sites

Ok. Now the mod appear in the game (screen shot bellow) - for some reason there are more than one mod and it adds one more sometimes as I open the game again and again. 

However, when I press Start Mods the game reloads to the very same screen (it happens to the mod that came with the game too, the 0ad), the Quit button ends the game, the other buttons do not take me to the game main menu either. 

How can I go to the game from here?

mod.thumb.png.7ff46bd47f985e77da4e27bc4097f75f.png

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...