A tested implementation follows. Omitted are the unit tests and exception classes.
Scalability not guaranteed.
(more…)
A tested implementation follows. Omitted are the unit tests and exception classes.
Scalability not guaranteed.
(more…)
I’ve done some investigation this week and found the smart way (and not so smart way) to write binary structures in Python. Somehow, I’ve glossed over the Python struct library for years–that’s the smart way. The not so smart way is what I did before by writing utilities to pack and unpack Python objects into binary structures and hope that the byte ordering was right.
Of course, once you’ve written your data into a structure, and you’ve figured out how to unpack it, what do you do with it? If you’re writing static handlers for each type of structure, you’re all set: just unpack the structure into a tuple and put the values in the fields in very clear, concise, and obvious code.
My implementation begs to be considered non-obvious. Below is a taste of the code in progress (mostly missing extended exception handling).
(more…)
Given that a client should accurately (as much as possible) represent world state, the client should be written to process events in a consistent, single-handler way. Player input into the client should be turned into game events and passed into the client’s event queue rather than through a separate, privileged channel.
Ideally, player generated events would be sent to the server for verification. Failure to acknowledge and provide permission for actions leads to cheats common in World of Warcraft: teleporting, wall hacks, etc. The client is given broad latitude to perform collision checks and report its location (reducing rubberbanding) at the cost of making it easier to violate movement and location rules. But, as Lum and many others have stated, a balance needs to be struck between client and server load. The server can’t be expected to validate every location and perform collision detection for thousands of objects, but it should be there to provide permission for or acknowledgement of a movement request.
Should collision detection be done by consensus? Network latency would indicate this isn’t an appropriate way to handle this in an MMO. Collision detection is going to have to, unfortunately, remain on the client. However, the server should be able to tell when a client reports its location out of bounds, of the difference in distance or rate of change is outside threshold (without an appropriate cause, such as a teleport).
(more…)
I’ve been preoccupied with a few things lately, so I haven’t had much creativity left to spare on the blog, game design, or development. Someday, though, I’ll come back with a vengeance.
(more…)
I have a little programming project I’m trying to do in C++ instead of C, Java, or Python (so you know I’ll code it slowly). Yesterday morning, I picked up my PowerBook, opened up Eclipse, and started coding from my “specs,” such as they are, to get one of the basic classes completed and tested. Oddly enough, Eclipse didn’t bother compiling anything, and obvious compile errors didn’t get flagged and the build failed. Something must be up with the environment, so I indulged a whim and moved to XCode.
To practice my nascent XCode development skills, I created the project from scratch, reentered the class I was writing, and got about 50% of the way through typing when I got the beach ball of death. I decided that with under 30 minutes of battery left and my wife wanting to talk to me, this would be a good time to plug the laptop back in and let it work out its own issues.
This morning, it still had issues.
I’ve been defeated. (See? Now that was easy!) I’m moving back to C++ development on the PC. My copy of Visual Studio 2005 should be arriving sometime within the next eight weeks and I’ll see if I can recompile there. In the meantime, I’ll use Eclipse on the PC and actually get the thing done.
Event handlers register to receive particular messages. The Java AWT 1.1 event model, for instance, is based on the Observer pattern, with a small wrinkle.
![]()
The small wrinkle is the use of an event class which describes the event in detail (when, where, who, how, and sometimes why) and distinguished the Observer pattern from the Listener pattern. This is a reasonable model for many games to adopt, not just for handling UI events, but also those generated within the game engine or server, and those that arrive over the network.
(more…)
I’ve been thinking about the best way to embed Python as a scripting language. The first approach that comes to my mind is A (image, below), where Python code blocks are invoked from an engine, run some logic, call some native methods, and perform processing. The second approach, B, is where Python is the engine and invokes native compiled functions in order to perform time or computationally critical operations.
What are some of the advantages or drawbacks to one model or the other? Is Python “good enough” for some operations, like network I/O in a multiplayer game, or should something like that (invoked frequently) instead be done in native code? Should message conversion (from network to in-memory type) be done in native code or in scripting?
Some of these answers may best be found through profiling. That’s the best way to identify critical code, as it distinguishes between what you believe is critical code and what is actually called often and takes up considerable processing time.
My mother always called it “moving clothes from the washer to the dryer.”
I call it “swapping.”
In other news:
Or, as Tuebit says, “Mmo’tivation”, is key to getting and keeping your tiny MMO project running. But it’s so hard to sit down and develop your system when all the yummy games are out there, calling for you to come play with them . . .
The comment I left on the WorldIV blog follows. I tried to address (briefly, believe it or not) what I believe is important to keep in mind when developing your MMO game, tech demo, or project.
(more…)
I’ve been dissatisfied with my consulting assignment since January. Before that I had no real problems, but after the version 2.0 production deployment, David Dale’s departure for another project, and all the clean-up work I had to do by myself in his wake, I began to feel burned out. That in itself is ironic: after working an entire year with only two and a half days of vacation plus federal holidays, I was ready to go another year deferring my vacation because I like to work. But spending three weeks feverishly writing database migration scripts to fix the botched conversion to the new schema, creating emergency bugfixes for production problems, and having to defer problems that I simply didn’t have time to resolve left me too exhausted to do anything at home or write much on my blog, and now makes me feel like I really do need that vacation.
(more…)