Need help on creating an A.I.

Discussion of all aspects of the game engine, including development of new and existing features.

Moderator: Forum Moderators

Post Reply
IArgosyI
Posts: 6
Joined: October 22nd, 2012, 7:28 am

Need help on creating an A.I.

Post by IArgosyI »

Hi, I'm currently trying to implement an A.I. on Wesnoth.

The problem is I really have no idea where to start.

I've tried reading http://wiki.wesnoth.org/WritingYourOwnAI but for some reasons I couldn't find the correct ai.cpp file that this page mentioned.

I did find some files named "ai.cpp" but none of that have the function "create_ai" that the page mentioned - -.

So if anybody could teach me how or point me to where I should be reading, that will be really helpful

thx
mattsc
Inactive Developer
Posts: 1217
Joined: October 13th, 2010, 6:14 pm

Re: Need help on creating an A.I.

Post by mattsc »

Hi, IArgosyI. Yeah, that page is pretty outdated. If writing the AI in C++ is what you are looking for, I won't be able to help you, but if you're fine with using Formula AI or Lua AI instead, this is a good starting point: [wiki]Practical Guide to Modifying AI Behavior[/wiki].
IArgosyI
Posts: 6
Joined: October 22nd, 2012, 7:28 am

Re: Need help on creating an A.I.

Post by IArgosyI »

Thanks mattsc, I am now studying Lua Engine. It seems simple enough, but I have some questions regards its capability.

I'm trying to develop an A.I. that can adapt to the player's level, so I need to also collect and store decisions that player(s) made.

Is this possible to created using Lua Engine? If so how(or is it already explained in the tutorials? I've only read a little bit of the tutorials and have absolutely no background knowledge of Lua)
User avatar
Alarantalara
Art Contributor
Posts: 786
Joined: April 23rd, 2010, 8:17 pm
Location: Canada

Re: Need help on creating an A.I.

Post by Alarantalara »

No AI has direct access to the actions of the player — they run while the player is not playing. It is possible to capture player actions using WML events or by doing before/after comparisons of the game state at the end/beginning of the AI's turn.
WML can persist captured values to a persistent storage as of 1.10, so you should be able to use it to get what you want.
IArgosyI
Posts: 6
Joined: October 22nd, 2012, 7:28 am

Re: Need help on creating an A.I.

Post by IArgosyI »

Apart from comparing the before/after state of the A.I. turn, is it possible to have the A.I. send some value(e.g. its CA score) to the map or to the other A.I.?
Post Reply