Let me tell you a bit about how, up till recently, the database scheme for a Tinker Tanks game worked. When you created a game, a number of new tables were created on the fly, specific for that game. And whenever I needed to access the db for a game – which is verrrry often as you can imagine – I first did some string concatenation to get the correct table name, and then worked on that one. The reasoning behind this – rather insane – scheme was that it would speed up games, as it only needs to retrieve data from very small tables. The drawback is that my PHPMyAdmin looked like an insane mess
And of course it involves giving every user full rights on the database which is kinda… Well, wrong.
So I reworked things a bit to do stuff like everybody else did, identifying a game simply by an id field. Still, it leaves me wondering though, which approach would be the more scalable? My unconventional one (lack of experience is always a good trigger for out-of-the-box thinking) or the usual one? How large is the cost of creating db tables at runtime? I’ll benchmark it and let you know as soon as I have a million users
I also had a modest eureka moment yesterday, on how to transfer a shitload of tasks to the client side, which means the transfer to no-reload-round-advance is coming within grasp more and more. I am a bit ashamed to admit that 90% of the breaktrough insight was ‘fully grasping Prototype’s each() construct’. I guess there’s nothing wrong with learning.
[screenshot comes here but WordPress doesn't seem to like Ubuntu/Opera]
I experimented a bit with an ‘invite user to game’ scheme, where in the portal you would drag usernames of online players onto free game slots to invite them. But that didn’t really go anywhere so I’ll have to rethink that a bit further.
The ‘making it social’ I mentioned earlier is coming along nicely also, with both maps and players having their own ‘profile’ pages with a description and user comments. This gives another great boost to the communicating aspect of the site, which is a great asset I think.
Also, lots of other minor bugfixes. Like, start budget and ore income for the map creator now work. I first tried to do this by quickly injecting some hidden input fields in the save form before it was submitted (with innerHTML+=…). But this had the strange side effect of resetting the text fields already present to their default values. I’d love to share how I eventually fixed it but I am on a different computer now and I forgot
[screenshot comes here but WordPress doesn't seem to like Ubuntu/Opera]
Coming up next, hopefully: the finishing touch for profiles: pictures! Users should be able to upload a picture of themselves (currently every user has a remarkable resemblance with Winston Churchill), and map preview pictures should be generated on the fly with GD. I already use GD to automate lots of the artwork-creation of the game: see how every tile has a number of versions with different player colors and health bars. So I guess taking it a bit further to generate map previews shouldn’t pose to much of a challenge.
I also submitted my game to the gaming reddit which, greatly, triggered many people to stop by and take a look, which drove me insane because I wanted to play them all at once, loosing a crapload of games because I was so slow in each of them.