Jump to content

Further AI development


Recommended Posts

You do not encounter this error, he has tested again, and he confirmed the existence of this error.

@wraitii:I want to know what time you will finish it this month? Or Earlier in September? thank you!

The next Alpha release is not too far away, but the issue of being able to save games with an AI will take some more time. It's one of the more difficult issues to solve actually, so it's impossible to say how long time it will take. Probably more like December or early 2014 than soon. The AI should work fine in Alpha 14 if you just want to play a game though, it's just saving the game that will take longer to figure out.
Link to comment
Share on other sites

The next Alpha release is not too far away, but the issue of being able to save games with an AI will take some more time. It's one of the more difficult issues to solve actually, so it's impossible to say how long time it will take. Probably more like December or early 2014 than soon. The AI should work fine in Alpha 14 if you just want to play a game though, it's just saving the game that will take longer to figure out.

I don't understand what you guys mean by saving games with an AI? You should not have to do anything different from saving a player's game. The AI should just look at the circumstances again when the game loads and make decisions.

What kind of stuff are you saving?

Link to comment
Share on other sites

It's actually not that easy to just save the AI state. If you restart from scratch, it's going to make terrible decisions... You need to save what it wanted to do with its villagers, things like that. Sure you could try to guess it backwards on loading, but some stuffs won't work (defense, attack…), and the way the AI is coded currently makes this extremely unpractical too (sadly).

Fixing the Ai for saving games is actually not extremely hard, but doing it right is hard. And tied with how javascript fundamentally works, which might change as we are considering upgrading.

  • Like 1
Link to comment
Share on other sites

I still don't follow what you are saving? You mean like what villagers were assigned to what resource nodes and which were building stuff?

The general plan needs to be saved (as it's following a schema: enlarging economy, building defense and then attack - or something similar). If it forgets where it was in the schema, and it starts all over.

But anyway, wraitii, it should go through those first phases quite fast right. So maybe it's good to let the AI start over as it were a new game, for the time being.

  • Like 1
Link to comment
Share on other sites

I still don't follow what you are saving? You mean like what villagers were assigned to what resource nodes and which were building stuff?

Keep in mind that in multiplayer games, the simulation state on every client has to be identical (for out of sync testing, we simply hash the binary state and compare them). But AIs don't only react to the current simulation state, they also store data from previous turns. This means if you don't serialize the AI state properly (I would say fully) then deserialize it, like if someone rejoins in multiplayer or you load a saved game in single player, the AI will have different internal state, which very likely means it will send different commands. That will cause the simulation state to differ and an OOS error in multiplayer. In single player games, the problem is more subtle, the AI will simply behave differently after loading a saved game. Or you may get errors when certain code paths are hit requiring data that wasn't de/serialized.

I actually don't see it as that difficult of a problem. It would require substantial modification of the AIs and their API to fix correctly (Aegis, like qBot and JuBot before, is based on Testbot, which was only a prototype AI that didn't correctly implement serialization and had flaws in the design that make it more difficult now). But those modifications are fairly straightforward for someone familiar with the AI.

  • Like 1
Link to comment
Share on other sites

Keep in mind that in multiplayer games, the simulation state on every client has to be identical (for out of sync testing, we simply hash the binary state and compare them). But AIs don't only react to the current simulation state, they also store data from previous turns. This means if you don't serialize the AI state properly (I would say fully) then deserialize it, like if someone rejoins in multiplayer or you load a saved game in single player, the AI will have different internal state, which very likely means it will send different commands. That will cause the simulation state to differ and an OOS error in multiplayer. In single player games, the problem is more subtle, the AI will simply behave differently after loading a saved game. Or you may get errors when certain code paths are hit requiring data that wasn't de/serialized.

I actually don't see it as that difficult of a problem. It would require substantial modification of the AIs and their API to fix correctly (Aegis, like qBot and JuBot before, is based on Testbot, which was only a prototype AI that didn't correctly implement serialization and had flaws in the design that make it more difficult now). But those modifications are fairly straightforward for someone familiar with the AI.

Oh okay. I see how your networking implementation might make things difficult.

Link to comment
Share on other sites

I'm not deep into this topic, but I wonder whether it would be easier to save correctly without the plan-queue-system kind of thing. Is this a typical system/design/architecture that is used for Game AI? And/or would it even be replaceable? Not that I think this would be recommendable (gigantic amount of work) , of course! It's more like a question of academic interest.

Edited by Almin
Link to comment
Share on other sites

Almin: I have no idea if it's a classic system. I even have no idea if it's the best, but it works nicely enough. And it wouldn't change a thing for serialization, no.

historic_bruno: BTW I've answered you here and haven't heard back from you, and there are fairly important issues at stake there.

Link to comment
Share on other sites

They are trying gameboy if it was easy it would have been fixed long ago if you have been reading along with the rest of us you would have noticed that there seems to be some issues with the programming language implementation(JavaScript Spider Monkey) which means that until that project fixes things we can not,which is why they are working with them as well.I know that it is frustrating but it will be fixed as it is a major issue so all us non-programmers can do is cheer on any improvement ;)

Enjoy the Choice :)

  • Like 1
Link to comment
Share on other sites

New version of the upcoming version, no real changelog this time either, still more rewriting and still more work about naval stuffs (this time it's fairly close to completion but weird issues make me unable to complete). I've fixed a few bugs in the attack plans that should make the AI slightly better at attacking though.

Just replace the binaries/data/mods/public/simulation/ai/ folder with the one linked.

(for sanderd: not a patch because imo this is easier for a folder)

ai.zip

  • Like 1
Link to comment
Share on other sites

:lol2::kid: Nice work!

BTW:About whether to save loading error correction? Serialization problem?

@wraitii: Just now, I tested you provide AI, new error appears:

<h2>0 A.D. Main log (warnings and errors only)</h2>

<p class="warning">WARNING: JavaScript warning: simulation/ai/common-api-v3/terrain-analysis-pathfinder.js line 18

reference to undefined property gameState.ai.terrainAnalyzer.map</p>

<p class="error">ERROR: JavaScript error: simulation/ai/common-api-v3/terrain-analysis.js line 120

TypeError: this.map is undefined

([object Array],true,500,false)@simulation/ai/common-api-v3/terrain-analysis.js:120

([object Array],[object Array],2,2)@simulation/ai/common-api-v3/terrain-analysis-pathfinder.js:90

([object Object],[object Object])@simulation/ai/aegis/aegis.js:262</p>

<p class="error">ERROR: AI script Deserialize call failed</p>

<p class="warning">WARNING: JavaScript warning: simulation/ai/common-api-v3/terrain-analysis-pathfinder.js line 18

reference to undefined property gameState.ai.terrainAnalyzer.map</p>

<p class="error">ERROR: JavaScript error: simulation/ai/aegis/aegis.js line 258

TypeError: myKeyEntities.toEntityArray()[0] is undefined

([object Object],[object Object])@simulation/ai/aegis/aegis.js:258</p>

<p class="error">ERROR: AI script Deserialize call failed</p>

<p class="warning">WARNING: JavaScript warning: simulation/ai/aegis/aegis.js line 100

reference to undefined property this.gameState</p>

<p class="error">ERROR: JavaScript error: simulation/ai/aegis/aegis.js line 100

TypeError: this.gameState is undefined

([object Object])@simulation/ai/aegis/aegis.js:100

([object Object],[object Object])@simulation/ai/common-api-v3/base.js:68

@:0</p>

<p class="warning">WARNING: JavaScript warning: simulation/ai/aegis/aegis.js line 100

reference to undefined property this.gameState</p>

<p class="error">ERROR: JavaScript error: simulation/ai/aegis/aegis.js line 100

TypeError: this.gameState is undefined

([object Object])@simulation/ai/aegis/aegis.js:100

([object Object],[object Object])@simulation/ai/common-api-v3/base.js:68

@:0</p>

Edited by gameboy
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...