Jump to content

AI Aegis SVN New errors!


gameboy
 Share

Recommended Posts

I've committed a fix for the specific error above, but there could be others remaining. I'm at home till monday, won't have much time but some quick fixes could be done.

Please play the game, try to save/load regularly (particularly interested in games when Aegis prepares an attack, or when it has started an attack: the army should stall and do nothing, but should be reused for the next plan.) If you encounter errors, I'm interested in the saved game.

Link to comment
Share on other sites

Please play the game, try to save/load regularly (particularly interested in games when Aegis prepares an attack, or when it has started an attack: the army should stall and do nothing, but should be reused for the next plan.)

This is indeed what happens in my tests.

In one game, it failed to load the saved game:


ERROR: JavaScript error: simulation/ai/qbot-wc/qbot.js line 327 TypeError: myKeyEntities.toEntityArray()[0] is undefined ([object Object],[object Object])@simulation/ai/qbot-wc/qbot.js:327
ERROR: AI script Deserialize call failed
WARNING: JavaScript warning: simulation/ai/qbot-wc/qbot.js line 287 reference to undefined property this.pathInfo
ERROR: JavaScript error: simulation/ai/qbot-wc/qbot.js line 287 TypeError: this.pathInfo is undefined ()@simulation/ai/qbot-wc/qbot.js:287 ([object Object],[object Array])@simulation/ai/qbot-wc/qbot.js:90 ([object Object])@simulation/ai/qbot-wc/qbot.js:156 ([object Object],[object Object])@simulation/ai/common-api-v3/base.js:66 @:0
...

quicksave-0002.zip

In another test, quickload worked, but with the following warnings repeated:


WARNING: JavaScript warning: simulation/ai/qbot-wc/attack_plan.js line 708 reference to undefined property this.path[0][0][1]
WARNING: JavaScript warning: simulation/ai/common-api-v3/utils.js line 11 reference to undefined property b[1]
...

quicksave-0002.zip

Link to comment
Share on other sites

Thanks for the report. I can't seem to load the saved games, is there something special about quicksaves?

I can't think of any reason for your first error, frankly, it seems like it should only happen if the AI no longer has entities. Your second one is annoying too as it probably should not happen either...

Given what time I have, I'm not going to be able to go through and properly fix those, so I suggest switching back qBot in the meantime (and/or add to Aegis' description that it doesn't really support saved games.)

Link to comment
Share on other sites

Also, I have been looking into full AI state serialization after fixing #407, it seems feasible but possibly inefficient and it may require some redesign of the AIs, since they have unfortunately been written with the assumption that full serialization is impossible or ignored that it might be possible in the future. (I've mostly worked on qBot in my testing because it's simpler, but it should be possible to port most changes to Aegis as well). I would like to at least make this possible for A14 and then we can decide what is the best course for the AIs (personally I think automatic full serialization is much preferable to the current piecemeal, hacky, broken approach).

Link to comment
Share on other sites

I guess currently the serialization is 'opt-in'. To improve efficiency compared to full serialization, perhaps it could be made 'opt-out'? Like, a given variable will be saved by default, unless a certain callback returns false.

Link to comment
Share on other sites

Right, but that variable would have to be initialized with something on or prior to deserialization, otherwise the AI would try to access it and spew thousands of undefined property warnings :) I tried to mix these approaches, but I think that references to those excluded objects might still be part of the AI state and so they would get serialized (which is why I say the AIs have been designed without considering these issues and it might not be trivial now to solve them).

Link to comment
Share on other sites

I think opt-in is likely better for AIs. But yes, the current system was quickly done and is fairly ugly.

It is indeed not too trivial to fix those issues. It basically requires Ais to save things sanely, but to recreate them sanely... Basically instead of the "do everything in the constructor" approach, we would require a "Init" function that is only called once at game start, and which deserialization simply overrides with the deserialized contend.

Link to comment
Share on other sites

Good news on AI serialization. When I was testing before, I forgot that I had debug annotations turned on in the serializer, which made it generate much more data, more slowly. It needs a lot of real-world testing but so far I haven't gotten any errors and qBot seems to continue seamlessly after loading. The other good side of proper serialization is that rejoining multiplayer games with AIs will work without OOS errors. The bad side is that every 20 turns in multiplayer games, it does a full state serialization for OOS checking and there will be a noticeable stutter if the process takes too long.

For saved games, I think the data size and time required are very reasonable, it's only for others things (serialization test, OOS checking) that it may pose a problem. Maybe we can leave out parts of the state in those special cases. For instance, it's not clear to me that the AI state needs to be part of the OOS check, as they run asynchronously (eventually in a separate thread) and can only interact with the simulation through network commands - so any OOS errors will be detected there. Or we could have 3 types of simulation state checks: minimal (currently checks only entity positions), standard (all but AIs) and full (all state including AIs), and do the full check even less frequently.

I will continue tweaking things and post a WIP patch on Trac. The new code I've added may need optimizing in places, but I think most of the slowness is due to the greatly increased amount of data processed (7 qBots on a giant map will produce 30+ MB state, Aegis could be even more).

Link to comment
Share on other sites

So Philip and I discussed this more today and came to agreement that:

1.) the time and space required are reasonable for saved games,

2.) it's nowhere near fast enough for full OOS checking, but also

3.) full OOS checking is really only desirable and practical during development and once AIs are multithreaded, that will add additional latency which is unacceptable, so

4.) it's probably best to not serialize the AI state for OOS checking.

In other words the special case should be full OOS checking which can exclude any components we want, while allowing us to benefit from automatic AI serialization in all other cases. AI devs will be especially pleased with this, as they will have only a handful of general rules to remember and won't typically need to write custom (de)serialization code (hopefully never).

I have yet to attempt to convert Aegis or the other AIs to test them. Mostly it's a tedious process of going through and testing for any (de)serialization errors or class like objects that weren't registered, and fixing those problems.

Also a heads-up: with Yves work on upgrading Spidermonkey, the AI framework may need some substantial changes related to sharing data between script contexts. Not sure on the details but apparently new Spidermonkey is stricter about that.

Link to comment
Share on other sites

Error again:


<p class="error">ERROR: JavaScript error: simulation/ai/common-api-v3/gamestate.js line 584
TypeError: template is null
()@simulation/ai/common-api-v3/gamestate.js:584
([object Object],[object Object])@simulation/ai/qbot-wc/economy.js:180
([object Object],[object Object],[object Array])@simulation/ai/qbot-wc/economy.js:1199
([object Object])@simulation/ai/qbot-wc/qbot.js:228
([object Object],[object Object])@simulation/ai/common-api-v3/base.js:66
@:0</p>
<p class="error">ERROR: JavaScript error: simulation/ai/common-api-v3/gamestate.js line 584
TypeError: template is null
()@simulation/ai/common-api-v3/gamestate.js:584
([object Object],[object Object])@simulation/ai/qbot-wc/economy.js:180
([object Object],[object Object],[object Array])@simulation/ai/qbot-wc/economy.js:1199
([object Object])@simulation/ai/qbot-wc/qbot.js:228
([object Object],[object Object])@simulation/ai/common-api-v3/base.js:66
@:0</p>
<p class="error">ERROR: JavaScript error: simulation/ai/common-api-v3/gamestate.js line 584
TypeError: template is null
()@simulation/ai/common-api-v3/gamestate.js:584
([object Object],[object Object])@simulation/ai/qbot-wc/economy.js:180
([object Object],[object Object],[object Array])@simulation/ai/qbot-wc/economy.js:1199
([object Object])@simulation/ai/qbot-wc/qbot.js:228
([object Object],[object Object])@simulation/ai/common-api-v3/base.js:66
@:0</p>
<p class="error">ERROR: JavaScript error: simulation/ai/common-api-v3/gamestate.js line 584
TypeError: template is null
()@simulation/ai/common-api-v3/gamestate.js:584
([object Object],[object Object])@simulation/ai/qbot-wc/economy.js:180
([object Object],[object Object],[object Array])@simulation/ai/qbot-wc/economy.js:1199
([object Object])@simulation/ai/qbot-wc/qbot.js:228
([object Object],[object Object])@simulation/ai/common-api-v3/base.js:66
@:0</p>
<p class="error">ERROR: JavaScript error: simulation/ai/common-api-v3/gamestate.js line 584
TypeError: template is null
()@simulation/ai/common-api-v3/gamestate.js:584
([object Object],[object Object])@simulation/ai/qbot-wc/economy.js:180
([object Object],[object Object],[object Array])@simulation/ai/qbot-wc/economy.js:1199
([object Object])@simulation/ai/qbot-wc/qbot.js:228
([object Object],[object Object])@simulation/ai/common-api-v3/base.js:66
@:0</p>
<p class="error">ERROR: JavaScript error: simulation/ai/common-api-v3/gamestate.js line 584
TypeError: template is null
()@simulation/ai/common-api-v3/gamestate.js:584
([object Object],[object Object])@simulation/ai/qbot-wc/economy.js:180
([object Object],[object Object],[object Array])@simulation/ai/qbot-wc/economy.js:1199
([object Object])@simulation/ai/qbot-wc/qbot.js:228
([object Object],[object Object])@simulation/ai/common-api-v3/base.js:66
@:0</p>

Link to comment
Share on other sites

<p class="error">ERROR: JavaScript error: simulation/ai/qbot-wc/qbot.js line 327

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

([object Object],[object Object])@simulation/ai/qbot-wc/qbot.js:327</p>

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

<p class="warning">WARNING: JavaScript warning: simulation/ai/qbot-wc/qbot.js line 287

reference to undefined property this.pathInfo</p>

<p class="error">ERROR: JavaScript error: simulation/ai/qbot-wc/qbot.js line 287

TypeError: this.pathInfo is undefined

()@simulation/ai/qbot-wc/qbot.js:287

([object Object],[object Array])@simulation/ai/qbot-wc/qbot.js:90

([object Object])@simulation/ai/qbot-wc/qbot.js:156

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

@:0</p>

<p class="warning">WARNING: JavaScript warning: simulation/ai/qbot-wc/qbot.js line 287

reference to undefined property this.pathInfo</p>

<p class="error">ERROR: JavaScript error: simulation/ai/qbot-wc/qbot.js line 287

TypeError: this.pathInfo is undefined

()@simulation/ai/qbot-wc/qbot.js:287

([object Object],[object Array])@simulation/ai/qbot-wc/qbot.js:90

([object Object])@simulation/ai/qbot-wc/qbot.js:156

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

@:0</p>

<p class="warning">WARNING: JavaScript warning: simulation/ai/qbot-wc/qbot.js line 287

reference to undefined property this.pathInfo</p>

<p class="error">ERROR: JavaScript error: simulation/ai/qbot-wc/qbot.js line 287

TypeError: this.pathInfo is undefined

()@simulation/ai/qbot-wc/qbot.js:287

([object Object],[object Array])@simulation/ai/qbot-wc/qbot.js:90

([object Object])@simulation/ai/qbot-wc/qbot.js:156

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

@:0</p>

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...