This version stores the terrain data in JSON blobs in Voldemort, and with each motion the @ gets inserted and removed in the main terrain database.
To run this version, you need gson, all java libraries that come with voldemort 0.81 (in lib/ and dist/), and jruby. Go here and run the single node cluster.
That, of course, means that voldemort is finally integrated. Boy, it’s been grueling- I’d originally intended to post the next version last sunday. First of all, it turns out that python isn’t really a good language for this.
- Did not run out of the box due to missing _has_error with the latest pbuffer version.
- Showed corruption using latest pbuffer when doing lots of gets and storing pickled python objects
- Did not have UpdateAction from java
- My OS X python was old, and did not have JSON libraries
So I switched to jruby. Problem is, rails is such a big thing in the ruby world that it colors all other ruby activities, for example web serving. It’s assumed that you want a jruby web server for rails and rails alone. Of course, I can’t use rails for this, because rails demands a database model, and I am using voldemort.
What I finally picked, was jetty. It only added some 20-30 lines to my project, a bit more than cPythons cherrypy, but that is outweighed here by much less voldemort infrastructure.
I wavered back and forth on this, but eventually I decided that my storage strategy is going to be the following: If there’s empty space somewhere, that means that the tile is filled. Rock is emptiness. That means that the edges of your map are always shown as infinite rock. Each tile has a key and a value, and the value is a list of things in that place. A place you can go is not empty.
Because of this storage philosophy, I need to get a value for each tile visible per display. So far, getAll seems slow already for 400-800 gets. I’m not sure how much of that is from jruby and how much is from voldemort, but I may need to either use java_inline (as seen here) or, if it’s voldemort that’s the problem, try to lump the terrain up, in 4x4s or 16x16s. Something like that. Of course, I will not be doing that optimization until I have the NPCs ready, since it’s just fast enough for one player. (On a i5/X25-M)
Missing features that a real MMO has:
- NPCs and Monsters
- Rules and Combat, watch for my post on this.
- An Avatar agent that continues running after disconnection. This is probably next, since I’ll have to launch a specific server thread for everything else on this list.
- Large terrain (I’ll have to do something semi-procedural eventually)
- Graphics (I will begin with the David Gervais tiles)