|
Post by andretimpa on Jul 15, 2014 19:47:14 GMT
When there are too many things happening at the same time (lots of creatures and permanents) and playing against the AI the game starts lagging to the point that it sometimes misses button clicks. My guess is that the AI search tree is taking too many resources. How exactly did the search tree get implemented? (how deep? ignoring similar decisions? etc).
|
|
|
Post by serprex on Jul 15, 2014 21:51:18 GMT
AI looks 2 decisions deep. It makes no judgements into not looking at certain decisions, besides limiting itself to 999 eval calls per decision Search logic is @ github.com/serprex/openEtG/blob/master/ui.main.js#L550Which uses game evaluation from @ github.com/serprex/openEtG/blob/master/ai.eval.jsGoing to drop a note here because it can't be stressed enough: despite ai.eval.js being the most complicated code in the game (due to most design being qualitative in correctness), it's relatively isolated & is what I view as the best way to start programming openEtG. One could easily start a blank ai.eval.js & potentially make progress from where ai.eval.js currently is Fun fact: the most expensive part of the AI is cloning game states
|
|
chap
Junior Member
Posts: 54
|
Post by chap on Jul 16, 2014 11:10:44 GMT
I don't understand what "cloning the game states" is, but I was just going to post the same issue. Also, when having a lot of creatures (malignant cells in my case) I don't get quanta from my pillars at the end of my turns and sometimes I lose the games when I must win them. No errors in the console. Image of the life quanta I should have earned for 3-4 turns: i.imgur.com/tx8TOK5.png
|
|
|
Post by andretimpa on Jul 16, 2014 13:05:58 GMT
Cloning the game state I suppose means to create an object with data from where the game can be reconstructed (on the exact point where the AI started its analysis), so that it can try different things and check what results it gets. If that's the case I'd take a look to see if garbage collection (or whatever that Javascript uses) is not slow enough that we are getting a small memory leak. Is there a way to explicitly destroy the clone once it is no longer needed (I'm thinking as a C programmer here ). Since we are using only 2 levels maybe we could reuse always the same 2 objects, just overwritting the fields (if this is what is being done ignore this)
|
|
|
Post by serprex on Jul 16, 2014 13:37:35 GMT
chap that's the Bond nerf that'll likely be reverted Reusing gameBack may have merit (tho it shouldn't speed up cloneGame still)
|
|
chap
Junior Member
Posts: 54
|
Post by chap on Jul 16, 2014 13:39:48 GMT
Well it makes sense to throw through the window the scenarios you don't need anymore (because there is already a better action), but JavaScript doesn't have a 'delete object' command. Is there an easy way to do that, serprex?
|
|
|
Post by andretimpa on Jul 16, 2014 22:24:20 GMT
chap if you rewrite the fields in the object changing their values you don't need to destroy the object to create another of the same type. That was only a guess (I only skimmed through the code and I'm slow to read JS and I have 0 debugging information) but it fits with the pattern I saw of the game getting laggier as the match goes by and going back to normal after it is over, and this happening more when he AI has many options to look at. Might be worth a look.
|
|
|
Post by serprex on Jul 21, 2014 13:56:59 GMT
|
|
|
Post by andretimpa on Jul 21, 2014 16:38:15 GMT
I just hope we don't get hash collisions, but these would probably manifest as random AI derps (confusing one thing it has checked with another that it hasn't).
|
|
|
Post by serprex on Aug 1, 2014 12:28:03 GMT
|
|