Currently Online

Latest Posts

Topic: Avg. FPS available from LUA?

GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2017-06-06, 14:19

Let me know if I can help face-smile.png


Busy indexing nil values

Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-06-06, 16:37

My idea is like this: defaultai.cc would be able to call something like what you showed me with campaign_select during late_initialization(), doing two things:

  • getting and opening one of files '.widelands/ai/parent[0-4]. txt (or other file suffix) and using them for creation of own "DNA"
  • part of creation is mutating of AI, so it would create also file like '.widelands/ai/player[0-16]_[timestamp].txt' containing current "DNA" in the very same format as "parent" files, so they could be renamed and used as parent file.

Also there would need to be a logic to delete old "player*" files, similarly like old savegames are deleted.

Does it look reasonable?


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2017-06-06, 18:38

Yes it does. Do we need a command line switch as well? I guess we won't want to mutate the AI in releases, because it would wreak havoc with the game state in multiplayer. Also, will we need to support saveloading?

This sounds like quite a lot of additional code, so I'm in favor of doing this in a followup branch. Doing a code review on the current branch will also give me some more understanding of what is needed (i.e. get familiar with the new code).


Busy indexing nil values

Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-06-06, 19:12

Would mutating be impossible in multiplayer?

Because the idea is that amount of mutation would depend on strength of AI. Normal AI will have only minimal mutation, and very weak one - big mutation rate. I have not tested this concept (Nordfriese perhaps:) ), but theoretically it would work that way.

Also note, that this mutation is not preserved for the next game, so starting DNA can be hardcoded in *.cc for now.

Also, already this branch means a lot of changes into code...


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

I expect that all players will need to use the same mutation, otherwise we might get desyncs. Another option would be that the host will transmit the mutations used to all clients when starting a game.

As long as we all start with the same mutation and the mutations are deterministic, we won't have a problem.

Edited: 2017-06-06, 20:22

Busy indexing nil values

Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-06-06, 20:44

GunChleoc wrote:

I expect that all players will need to use the same mutation, otherwise we might get desyncs. Another option would be that the host will transmit the mutations used to all clients when starting a game.

As long as we all start with the same mutation and the mutations are deterministic, we won't have a problem.

It is not good.

Are you 100% sure? I am not familiar with this stuff. But AI uses a lot of std::rand() in its code... I believed only playercommands are transferred via network...


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2017-06-07, 08:55

Actually, I'm not 100% sure, but we do need to look into this to make sure. Maybe I'm being paranoid *lol


Busy indexing nil values

Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-06-07, 09:17

I hope you are. Simple test could give us a hint.


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2017-06-08, 13:55

I ran 2 games AI branch vs. trunk and no desyncs, so we're on the safe side here. One less thing to worry about face-smile.png

I'd still like to get the current state of the new AI into trunk before we work on the save format though. Our testers have reported that is already performs better than the current AI in trunk, so there is no reason not to have it. It will also make the code review easier for me, and let players who don't compile themselves participate in some limited testing.


Busy indexing nil values

Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 23:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2017-06-08, 15:16

OK, I am still doing changes there, f.e. these days I tweak dismantling of mines. But I will stabilize it all and start polishing the code.

It will be bit complex to review, but we are not in hurry. And probably the review will be in few rounds anyway...

Do you say that trunk AI can fight this branch AI? And what was the results? Did you see a difference?


Top Quote