Jump to content

AI / Petra writing to commands.txt


jonbaer
 Share

Recommended Posts

Real stupid question, I can't believe I have yet to figure this out after staring @ the code for over an hour but the commands.txt file for -replay and -replay-visual - where does Petra write his commands?  Or is it that since the metadata on the AI (seed,diff,etc) is @ start that on the replay it will just run again?  I'm trying to understand where that data is stored (or how game state is reconstructed from commands.txt w/ such little info) ...

Link to comment
Share on other sites

The current AI in 0 A.D. is completely deterministic. So it doesn't need to store data, and will run the same game if it starts from the same seed (given that the other game events are the same).

So the only thing that needs to be remembered are the commands given by users.

Btw, having an AI to be deterministic is also great for testing it. It means that starting a replay runs the AI decision code again, and makes it possible to find rare errors in the AI code. While if the AI would store its decisions, the AI code wouldn't have to run again, and some rare problems wouldn't be reproducible.

It also has disadvantages though, like visual replays could be a lot smoother if the AI didn't have to make its decisions again. Or when an AI shouldn't be deterministic, it could learn from older games while playing. But for that purpose, a different AI API should be written (one that acts more like a player and less like a part of the simulation).

Link to comment
Share on other sites

Yeah I ended up peeking @ PETRA.Config.debug = 3 to see everything.  (BTW is there a way to get access to PETRA inside of console for testing?) ... I think my toy approach is to have different "strategies" per Civ and react to different situations per opposite Civ strength/weaknesses, much akin to say what sports analytics does.  The machine learning approach where the attack / defend / trading plans change over time sure is interesting.  An unbeatable AI will not be fun to play against (as is evident by comments I have seen here) but the challenge of getting to watch it play out is rewarding.  I only tried a hack so far where commands came from Neo4J, 

And using random/continent as a super simple starting base.

  • Like 1
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...