The New FMG Games Engine
Wow! 25 days since the last post - apologies for the delay in getting this next post up, time seems to fly when you’ve got your head down programming!
(For New Visitors, FastMovingGames is a new online service for board gamers that I’m developing - Read more about the vision here)
These last three weeks have been head down coding up the gaming engine that underpins the main functionality of the site.
Engine v1 Complete
If you’ve been following my other posts, you’ll know that I ran into some potential problems modeling the data structure that I’m using to represent the various data relationships that the game engine uses. Well, I thought I’d solved it and claimed I’d built the main engine process a few weeks ago. It was great to see the main idea in action, and really validated what I’ve been thinking about for these few years.
Realistic Scaling
But … it was not so great to see the game engine scale… After all my joy entering some real simple test data, I tried entering data that was a little more realistic to see what would happen. Well, it all worked and looked great with this data, but… it was incredibly slow - 15 seconds from submitting the page to bringing back the page results! This is running on a fairly meaty home computer with only one user and no load! No good. The main culprit here, as I hoped it wouldn’t be, was just the sheer complexity of the relationships within the database (maintaining the transitive closure of the graph relationships as I discussed here). This absolutely wouldn’t do; 2-3 seconds is acceptable for requesting the page, and rendering it into the browser, but not 15?!
Drawing Board v2
So over the next week I went back to the drawing board and redeveloped the way the data model worked. This meant changes in some of the fundamental rules about how the games engine works and how users interact with it, but unfortunately, these look like they’ll just have to be necessary to allow people to use the site and not bring the database to a grinding halt.
Actually I’m quite pleased I redeveloped the games engine in this way, after much hard work in creating the dependency graph, I’ve now removed it (since it was the main cause of timing problems) and thus removed a huge chunk of complexity from the backend system - a very good thing! From a data completeness point of view it would have been great to maintain all of the relationships within the games engine and database so I could really go back and see exactly what had happened at any point in time, but maintaining this is a massive overhead.
It’s funny how the rules that form part of the new engine had already been thought of a few months back, gotten pushed to the back of my head whilst I got caught up on other problems, then resurfaced. Good to get an external pair of eyes to remind you what’s important and hoist you out of the depths of complexity to return back to a user’s eye view.
New Games Engine
So, last week I’ve been redeveloping the games engine, and it works much quicker. There’s still quite a bit of work to do on it as the number of permutations of system state, user state, and game state make for some interesting output combinations.
I’ve already built a few of the viral elements into the engine (more on this later) and plugged together some notification emails and they’re all working fine. The core engine functionality had previously been written, which I can reuse, so just needs plugging back together into this new process.
Next on the list is to hookup the main engine, and write some background tasks that monitor the database and process a few things in the background to keep the database state updated.
Also, given how my real-work is panning out, and can you believe people actually wanting me to play board games on the weekends (Will’s mini Tichu league starts tomorrow, and we’re hosting the first game!), my time going into FMG is shrinking and I’m not managing to complete the work as quick as I’d hoped. Like other hobby-coders, there’s just not enough hours in the day…
Still, a big milestone coming up soon once the engine is finished, as I can start using it in earnest in a sort of test mode for our own board games whilst I develop the more personal and social features for the site.
Thanks for keeping up with me, and I appreciate your patience!
Cheers,
-Dan

Add Your Comment