Server Side Overworld
I have already invested in my scripting language of choice, obfuscating key codes paths. For details, see my earlier post:
That got me feeling like less of an amateur putting my code in the wild. The next step was running node.js server-side, to verify client submitted games. Setting up node.js was straightforward, scripts can be easily added to the node.js daemon “pm2”. They can be run on the command line to capture STDERR directly.
Next I wrote some node.js to replace an earlier PHP script, which took client-submitted games and inserted them in the database. “newscore.php” became “newscore.js”. I did this without any idea how long full support of the engine would take (two months), but doing so got me familiar with node.js, and got some important libraries installed. To streamline operations I disabled cross site scripting detection.
I started encoding all game inputs (that successfully impact game state), and passing them on new score submission, along with a pro mode flag (pro mode starts at level 2). I had the server code try to emulate the client-submitted game and validate checksums.
I then noticed huge discrepancies between client and server output, along the lines of pseudorandom number generation. To make the game fully deterministic, I:
- Made a prng server, taking seeds and giving out number sets.
- Standardized consumption and use of in-engine prng.
- Cleaned out external prng consumption by the graphics engine.
I also had to eliminate other sources of low-level indeterminism:
- Open-ended data sorting
- Iterations like for .. in
- High precision operations
My biggest impediment was not being used to debugging on node.js. I basically did all by hand in the console, working with seeds and execution paths that were problematic. I procrastinated on setting up my pipeline, so was manually juggling files for a few nights.
One problem I now experience is that the deploy pipeline is so memory-intensive that the mysql daemon shuts down, poor Battle Mines. I think I’ll have to refurbish the devbox at some point, maybe separate out concerns. 😉
In other news, check out OGBM! The old-schooliest of the Battle Mines games, now hosted by an old afficionado! http://ogbm.pw
Tue, 9:46 AM Here’s what kept me up last night: How can the centaur wear boots? I might need a “horseshoes” alternate graphic.. boots are the only accessory kind of […]
I haf captured mine vassals idles 🙁 BTW, events were down on BM for a week. Sorry. 🙁
I just put in torches, they make caves super fun windows are going next, I did the falling out of building stuff I said works nicely I’m wondering if I’ll […]
so I spent a couple hours learning a valuable lesson it’s completely not worth my time to try to casually add something like: half transparency over characters, when in water […]
Centaur Beefy 4 hearts, but can only rest on grass and hills. Natural mount, meaning scrolls stay dry in water. Thief Can steal anything from any store, including beds and […]
Possible tourist? sweet dude ha ha sure! Neat! Nice to have an animated fatso agreed! Gonna be so fun watching him trudging along without a care in the world he’s […]
skunk is in.. can’t wait to see some of these new critters in action hehe.. can I tell you my guilty pleasure I hate the gnome. I like to play […]
ha ha! his run is distinctive! How do you know it’s going to turn out so well? ha ha, he’s goin’ for it, that little dude he’s going to save […]