Latest Posts

Topic: Artificial artificial intelligence. ;)

hulagutten

Topic Opener
Joined: 2009-07-19, 21:34
Posts: 56
Ranking
Likes to be here
Posted at: 2010-05-15, 01:11

I have figured out how to create construction sites. An early working example of AAI can now be found at https://eksempel.s3.amazonaws.com/ImpactEGG.wmf.zip. Just unzip into /.widelands/maps/. Then run the map as a scenario. If you want to play against the very early AAI, you have to modify the initial payer positions in the file named player_position.

Edited: 2010-05-15, 12:49

Top Quote
hulagutten

Topic Opener
Joined: 2009-07-19, 21:34
Posts: 56
Ranking
Likes to be here
Posted at: 2010-05-22, 11:26

A question: If I make a scenario that contains an AAI on Impact that is really challenging to beat, will it then be included into trunk? The AAI will not cheat in any way.


Top Quote
SirVer

Joined: 2009-02-19, 15:18
Posts: 1445
Ranking
One Elder of Players
Location: Germany - Munich
Posted at: 2010-05-25, 16:26

Sure, I think about an extra folder called AAI or codebook_samples with a kind of README file in it that says that this is trying out a new kind of AI opening play. I see no reason not to include this. I will also help out if I can, for example at one point in time the AI should maybe take over because the codebook play ended.

Nasenbaer, if you've reading along here: is it possible to change the AI at run time or only when the game starts up?


Top Quote
hulagutten

Topic Opener
Joined: 2009-07-19, 21:34
Posts: 56
Ranking
Likes to be here
Posted at: 2010-05-28, 00:30

This is excellent news. I will create the first AAI as soon as I can (I am though very busy at the moment). Once this proof-of-concept has been created I will be hoping for someone more competent to create the preprocessing module that will convert a replay into a lua script. So the AAI can learn from the best players.

I guess that the first AAI will just be very very agressive and attack all enemy miliary buildings all the time. If it would be possible to get the normal AI to take over, then more refined end-game strategies could be utilized.


Top Quote
Nasenbaer
Avatar
Joined: 2009-02-21, 18:17
Posts: 828
Ranking
One Elder of Players
Location: Germany
Posted at: 2010-05-28, 01:11

SirVer wrote: Sure, I think about an extra folder called AAI or codebook_samples with a kind of README file in it that says that this is trying out a new kind of AI opening play. I see no reason not to include this. I will also help out if I can, for example at one point in time the AI should maybe take over because the codebook play ended. Nasenbaer, if you've reading along here: is it possible to change the AI at run time or only when the game starts up?

Haven't read the full thread however: The AI can be initialized in every game state. However the only place this is done at the moment is in network games - if a player leaves the game, the defaultAI is initialized and takes over the player. So what would be needed, is a lua interface to set and start a computer player - but well I have no clue on that part ;).


Top Quote
SirVer

Joined: 2009-02-19, 15:18
Posts: 1445
Ranking
One Elder of Players
Location: Germany - Munich
Posted at: 2010-05-28, 11:12

Something that I would need is something like:

 delete do_nothing_computer_player();
 new ComputerPlayer(player_number).take_over()

or

m_computer_player->set_style("Super ultra aggressive")

If I understand the C interface, I will add the Lua Interface.


Top Quote
ixprefect

Joined: 2009-02-27, 14:28
Posts: 367
Ranking
Tribe Member
Posted at: 2010-05-28, 12:51

It's the GameController that is responsible for setting up the AI. So I'm not sure from which domain you would call such a Lua interface anyway? Maybe it's a valid violation of the usual boundaries if you're playing a scenario.


Top Quote
Nasenbaer
Avatar
Joined: 2009-02-21, 18:17
Posts: 828
Ranking
One Elder of Players
Location: Germany
Posted at: 2010-05-28, 12:52

SirVer wrote: Something that I would need is something like: delete do_nothing_computer_player(); new ComputerPlayer(player_number).take_over()

or m_computer_player->set_style("Super ultra aggressive")

If I understand the C interface, I will add the Lua Interface.

Well I have absolutely no clue where exactly the late initialzation takes place in the game logic. All I did until now, is to work on the defaultAI itself ;). But if I find some time in the next weeks, I will try to find it :).


Top Quote
SirVer

Joined: 2009-02-19, 15:18
Posts: 1445
Ranking
One Elder of Players
Location: Germany - Munich
Posted at: 2010-05-28, 14:43

i had something like this in Mind:

   wl.game.Player(2).ai = "normal"  -- or "agressive" or "none" or something like that

Something like this seems crucial in scenarios: we want to computer player to play passive until some event occurs, then he should attack like mad.


Top Quote
ixprefect

Joined: 2009-02-27, 14:28
Posts: 367
Ranking
Tribe Member
Posted at: 2010-05-28, 15:35

I see. Well, Lua doesn't exactly mirror what's in the code, I just want to make sure that it's understood that controlling the AI from the domain of the C++ class 'Game' is conceptually wrong. See my recent commit fixing a replay bug to see why: the Game code itself must never send player commands, because of simulation consistency. Since the whole point of the AI is to generate player commands, it must not live "under" Game.

If you want to arrange things differently in Lua I suppose that's okay, except that if people who are used to the Lua way of doing things want to learn about the C++ part, it might be rather confusing.


Top Quote