roadtripping.ph Posted August 1, 2019 Report Share Posted August 1, 2019 (edited) 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 August 1, 2019 by roadtripping.ph Quote Link to comment Share on other sites More sharing options...
Loki1950 Posted August 1, 2019 Report Share Posted August 1, 2019 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 Quote Link to comment Share on other sites More sharing options...
roadtripping.ph Posted August 1, 2019 Author Report Share Posted August 1, 2019 How does the code calls petrabot scripts during the system built and when the game is running? I'd like to know it. Quote Link to comment Share on other sites More sharing options...
Loki1950 Posted August 1, 2019 Report Share Posted August 1, 2019 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 Quote Link to comment Share on other sites More sharing options...
Lion.Kanzen Posted August 1, 2019 Report Share Posted August 1, 2019 @historic_bruno @wraitii @Freagarach 1 1 Quote Link to comment Share on other sites More sharing options...
Freagarach Posted August 1, 2019 Report Share Posted August 1, 2019 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. 1 2 Quote Link to comment Share on other sites More sharing options...
roadtripping.ph Posted August 2, 2019 Author Report Share Posted August 2, 2019 (edited) 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 August 2, 2019 by roadtripping.ph Quote Link to comment Share on other sites More sharing options...
Freagarach Posted August 2, 2019 Report Share Posted August 2, 2019 @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). Quote Link to comment Share on other sites More sharing options...
roadtripping.ph Posted August 2, 2019 Author Report Share Posted August 2, 2019 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? Quote Link to comment Share on other sites More sharing options...
roadtripping.ph Posted August 3, 2019 Author Report Share Posted August 3, 2019 It was a conflict because there were these .zip folder with the mod too. I´ve solved it. Thanks for you help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.