I’m making an MMO which will have a 2d world. (This is a learning project so don’t try to talk me out of it 🙂 I’d like to experiment with a new data store for it, and I’ve read good things about redis. I’ve been through the tutorials, and I think I’m beginning to understand redis’ strength, but it’s not clear how I might model such a world.
Here are some design requirements
- I need to be able to send down the current position of elements in the world. It would be acceptable to divide these into geographic “rooms” for performance.
- I need to be able to “move” an object in the world, changing its position
- I need to get information about an object: what’s its name, type, attributes, etc.
- I need to be able to calculate basic collisions (obj a wants to move right, is there a rock there?)
How would you model this in redis? Is redis an inappropriate choice?
Assuming the 2D world is split into squares of known coordinates, you would probably do best in redis to produce keys based on the coordinates which return Sets of ID’s of objects (or exits/paths, or terrain, etc.)
e.g. a very simple illustration
I’m not enough of a redis expert to know if this domain is going to cause you problems in redis, so take my advice with a grain of salt.