Jump to content

ramtzok1

Community Members
  • Posts

    50
  • Joined

  • Last visited

Everything posted by ramtzok1

  1. I managed to solve the problem! After a deep understanding, what does GetAIs it's looking for every json file in the directory simulation/ai and part of my communication between the game and the machine learning module I'm using a json file to send units to the ML (It is loaded with all the possible fighting units. Huge file). The game picks it as part of AI and tries to load it, that's why it fails. Thank you so much for your help! I really appreciate that!
  2. warn(Engine.GetAIs()[0].data.toSource()); // BadBot - Our first ever bot warn(Engine.GetAIs()[1].data.toSource()); // Petra warn(Engine.GetAIs()[2].data.toSource()); // Crashes warn(uneval(Engine.GetAIs()[2].data)); // Crashes warn(Engine.GetAIs([2]).id); // Undefined warn(Object.keys(Engine.GetAIs()[0])); // data, id warn(Object.keys(Engine.GetAIs()[1])); // data, id warn(Object.keys(Engine.GetAIs()[2])); // Doesn't crash - data, id This is what I have found. I think I will head back to the GetAIs CPP function. I can't determine what causes it to be undefined.
  3. Already tried that :/, the second I run the game it crashes. I debugged where the crash is and it is inside of stdio.h. function loadAIDescriptions() { warn(uneval(Engine.GetAIs())); var ais = Engine.GetAIs(); translateObjectKeys(ais, ["name", "description"]); return ais.sort((a, b) => a.data.name.localeCompare(b.data.name)); } This compare is very important to our project because this what we have worked for this whole year. We have to know if we did improve PETRA with machine learning...
  4. Good to know this file exists :), however, I already looked up the errors it seems like it can't load the data from data.json, I can't figure out what is going on. Here's data.json { "name": "PetraML", "description": "PetraML is our work for a project about machine learning.", "moduleName" : "PETRAML", "constructor": "PetraBotML", "useShared": true } I tried to go deep into the cpp where GetAIs is called in the file "settings.js" line 101 but I can't understand what is wrong, the code seems to have no problem getting the file. I don't know what else to attach or say in order to help you understand the cause.
  5. Hello, You may remember me from past threads related to implementing ML on 0 A.D. We made huge progress since last thread. I'm now trying to compare old PETRA and our new PETRA to see if there are any improvements and I can't figure out how to make it right. What I tried: 1. I created a new folder called PetraML and copy and pasted all the files of PETRA. 2. I edited the file data.json where the name of PETRA is: PetraML. The description is different from the old PETRA. The moduleName is now "PETRAML" and the constructor is now "PetraBotML" 3. I changed on every file in PetraML where: var PETRA = function(m) is now: var PETRAML = function(m) 4. I changed on every file in PetraML where: }(PETRA); is now: }(PETRAML); 5. I changed on _petrabot.js from: m.PetraBot = function PetraBot(settings) to: m.PetraBotML = function PetraBotML(settings) I don't know what to look for more than that. I'm getting errors from the game when I trying to make a game (Picture attached). Can anyone help me solve this? thank you!
  6. There you go. https://github.com/ram1660/0ad Go to the AI folder to find our AI badbot.
  7. No problem, I will upload to my fork, though we are using an old version of the game with no plans of updating to the new one. Ok, will do, thank you for that! We won't build the AI from scratch in our case instead the idea is to use some of Petra's parts (our project is very limited on time) for an example gathering. It will basically be bunch of if-else statements reading the output of the Python ML module. Our machine learning will be focusing mostly on defending properly since we found it to be a lot easier to change and improve than attacking (because of deferent attacking and execution plans).
  8. Hey, No, we haven't! I managed to make the linking! I dug down into the game engine code and figured out what code was related to Engine.{FunctionName} in JavaScript files. I modified the code by adding 2 functions, AppendToBuffer and WriteToFile so we can send data the Python, I also added useful functions that cannot be accessed from the simulation folder. Right now we are trying to understand Petra's attack and defense in order to develop the machine learning and we really need an active Petra maintainer so we can ask him about stuff we don't fully understand.
  9. Hello again everyone! Link to the last thread : This is a follow-up to the last thread I made; Our project supervisor wanted me and my partner to consolidate all the information from the beginning, so I will go again and explain our problems regarding the project we are developing. Our main idea is to develop machine-learning capabilities within the AI in the game. To do so, we are planning to use a work environment (probably TensorFlow) that works with python. Therefore, we need to find a way to connect our ML code that will be written in python with the AI files that are written in JavaScript. So far, we have been offered to use interfaces that are already found in the game code in C++, write the data that we need to a file that we can use ML on, and calling the JavaScript functions using python server in a way that could make us access the valuable API. We have also been offered TensorFlow.js, but unfortunately it turns out that the mathematical libraries essential to ML are not included with it. At the end, we have chosen the third option, and started working on a server that will fulfill our objectives in creating the link. However¸ we have ran into some problems regarding the JavaScript connection. We tried to use jQuery to create requests with the server, but spiderMonkey does not come with it. At the end of the day, we really want to use the server as a connection between JS and Python, and we would like to ask for any way for us to do so. Even so, if there are any other good ways that exist and can work with the game, we would be happy to hear. Thank you to all for your help and patience with us so far! It is really not that obvious. EDIT: Some more insight on what we have done so far: We want to extend the existing AI code, written in javascript, with machine learning code written in Python. To do so, we need to invoke our Python code from within the javascript code. We have been offered to make this connection via http (i.e. AJAX), but the game's spidermonkey engine doesn't seem to support AJAX.
  10. Making this will be a problem because then I can't call to functions in my AI to Python or vice versa. Flask making it easy for me to make a Python server dedicated to that purpose.
  11. If I'm not wrong, the command: Engine.IncludeModule should help me?
  12. Hey, It has been a while since I updated the thread. I tried to make a local server between Python and JS using Flask. I can't make a connection in Javascript side with the server, I tried using Ajax and jQuery but the game says every time $ (Ajax symbol) or jQuery.ajax() is undefined. Do you know what is wrong?
  13. I looked at the game code, it uses SpiderMonkey. Won't be any problem to use V8 for example?
  14. Sorry for my misunderstanding. You may be right but as I explored it, there is a chance I maybe prefer to use other libraries that Python can provide like "Keras" and "Scikit learn" regardless to TensorFlow.js, moreover I can't place any .js file inside the AI folder which isn't related to the AI itself because the game tries to load it, fails (Can't import Tensorflow) and then crashes.
  15. It's too early for me to talk about the ML itself. My objectives Right now are to establish a connection between the game and the machine learning work environment, understand how I can grab valuable information from the game, process it, and report it back to the game.
  16. Very interesting! I think I will be able to use the common-api if I manage to make the connection.
  17. I understand. Do you have any idea how can I debug the JavaScript files?
  18. Do you have any idea where should I look for in order to start? Thank you! As I said to (-_-), do you have any idea where to look for inside these files or perhaps other files to start hooking/dumping?
  19. In term of performance, hooking into C++ interface is much faster?
  20. Hello, I have a project where I want to connect Python to the game to implement a Machine learning on it. Now is there a way I can listen to the messages the game sends to me with Python? I have looked at Common-API and PetraBot and I have seen that it uses json format to serialize and deserialize game data but I don't fully understand how I can listen to it from a Python file. Thank you for your answer.
  21. Thank you for your answer! Is there a way to debug petraBot to see how it works in an action?
  22. Hello, I want to program my own AI and eventually making ML from it but first I need to learn how to program an AI. I don't know where can I get documentation to see what common-api folder has to offer. I read the tutorial "[Tutorial] Develop a new AI" but it really explains only about the basics of the main loop and how to initialize my bot. It's unclear what files do I need to create and what does each prototype functions inside common-api. Does anyone have a good source or a good documentation? Thank you for your help. (Sorry for my bad English)
×
×
  • Create New...