Replaying last turn not working
Ah, thank you for the detailed response. I've clearly not been trying it with enough game samples to come across the problems you mention. And obviously you're right we can only speculate where the problem happens.
Although if it were tainted at injection time, wouldn't there be a case that if a user closed the browser just after a tainted injection, when they came back to the game, and the map/units state was rebuilt from the data held in the database (to create the html for the page), that new state would also be corrupt. If that's never a problem, then it suggests that at the very least the data held in the database for the most recent position is always correct, or they somehow always correct for tainted injections at that point?
Anyway, I guess an alternative could be, as your wwpa tool polls the weewar API (yes?) to find out when it's a players turn, is to grab the html of the game from the weewar server at that point (or at regular intervals) and extract the position of the units and bases from the page source. And then use that as a checksum against the replay XML, incase anything get messed up along the way. Although that's fairly convoluted in itself and scaling is an issue. Ho hum.
I do think the "long running"ness is an issue in replaying on the weewar website. The WWPA replay functions just fine because, from a quick glance, it's using some event/animation based code, with callback functions being set, so when an animation is complete the next function is called. Somewhere in the animation code (because you can set the speed) "setTimeout"s will be being used, so the code won't be one continuous block/loop of running script. And so it runs just fine.
On the weewar website itself there are no-such timeouts, it is just one giant loop. When I run it through a profiler/firebug that's where it hangs. Besides, in the case of my current game, 77027, the replay on the site doesn't work (it hangs the browser in the loop), but in my own replayer does work, both using the same XML. And I'm not making any corrections of corrupt data because I wasn't aware of any. Assuming then that the data is good, it must be hanging for some other reason ... in this particular instant.
Guess I'll need to poke around with it a bit and to get some corrupt data I just need to play some more games, which I'm sure we can all agree doesn't sound like a bad thing to have to do![]()
Posted 22 May 08 in Weewar
Total Messages: 3
Topics Created: 0