AI Wars.

Brainstorm ideas of possible additions to the game. Read this before posting!

Moderator: Forum Moderators

Forum rules
Before posting a new idea, you must read the following:
User avatar
irrevenant
Moderator Emeritus
Posts: 3692
Joined: August 15th, 2005, 7:57 am
Location: I'm all around you.

AI Wars.

Post by irrevenant »

Idea:
1) modify the multiplayer screen to enable the user to select from different AIs.
2) Start an "AI Wars" coding competition to see who can develop the most kick-butt AI. Advertise it on the front page and further abroad in AI coding circles.
3) The AIs face off against each other using step #1 above.

AIs are to be released under the GPL for future use in Wesnoth.

I'm not sure if some sort of prize is appropriate or if bragging rights (and a credit in Wesnoth, of course) are sufficient.

Thoughts?
Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Post by Dave »

The idea of AIs being developed and played against each other competitively is a very old idea. We just haven't had anyone develop an AI which is competitive with the default one I wrote.

There is already a command-line interface which was developed for this purpose, and which is probably more appropriate than GUI modification, since it can easily be plugged into a script.

If someone can actually write an AI that can compete with the default AI, I would love to play them against each other. :)

David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
User avatar
irrevenant
Moderator Emeritus
Posts: 3692
Joined: August 15th, 2005, 7:57 am
Location: I'm all around you.

Post by irrevenant »

Clearly, the Wesnoth community doesn't currently have the combination of skill, time and interest to make AI a priority. That's why I focussed on making the task appealling to people outside the community.

Wesnoth is (according to Happy Penguin, at least) the most popular game available for Linux. I find it hard to believe that Wesnoth wouldn't attract FLOSS coders willing to work on it if it plugged it the right way (a competition makes it a bit fun).

When the AI-wars idea was first raised, how was it advertised outside the Wesnoth community?

I agree that the command-line interface is technically superior and I wouldn't suggest its removal. However, I'd still suggest adding an in-game one as it has two advantages over the CLI one:
(a) It's more visible; it draws attention to the fact that Wesnoth has support for multiple AIs.
(b) It's convenient for players to choose their opponent AI (much the same way Quake lets you choose an opponent bot in-game).

The UI infrastructure all seems to be there already; the 'player' dropdown of the game creation screen would list multiple AI opponents instead of just 'Computer Player'.

Re: #b, note incidentally that weaker AIs are useful too; eg. as opponents for newbies.

I think you actually have a bit of a Catch-22 going on here: AI support is a low-profile aspect of Wesnoth because there's only the one AI for it, and there's only one AI for it 'cos it's a low-profile aspect.
Dragon Master
Posts: 1012
Joined: February 11th, 2006, 1:04 am
Location: Somewhere

Post by Dragon Master »

Not that I can program AI's, but are you looking for the generic "easy, medium, hard" AI's or something like "defensive, aggresive, balanced, hoarder, assassin, etc." AI's?
User avatar
irrevenant
Moderator Emeritus
Posts: 3692
Joined: August 15th, 2005, 7:57 am
Location: I'm all around you.

Post by irrevenant »

Dragon Master wrote:Not that I can program AI's, but are you looking for the generic "easy, medium, hard" AI's or something like "defensive, aggresive, balanced, hoarder, assassin, etc." AI's?
Good question.

It would be useful to have an AI that's smarter than the current one (uses poison well, handles fog, etc.).

But really, the idea was to open Wesnoth AI creation to the world and make it interesting, so people could (and would want to) contribute a wide variety of AIs.
DimWit
Posts: 27
Joined: April 3rd, 2006, 6:01 am

Post by DimWit »

haven't really downloaded the source or messed with xml files... but was curious since i saw this here (and huge fan of old http://necrobones.com/atrobots/ asm robot programming ai ) how is ai currently implemented? script language or hard coded in engine in cpp?
Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Post by Dave »

irrevenant wrote: Wesnoth is (according to Happy Penguin, at least) the most popular game available for Linux. I find it hard to believe that Wesnoth wouldn't attract FLOSS coders willing to work on it if it plugged it the right way (a competition makes it a bit fun).
Firstly, only a smallish percentage of FLOSS coders know C++ well enough to write a Wesnoth AI in it.

For that reason I did push for someone to write a good Python interface to the AI, and this has been done. Yet it might still be difficult to write a good AI with the speed of Python.
irrevenant wrote: When the AI-wars idea was first raised, how was it advertised outside the Wesnoth community?
We've never done that much 'advertising' of anything.

Quite a few people have expressed interest in writing an AI though, but no-one has ever succeeded. I think a large part of this is that writing a good AI is (much) harder than many people think.

I think that the complexity of writing a good AI for Wesnoth is substantially beyond writing a good AI for the 'academic' games that are specifically designed to allow for writing good AIs. For that reason, I think it would take someone of substantial skill and energy to write one that would be useful -- I don't think that we're suddenly going to see lots of AIs being produced.

David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

I don't think python AI's, excluding ones that make a unit do something very specific and simple like run around in a circle, will be written before someone rewrites the default AI in python. That would give something that could be used as a base for more specialized AI's. Writing a functional AI completely from scratch is a pretty daunting task, but if one could just tweak the default one, creating a custom AI would be a much, much more appealing idea.
scott
Posts: 5242
Joined: May 12th, 2004, 12:35 am
Location: Alexandria, VA

Post by scott »

How about an AI written in pseudocode? No reason the AI expert needs to be able to code (or even read code written) in C or Python.
Hope springs eternal.
Wesnoth acronym guide.
Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Post by Dave »

zookeeper wrote: don't think python AI's, excluding ones that make a unit do something very specific and simple like run around in a circle, will be written before someone rewrites the default AI in python.
Well, until someone writes a good, respected AI in Python. I don't think we'll make the default AI in Python because it'd probably slow the game down considerably.
scott wrote:How about an AI written in pseudocode? No reason the AI expert needs to be able to code (or even read code written) in C or Python.
You're not going to be able to write an AI without testing and refining it. Doing it totally based on theory is just not going to work at all.

Writing a good AI will require starting with something, testing, refining, adding. Pseudocode just won't do for that.

David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

Dave wrote:
zookeeper wrote: don't think python AI's, excluding ones that make a unit do something very specific and simple like run around in a circle, will be written before someone rewrites the default AI in python.
Well, until someone writes a good, respected AI in Python. I don't think we'll make the default AI in Python because it'd probably slow the game down considerably.
I wasn't really suggesting that the current AI be ported to python and the python version would be used by default - it'd probably (would it, really?) be much slower. Just writing the current AI in python, so that it would work pretty much the same and could be used as a basis for new AI's. Although if the current AI would be too slow in python, then is the point of python AI support mostly to enable making AI's that run around in circles, if the case is that real AI's (like the current one) would be too slow?
ILikeProgramming
Posts: 837
Joined: April 14th, 2005, 4:17 am

Post by ILikeProgramming »

Where can I get "wesnoth.py" that the Python ai's are referencing?
viorc
Posts: 130
Joined: February 22nd, 2006, 3:03 am

Where can I get "wesnoth.py" ?

Post by viorc »

If I get your question, I can say there is no wesnoth.py.
Thus it is impossible to call directly python AI from a python session. The only way to start it is by running wesnoth, the script will be automatically called by wesnoth at AI's turn. All the objects/definitions used by the AI are initialized in a C++ code and made available to python through python-C interface.
To use the python AI you have to:
1- configure wesnoth with: ./configure --enable-python
2- recompile wesnoth
3- create (or copy an existing) python AI script in a file my_python_ai.py
4- in the directory containing the AI python script, start wesnoth on the command line (for human vs 2 python AI):
<< wesnoth --multiplayer --scenario=multiplayer3pTripleBlitz --controller2=ai --algorithm2=python_ai --parm2=python_script:my_python_ai.py --controller3=ai --algorithm3=python_ai --parm3=python_script:my_python_ai.py >>
It should be quite easy for anyone who likes programming :wink:
See http://www.wesnoth.org/wiki/PythonTestScript for details.
User avatar
irrevenant
Moderator Emeritus
Posts: 3692
Joined: August 15th, 2005, 7:57 am
Location: I'm all around you.

Post by irrevenant »

Python AI support isn't compiled in by default? Why not?
ILikeProgramming
Posts: 837
Joined: April 14th, 2005, 4:17 am

Post by ILikeProgramming »

The reason I'd like to see it is so the interpreter alerts me when I make a mistake and so I know the return types for functions(which for some reason are not on the tutorial)
Post Reply