Jump to content
Sign in to follow this  
sarcoma

Modifying AI

Recommended Posts

sarcoma    8

Hi, community

How do I go about understanding the AI code?

I was hoping I could implement some logic and prediction for the AI without delving too deep in the GUI code.

It would be nice if somehow I could get the information learned as the game progresses and inject commands in response to that, like from a black box, then I might be able to focus on the logic.

Thanks

  • Like 1

Share this post


Link to post
Share on other sites
stanislas69    1,912

Hello Sarcoma, if you haven't already I'd suggest you look at http://trac.wildfiregames.com/wiki/GettingStarted aswell as the programmer section on that website. You will need to get the source to be up to date with the development version, if you want to contribute to it.

AI is in JavaScript, which means you don't have to recompile the game each time you change something.  You can find the code in binaries/data/mods/public/simulation

To reproduce a game we use commands.txt which are text replay files. but I don't think that's how the AI works. Unfortunately @mimo our lead AI developper has taken a break for the game and will (might ?) not be able to answer your questions. If you need general guidance, I'd suggest you to drop by IRC on the #0ad-dev channel, you should find someone that might give you clue on how to do it.

Might I ask what do you want to achieve ?

  • Like 3

Share this post


Link to post
Share on other sites
sarcoma    8

Hi, Stanislas

I had a look at

http://trac.wildfiregames.com/browser/ps/trunk/binaries/data/mods/public/simulation/ai

I was wondering if it were posible to create an inference engine and use Q-learning to command the AI to make better decisions but I would need a way to get stimuli from the ongoing game.

Or maybe if the commands.txt is parsable to extract the actions people normally do, I could use that to create blind build orders.

I found http://yieldprolog.sourceforge.net/ hoping to translate prolog into js.

Thanks

Share this post


Link to post
Share on other sites
stanislas69    1,912

If you look at the replay code in the source folder you will find how we parse it to replay games, we basically execute player commands one by one to replay the exact same thing, So I guess learning from that is doable, though it will require some data extracting cause it's quite raw. But that's an interesting project. Maybe you'll find more stuff here :

https://github.com/agentx-cgn/Hannibal and https://github.com/lexoyo/split-bot/blob/master/src/BotAI.hx unfortunately both dead projects AFAIK, maybe @agentx is still around to help you.

  • Like 1

Share this post


Link to post
Share on other sites
sarcoma    8

Hi, guys

I will have time to work on this in 2 weeks when I'm off of work.

I need to model the agents: units, structures, resources, etc.

Where in the code can I get the numbers of each? HP, speed, attack, armor, etc.

I couldn't find that info in

http://trac.wildfiregames.com/browser/ps/trunk/binaries/data/mods/public/simulation/templates

Thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×