Latest Posts

Topic: News about AI

toptopple
Avatar
Joined: 2013-10-30, 07:11
Posts: 156
Ranking
At home in WL-forums
Posted at: 2016-10-20, 19:11

Tibor, before you go into details, I would like to give you my comment.

I believe some of you conceptions are unnecessarily complicated and one actually doesn't need to worry about number of players on a map or in a game. Also, iterated compilation can be avoided and finally I believe the entire testing process over several generation could be automatised either completely or to a large extent.

1. Generation Setup

As the evolution process doesn't affect the structure of the code but only the values of parameters, it doesn't appear to be required to recompile for each generation. If you make the AI-code refer to a parameter block that can be imported from the generation process, you can avoid manual intervention and recompilation. Along this line you might also be able to further automatise the AI evolution process. If you develop some interface to start the life-testing games programmatically, then perhaps completely!

2. Life-testing

Two points here a) the conception of passing only the fitest to next generation is - as far as I understood - not the optimal procedure of genetic algorithms, because in short it's not the way nature proceeds either. ;) The correct way to do it, or let's say the better way, is to apply a probability function into all generation members depending on their fitness value. Thus there is a chance for "minor genes" to stay in the process and play a role in later generations. b) In my understanding it is not required to perform a game-match amoung generation members in order to reach at fitness values of the participants. And only we are interested in the fitness value, actually winner or loser isn't a fully adequate concept here. Also it may be a fair setting for all generation members if you confront all of them to the same problem. In consequence you could build a simple test setting like "play member x against a neutral but proven AI algorithm (not the same that member x performs) called the TEST-BASE AI or however. You can let each member play in the same scenario and calculate its Fitness after a time as you decide. This also gives you the option to not play a testgame to final decision but only for a stretch. After a while you may wish to replace TEST-BASE with an improved version, depending on success of the evolution. Thus you have no need for a complicated arena setting and can scale up your generation members to any amount. What do you say to this?

Cheers!


Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2016-10-20, 19:35

DragonAtma wrote:

GunChleoc wrote:

I have created a branch that allows 16 players, with repeating player colors:

https://code.launchpad.net/~widelands-dev/widelands/max_players

The engine can handle up to 31 players, but there isn't enough UI space to set them all up as AIs. If you only start from command line, you could add more though.

Mmmm... now I'm tempted to try a 1-on-15. face-wink.png

If you will have a map for 16 players, please share it. The lack of good map(s) is a serious show stopper here.


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 14:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2016-10-20, 19:41

Regarding 1., you could try using Profile to read and write parameters. Check out map_io and game_io on how this is done.

I am currently tweaking the max_players branch to generate the images from the actual player colors, so we won't need to make new images when we want to increase the numbers of players.


Busy indexing nil values

Top Quote
DragonAtma
Avatar
Joined: 2014-09-14, 00:54
Posts: 351
Ranking
Tribe Member
Posted at: 2016-10-20, 19:54

Tibor wrote:

DragonAtma wrote:

GunChleoc wrote:

I have created a branch that allows 16 players, with repeating player colors:

https://code.launchpad.net/~widelands-dev/widelands/max_players

The engine can handle up to 31 players, but there isn't enough UI space to set them all up as AIs. If you only start from command line, you could add more though.

Mmmm... now I'm tempted to try a 1-on-15. face-wink.png

If you will have a map for 16 players, please share it. The lack of good map(s) is a serious show stopper here.

Well, I don't have one yet, but you can always ask the map generator.

And with a 16-player Widelands I could always create a 16-person map.

Edited: 2016-10-20, 19:54

Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2016-10-20, 20:02

Hi toptopple,

You have good ideas, but I can say I already pondered a lot of this. So:

1. Recompilation. Of course, this is not needed, but it is the easiest approach for me. I was considering some external text file with all numbers, but the question is:
a) temporary solution or
b) permanent?

If permanent I/we have to consider some architerctural aspects, we already have some structure of directories, some logic for reading/writing to our files - and I am not familiar with this.
Of course, quick&dirthy solution is possible.

For permanent solution - would it be "learning" design or "readonly"? If learning it can be in mulitiple ways... and coding is needed, probably a lot of coding. Is it worth it? If "training" will be done only on one place such complex work is not that effective.

2) Probability vs the best one - good point, I read about this approach, it is reasonable. However, we cannot say that the best AI will reliably get better score. First - no starting positions are equal and 'enemies matters' - you can get weaker or stronger opponents and this can make huge difference.

In fact you proposed the TEST-BASE AI. This is what I had, I called it STATIC AI. The problem is that this reduces the virtual population. In 7 games with 4 players you have 28 AIs tested. But with static AI it means only 7 AIs to be tested. Good approach but it extends the time of one generation significantly (4x if we want to keep the size of population). And the testing (computer) time is bootleneck here. Otherwise it is good idea.

So generally very good ideas but resources (my coding ability, my time, computer time) are scarce.

I have a lot of things scripted, including picking the best AI, modifying source file and recompilation. In fact If I have 24/7 computer, I would be able to set up perpetual training of AI with periodic generations (picking the best and recompilation)


Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 19:48
Posts: 2439
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2016-10-20, 22:50

I am not familiar with this kind of programming, but i think it would be nice to have some of this related to other win conditions as autocrat. is this possible?


Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote
DragonAtma
Avatar
Joined: 2014-09-14, 00:54
Posts: 351
Ranking
Tribe Member
Posted at: 2016-10-21, 02:46

Come to think of it, I have some maps for testing (IIRC you saw one while squishing the "AI builds vinyards everywhere!" bug). They're not designed for beauty, but they are designed to be pretty equal. I have:

* Two 8-player maps
* A 4-player map
* A 4-player map that SHOULD produce a stalemate.
* A 1-on-1 map
* A map with four simultaneous 1-on-1s.

https://www.mediafire.com/?vhtoclga7e21dzw


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 14:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2016-10-21, 10:06

The max players branch is finished now. All one needs to do is to edit graphics/playercolor.h to increase the max amount of players and add player colors.

We still have a UI issue with starting games, but since those screens need redesigning anyway, I'm not going to touch them right now.


Busy indexing nil values

Top Quote
king_of_nowhere
Avatar
Joined: 2014-09-15, 17:35
Posts: 1668
Ranking
One Elder of Players
Posted at: 2016-10-21, 17:34

one thing to take into account is that different maps call for different strategies, so the parameter optimization should be done on different maps. maybe an average of what worked best in different maps could be taken.


Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2016-10-21, 18:59

DragonAtma wrote:

Come to think of it, I have some maps for testing (IIRC you saw one while squishing the "AI builds vinyards everywhere!" bug). They're not designed for beauty, but they are designed to be pretty equal. I have:

  • Two 8-player maps
  • A 4-player map
  • A 4-player map that SHOULD produce a stalemate.
  • A 1-on-1 map
  • A map with four simultaneous 1-on-1s.

https://www.mediafire.com/?vhtoclga7e21dzw

I downloaded the package and I am using Arena II map now, this looks very useful, and such map for 16 players would be even better... face-smile.png


Top Quote