I’ve been thinking some more about doing a 2D battlemap style MUD and have been looking around at possible tools that I could use. Although I used Flex/Flash for FMud I’d rather go with HTML5 for the client on this project, mainly because it’ll be fun to learn something new.
There are lots of 2D HTML5 libraries/game engines to choose from and so far I’ve had a little play with Crafty and Jaws. I liked the component system in Crafty but Jaws seems leaner and more straightforward. I also like the look of Impact (mainly due to the shiny website, I think) although it’s not free and I couldn’t see a demo or trial version. The price of $99 seems reasonable but I’m not really familiar enough with these types of tools to risk buying blind.
I plan to use the 2D engine on the client to handle sprites and the background maps for the main display window but I’ll also need a GUI with forms, panels, custom tooltips, icons, etc. Drag and drop for inventory and the like would be nice too. I could use jQuery UI but I’m not sure how easy it would be to integrate with canvas elements, although it’s possible the UI could be handled completely separately.
In my original post I mentioned using Nakedmud on the server but this feels like trying to fit a square peg into a round hole. I’m sure it wouldn’t be too hard to hack in support for Websockets but I’d probably be better off using something designed for the job.
There are a few Node based tools that have caught my eye so far. The first is Maple.js which is a barebones client-server setup that implements a simple binary encoded message protocol and tick synced game loop.
Another tool which seems to be popular right now is SocketStream. This is a general application framework aimed specifically at “single page realtime applications” which (hopefully!) makes it ideal for games.
From having a quick read it looks like the way to go would be to use a custom request responder to communicate movement and game object updates between server and clients. There’s also a built in pub/sub mechanism with channels which could be used to simulate areas of interest. It could also be integrated with Redis for persistence.
Another option might be to model all the data using a framework like Backbone and try to sync server and clients automagically. There’s an interesting post here talking about a realtime app with client-server data syncing but I’m not sure how feasible it would be for a multiplayer game using an authoritative server. Derby looks like a nice framework for syncing data between server and clients but unfortunately there’s no way to secure access to your models so any client could potentially edit all the game data.
It seems a little overwhelming with so many frameworks and libraries to choose from but it’s always fun to play with new toys. I’ll get around to posting some more detail with examples as I experiment some more.