Slashdot Mirror


Designing Multiplayer Game Engines?

mikera asks: "I'm a pretty experienced programmer but I've just embarked on my first (massively?) multiplayer strategy game. To make things even more interesting, I've decided to write it in C# and pick up a new language at the same time. I've chosen a client-server architecture where the server holds the one 'true' state of the world. The only communication from clients would be commands to units, which is simple enough, but the server will have to propagate game state changes (events) to all clients. I would like to ask Slashdot readers if they have solved a problem like this before or can offer some opinions on the best way to implement a solution."

"Lag is not really critical, but I still want things to be responsive and it must scale up well with the number of clients. The size of the map data, the complexity of the objects and bandwidth constraints rule out sending the complete game state, so only incremental updates will work. The situation is further complicated by the need to limit updates to just the areas of the map that are visible to a given player/team - this is clearly necessary to prevent client-side hacks such as gaining full map knowledge.

I understand the theory well enough, but I'm interested in practical advice on how to implement a solid architecture. What should the object model look like? How do I propagate events that are only partly within a client's field of view? Are there any novel features in C# that might make my life easier? How can I make the networking code as transparent as possible so I don't have to write SendUpdate() after every assignment?"

Your comments, insights, hints and flames are eagerly awaited."

28 of 397 comments (clear)

  1. Not doing two things at once by peripatetic_bum · · Score: 5, Insightful

    Having been on the dev-team of a popular MMPOG, I have to say that while your ideas are fundamentally correct, but now is not the time to learn c#, just to add another language to your CV. In addition, C# is too OS limited as it stands and you need to be thinking outside the box.

    Thanks

    --

    Sigs are dangerous coy things

    1. Re:Not doing two things at once by FFFish · · Score: 5, Informative

      Especially considering that, say, Python already has MP libraries. A research paper from UO, another fellow who's trod this path before, several MUD/MOO/MP libraries and games, Merchant Empire, Twisted, Eve, and so on.

      Using Python would allow this fellow to achieve his goal of learning a new language, fast. He can then properly focus on the important things: program structure and gameplay.

      --

      --
      Don't like it? Respond with words, not karma.
    2. Re:Not doing two things at once by JasonAsbahr · · Score: 5, Interesting

      Hey, thanks for the plug. Here's an open letter to developers about my new project, Netsu. It uses Python, the Nebula Device, *and* Twisted...

      Greetings,

      I'm a professional game developer who has committed a large portion of his adult life working on virtual worlds of one sort of another. Recently, I worked on Ultima Online 2, which some of you may have been looking forward to playing. I know I was! :-)

      I'd like to talk to you a bit about my current project, 'Netsu', which is the culmination of many years of background work. "Netsu", Japanese for "heat" and "fever", is an anime-inspired world which incorporates multiple perspectives of play and a reputation network for players to self-organize. It's going to be fun.

      Currently, I'm working on combining a number of existing open source technologies to build the new virtual world system. These include the 'Nebula Device' 3D engine from Radon Labs on the client side, the Twisted framework for server-side and client-server communication, and (as the project moves forward) the OpenCyc knowledge base as server-side archetype repository and artificial intelligence server.

      As I develop use cases and other design documentation for Netsu, I intend to keep them as portable as possible between gaming systems, so that they can benefit the most people. I anticipate this work feeding back into Twisted, expanding it to be a more general simulation framework, and into Nebula, adding network support and in-game world editing tools.

      So where did this project come from?

      The genesis of the project began with my work on virtual reality systems in the early 90's. I developed virtual building walkthroughs for architects, VR games, and created the first hardware accelerated PC-based virtual actor system for Compaq.

      This work was all done with C and C++, and it was during this period that I ran up against the need for a dynamic and interactive way to "reach inside" the simulation and manipulate the code and data directly. And that's how I first became acquainted with the language Python.

      The next major phase was to build a 3D client engine with Python embedded as a control language. The fruits of that effort are described in the paper I presented at Python 7, "Beyond: A Portable Virtual World Simulation Framework". (This was also the first mention of 'Netsu'.)

      In 1998, the path of development took a turn when I was recruited into Origin Systems to work on developing the Python foundation for the Ultima Online 2 project. The focus during the period was on innovation on the server side and on client-server communication. The results of that labor are described in another paper presented at Python 9, "Python for Massively Multiplayer Virtual Worlds".

      Both papers are here.

      However, to this point, all the software developed for these projects was closed source. The desire for an open source virtual world system was lurking in my head, but it wasn't until the O'Reilly Open Source conference in 2000 that my plan for the open source virtual world crystallized.

      At the 2001 O'Reilly conference, while presenting on the UO2 design work, I took the opportunity to discuss my plans for the future open source virtual world system. The response was extremely positive.

      So what are next steps to realizing this goal?

      Glyph (the originator of the Twisted project and a fellow ex-Origin colleague) and I have been meeting periodically over the last few months to discuss these issues, which intersect nicely with his long term plans for gaming in Twisted. I've also been meeting with the Cycorp folks (who happen to office just down the road from me) to discuss integrating Cyc and driving Python class generation from Cyc.

      I recently integrated Python into the Nebula Device, which allowed me to easily integrate the PB remote object communication protocol and made Nebula the first 3D clients for Twisted. Over the next six months, several major components will come online, including character creation, character motion, the GUI system, basic terrain management, character inventory, and combat.

      As I wrap up my current consulting project (porting Python to the Playstation 2 and developing a GUI for designers to build Python logic), I'm devoting 100% of my time to Netsu and open source development.

      It is my hope that this collaborative approach for virtual world development grows, spreading outward and providing a foundation to help other developers build their own virtual worlds and enable the sharing of code and art resources between worlds..

      If you are interesting in finding out more about the project, drop me a line via email and tell me a bit about your interests and background.

      Cheers,

      Jason Asbahr
      jason@asbahr.com

  2. WorldForge by Shiny+Metal+S. · · Score: 4, Redundant

    Take a look at The WorldForge Project. You probably won't learn more anywhere else.

    --

    ~shiny
    WILL HACK FOR $$$

    1. Re:WorldForge by nehril · · Score: 5, Insightful

      there is an old (1999 ish) article at www.gamasutra.com/features/19990903/lincroft_01.ht m (free reg required) that talks about all the net play problems that the Xwing vs Tie Fighter team faced.

      I remember reading it a while ago before you had to register, it had alot of insights as to saving game states, lag, updates, and "late joiners" to a game.

    2. Re:WorldForge by Shiny+Metal+S. · · Score: 5, Informative
      Mod me however you feel like. The truth is that I usually read at +1 so I don't see AC posts until they're modded up. But that's not important.

      The important thing is that I really like the The WorldForge Project (in fact, it's one of my favourite projects (if not the favourite project), promoting the idea of free software to broader audience.

      They're doing amazing work and I simply can't imagine what will they achieve in few years, but I'm sure all of current proprietary games won't even compare with those developed as a part of The WorldForge Project

      So yes, I think promoring WorldForge is worth losing all of my karma.

      Now back on topic...

      You may want to announce your plans on the cpptraining at worldforge.org mailing list. It's originally meant to learn C++, not C#, but it's read by people who want to learn how to write MMORPGs, and those who want to and really can learn, like Bryce Harrington, so it's a good place to find people who can help with your project.

      Also check out the other WorldForge mailing lists, especially Protocols, Server, Client and General.

      Read the Development Area on WWW. Read about servers and clients. Use WorldForge protocols and libraries. Download games and read the source. You'll find there everything you need.

      --

      ~shiny
      WILL HACK FOR $$$

    3. Re:WorldForge by Znork · · Score: 4, Insightful

      Um, if you're working on a commercial project, be careful if you look at worldforge beyond architecture documentation, without at least talking to your legal department (or lawyer) first. WF is GPL and you are no more safe against copyright infringement suits if you copy GPL code than you would be if you got your hands on the code to EverQuest, Anarchy Online, or any other MMORPG.

      Looking at code is tricky buisness. You can do it in some ways, and you're probably safe as long as you're not creating a direct competitor with a commercial product, or a work-alike of something. If you do a clean-room implementation of something there cannot be even a chance that you've seen the competitors code. If you're doing your own thing, and just glance at the code to get a basic feel for how they've done things, then write your own, different code, you can probably consider it fair use. Maybe. But it's tricky territory.

  3. Follow the Rules of New Software Projects: by EraseEraseMe · · Score: 4, Insightful

    First: Ignore the nay-sayers who say "Don't do it in C#"
    An argument over the language it's programmed in will only make you lose time on what is truly important, the project itself.

    Second: Ignore the nay-sayers who say it's too big of a project.
    By the time they give you a full, thought-out reason why you can't do it, you'll be half-done.

    Third: Do listen to people who have done it before.
    Browse programming newsgroups, MMORPG newsgroups, hopefully one of the coders will connect and you'll be able to pick their brains.

    Fourth: Don't get dragged into the open source/closed source fiasco.
    You should be programming for just yourself, unless you have a team, then it's a free-for-all

    Fifth: Cut yourself off from all human contact and work on it.
    Stop showering, stop feeding the cat, forget the wife/kids/work. Finish it as soon as possible because I want to see what you're working on :)

    --
    "Anybody who tells me I can't use a program because it's not open source, go suck on rms. I'm not interested." (LT 2004)
    1. Re:Follow the Rules of New Software Projects: by rjkimble · · Score: 4, Insightful

      If you program in C# you're limiting yourself to an untested, almost unportable language and to the Microsoft platform. I would think that if you were serious enough to waste all of Slashdot's time with this question, you would be serious enough to choose a real programming language, not some Microsoft marketing scheme.

      I don't think this is particularly true. For one thing, Ximian/Mono are developing their own C# compiler. They're also developing their own runtime.

      Another point is that Microsoft's operating systems own 90%+ (probably more than 95%) of the home computer game market, so it hardly seems to be a limiting choice, even if the Mono project fails. And no matter how much you dislike Microsoft, I think you have to admit that their notion of a "common language runtime," which makes it rather trivial to integrate components from all the supported programming languages, is a brilliant concept. It may take Microsoft to a whole new level of domination, but that hardly makes the idea some sort of evil.

      For the record, before you label me as some sort of Microsoft shill, I'd like to point out that I'm composing this response using Galeon running under Mandrake 8.1, and my company bases all its software development and web hosting on Linux, Apache, Tomcat, and Java. I'm one who believes that the main reason that Microsoft is where they are today is because they actually respond to their customers and most of their competitors behave like morons. Ever try to use Solaris without installing all the GNU versions of the standard utilities? The Sun versions are generally inferior and an outright PITA to use. Microsoft doesn't force that on Sun -- hell, they could just use the GNU versions.

      --

      Guns don't kill people -- people kill people.
      But the guns seem to help a bit. (apologies to Eddie Izzard)
    2. Re:Follow the Rules of New Software Projects: by Ian+Bicking · · Score: 4, Insightful
      I mostly agree, except this one:
      Second: Ignore the nay-sayers who say it's too big of a project.
      By the time they give you a full, thought-out reason why you can't do it, you'll be half-done.
      The nay-sayers are probably right here, and if you research to people who've done it before (rule 3), you'll notice the vast majority of such projects fail.

      You must break a project like this into smaller pieces. You must have a forseeable point when you can release something. You can't forsee the end of a project as big as this, so you have to design intermediate points into it where you have something that is at least interesting to other developers, but much preferably is of some interest to gamers (even if only forgiving gamers).

      Open Source ideals aside, it's very hard to maintain dedicated to something that only you have ever seen. Also, incremental development is just more likely to be successful.

  4. Mud-DEV mailing List by Oriumpor · · Score: 4, Informative

    the mudd developer mailing list is an excellent source of information on exactly this sort of topic... although not specifically regarding the STRATEGY portion of online gaming... most of the issues you have spoken of have already been resolved... take a look at the archives publicly available at https://www.kanga.nu/lists/listinfo/mud-dev

  5. FreeCiv by RedWizzard · · Score: 5, Insightful

    Sounds like the architecture you're planning is quite close to FreeCiv's. You might want to take a look at that.

  6. Re:.NET will soon be the dominant GUI for Linux by peripatetic_bum · · Score: 4, Interesting

    This is true, but from an anlysis our group did,
    we did find one interesting factor that could actually make make the windows-based platform not viable anymore.

    The fact is that up to now, hardware, the OS software and, for the most part, games have been a pay-once/play forever deal.

    With XP, this model is trying to be changed, so not only do you have to keep paying to use XP, but you can think of it as an additional cost to playing your games.

    If you dont beleive, think about the Xbox. Now where does MS suggest that you will need to pay to continue to use the Xbox(for now), and that is their games development platform, thus they wisely avoided trying to charge gamers for the OS they are playing on, thus I do think that Linux does have a chance of being a gameing platform, but this is not an advantage that linux only shares, because right now, we dont pay for OS's for any gaming platform ( I mean, PS2, gamexube, etc...) we just pay for the games,

    So what I am trying to say is the C# really isnt a good choce because the OS it is to written, now comes with more Costs than any other OS.

    Thanks!

    --

    Sigs are dangerous coy things

  7. Re:one-to-many by oregon · · Score: 4, Interesting

    Because the more information there is at the client then the easier it is to cheat.

    For example
    1) If the maps are client side, I can look at them and see things my opponent and the server don't think i can see.
    2) If the rules are client side, I can subvert them. "Hello server, I'm now moving at 100mph and I have 3,000,000 ammo."

    --

    ---
    Oregon
  8. Security Reasons by hattig · · Score: 4, Interesting
    Having the client be more than a dumb interface to the world will introduce areas where the client can be modified for cheating purposes. Security in this sense is so very important. You don't want your world to have a player who locally edits the map to have a bridge over the "chasm of death" so he can reach the "amulet of light" without fighting the "hordes of minos" do you?

    In Java, I have played Dusk (dusk.wesowin.org) which is a basic graphical MUD style environment but seems to be okay and contain a reasonable amount of the basics. And Java is like C# in many areas except supporting reflection and other good ideas, unlike C#. I should mention WorldForge as well.

  9. Some Advice by Shelrem · · Score: 5, Interesting

    I'll avoid most of my comments about your choice of language because most of it is of a political nature, rather than practical one; however, I really wouldn't suggest trying to make a massively multiplayer game with a language you're unfamiliar with. It's quite an undertaking even with a language you know. I know; i'm working on one.

    As for the networking code transparency, this one seems fairly obvious to me.. Just keep a datastructure containing all the changed or "tainted" objects as you go. Make mutator functions of your classes set objects as tainted. Then, just do the networking updates once or twice every time through the main loop (assuming it's in the same thread. Otherwise, you can implement something that might end up being a little more efficient).

    As for updating only what the player needs to be updated on, this seems like a question of algorithm efficiency. I don't know the specifics of your game, but with most massively multiplater games, transmitting the entire world state, or even the entire list of changes to every client, every cycle would be insane. So, you have to only update the section of the world that the player can see. How to do this well depends on the internal structure of the world, and what sort of stuff the player can "see". If the game is room-based, then this is easy. If the player can always just see a specific size circle or rectangle around him, this is also easy (each event can check distance to all players in its regeon). If it works like most RTS with arbitrary viewing areas, then you might have to be a little more clever. Whether this is even much of a concern is really a question of the number of people supported, and the expected hardware this'll be running on.

    Hope that helps,
    ben.c

  10. Try AOP (Aspect Oriented Programming) by hieronymous72 · · Score: 5, Interesting

    AOP might be a great way to handle the problem of dealing with the update issue. You can program as though they are on the same box and code your aspects to deal with what to send and when. It's not an easy thing to learn (think when you went from procedural to OOP) but it can pay huge dividends.

    I use AspectJ (www.aspectj.org) but that's for Java...I don't know of any AOP toolkits available for C# since it's such a new language.

    Good luck.

    --
    "All I ask is for a chance to prove that money can't make me happy."
  11. Thoughts by Joe+Rumsey · · Score: 5, Interesting

    If you've never written a client-server game at all, you might check out Netrek for some basic ideas. It isn't massive, but it is client-server, and it's where I learned most of the important things I know about network programming in general (and I do, in fact, get paid to write network code for games now.) Quake or Quake 2 source are probably also good things to look at, though I haven't seen their code personally.

    None of those solve the major problems you're really asking about though: how to decide who gets to know about what. Worldforge is the only open source project I can think of to point you to in that area. Perhaps some MUDs might be useful as well, but they tend to be based on rooms, not areas, which doesn't translate well at all to most other games.

    Probably the biggest problem is avoiding N^2 operations as much as possible. At some level, there's no way around it: N players in an area generate events that have to be propagated back out to N (or at least N-1) players. This obiously makes scaling to arbitrarily large populations difficult. On the other hand, if you can guarantee a set maximum number of players in an area/server/whatever, you can target that maximum and not worry about it a whole lot.

    A slashdot post isn't really the right medium to answer this question. There aren't any quick and easy answers, you need to figure out what makes sense for your game on your own. I've spent a large portion of the last year thinking about these problems myself, and I wish you the best of luck on it. I'm having a blast myself, but it's also the most challenging work I've ever done.

    I am interested in hearing your reasons for using C#. That's actually somewhat shocking, but maybe it's just ignorance on my part. I can't imagine why you'd want to bet the farm on such an immature system, regardless of the strengths you've perceived in it. What does it do for you that C++ doesn't, and is it really worth it?

  12. wow, don't even know where to start by jon_c · · Score: 5, Insightful

    First off let me say that you are way in over your head, don't go into this thinking you will actually make a everquest. Everquest took 4 years to develop with a full staff of experienced programmers and artists, DAoC only took 2 years, but they had a very complete engine to work with. However i do not want to discurege you, attempting this, while foolish is a noble task where you will certainly learn a great deal. that being said:


    The only communication from clients would be commands to units, which is simple enough


    Generally the way this is handled is setting up a TCP communication for critical information, such as the stats of the player, text communication etc.. then send small UDP (connectionless) messages for non-critical data, such as player and monster movments. Be warry of using TCP for everything, this is something Anarchy Online did, which caused some pretty massive problems on the server side.


    The situation is further complicated by the need to limit updates to just the areas of the map that are visible to a given player/team - this is clearly necessary to prevent client-side hacks such as gaining full map knowledge.


    There are two approches for this, one is a moving 'buble' of information, where you update the client with all data within a certain radius, another is the zone approach (i.e. everquest) where you send the an entire zone worth of information. Note that you are not sending everything, only monster,player movment and state (are they fighting).

    What should the object model look like?

    I have no idea, i imagine it would be far too large and complex to even describe in a slashdot post. However i recommend you look at it from a top down view, then try implementing from the bottom up. For example, you know that you have a 'world' and the 'world has players, monsters and items', 'players and monsters' could be concedered 'actors' with certain command antributes. 'actors interact with items' etc.. you should start seeing how to construct a object model. also don't worry about what this looks like at first and you will no doubt be revising it as you go a long, make things the work and compile so you have some possitive feedback for you hard work. When things seem out of hand, step back, make some coffee and draw out what you have and try to thing of a way to break it apart into managable sections.

    ok that is all, good luck.

    -Jon

    --
    this is my sig.
  13. Don't forget Client-side Prediction by Rayonic · · Score: 5, Interesting

    It sounds like you're taking a lot of the stuff off the client's hands to add security. While this is a good idea, I can't stress enough the importance of the client predicting the positions of players and objects. Objects especially are easy to predict (an arrow arcing through the air, something rolling, etc.) Movement prediction can make or break a game; you'd be surprised how little tolerance players have for people/things jumping around with no movement in between.

    Heck, players can be pretty predictable objects themselves, if you want to get fancy. Most games have pretty simple algorithms predicting the future state of a player character (if player X is moving in a straight line, he'll probably continue to do so.) But I think you can get fancier than that. What about curves? (circle strafing) Or if the player is repeatedly hitting a button every half-second. (chopping wood?)

    It'd take a lot of coding, but the master server could conceivably take note of each player's input characteristics and compile some sort of "personality" profile for each one, which it could transmit to clients every time they start up, to help with their local prediction.

    Please note that I have no idea how much CPU time this would take up,

  14. Two strikes ... by Ldir · · Score: 5, Interesting
    If this is a commercial project, please tell us the name of the game so we can avoid it.

    In all seriousness, in my opinion (unless you're doing this solely as a personal learning experience), you are starting with two critical strikes:

    1. You're trying to do a major project in a language you don't know (and an immature one at that).

    2. You're trying to do a major project in a genre with which you have no experience.

    Either one could cripple the project. Put them both together and you're doomed before you start. You may eventually make it work - sort of - but it will never work well, and it will be riddled with bugs.

    I encourage you to start by developing a small multi-player game in a language in which you are already proficient. This will let you focus on the design and structure without fighting the language. Keep it simple, manage the scale, but incorporate the kinds of capabilities you want in the final version.

    When you've got that working, throw it awy and develop it again in C#. Since you're starting with a working design , you're now free to focus on the mechanics of the language. You need time to learn its limitations and idiosyncracies, and to become proficient. (I will let others debate the wisdom of C# - I'm skeptical of all proprietary languages, especially until they're field-proven.)

    Once you have succesfully finished a small project in C#, you can begin planning your real game. Based on your experiences, you may decide to scrap C# entirely. If you choose to stick with C#, then throw away ALL of your original code and start over. No matter how good you think your first code was, by the time you finish the big project you will know that it's crap. Might as well get it out of the way up front to reduce re-work and improve the overall quality.

    Of course, if this is a project you've been assigned as a commercial effort, you won't be given the luxury of doing it well. You probably already have a deadline pulled out of thin air, and you're probably already behind schedule. Speaking as a pointy-haired boss who actually has significant coding experience (a long time ago, in a galaxy ... etc.), most PHB's have no clue when it comes to software development. They work with the suits to draw up pretty little Gantt charts, and haven't the foggiest notion as to why they are complete fantasies. You can see some of the results in the bargain bin of your local Best Buy, or in the "still delayed" list of your favorite gaming magazine.

    In any case, good luck.

  15. An idea I'm kicking around... by 2nd+Post! · · Score: 4, Interesting

    Assuming you have a secure communication channel (whether it be trust, PKI, or other encryption), you can try to reduce lag by distributing resource request and allocation.

    Rather than the server handling 100 clients, when it needs to push out identical data to all 100, you push out data to 10 of those clients and rely on those 10 clients to push out data to another 9 clients.

    You can also push in the other direction. When client 1/100 says 'Hi!', rather than pushing it to the server to push it to 100 clients, the client pushes it to the client he's attached to, who pushes it out to the other 8 people, as well as to the server. The server then pushes the 'Hi' out to the other 9 clients it's connected to, who pushes out to their respective 9 clients.

    It's akin to treating the connection to the server as some sort of nested tree; you introduce latency but reduce the amount of server lag.

  16. beware floating point! by rufusdufus · · Score: 5, Informative

    I made a 3d game engine and in my cleverness, I figured I'd reduce load on the server by offloading the physics asynchronously onto the clients. I learned the hard way that THIS WONT WORK. The reason is that different floating point processors get slightly different answers in some instances. Indeed, if all processors are the same stepping of the same intel processor, you'll be fine, however for example an Athlon might in some rare circumstance be different by the very last decimal point from an Intel. The butterfly effect will eventually catch up to you and the Athlon machine will for example detect a collision where the intels didn't.
    Using emulation or fixed point is either too slow or too inaccurate, so I ended up just doing all the work on the server and doing continual sychronization.

    To be more precise, in order to smooth out 'lag' time, the clients would do their own emulation, but would resychronize all decisions on the 'heartbeat'. Using interpolation, this worked out to have great apparent lag response, even lag times of 3 seconds were smoothed out. The only problem then was when a client's lag was unstable, fluctuating a lot. I smoothed this out by emulating a 1 second lag in all circumstance, so everyone has a smoothed out lag response which isn't too bad to play. Only unstable lag of 2 seconds or more caused a problem, where that client would see his character jump around everytime synchronization kicked in.

  17. Here's the basics by Adam+Wiggins · · Score: 4, Informative
    • The game makes a connection to one (or more) other games via UDP. UDP is ideal because it doesn't guarentee that the packets will arrive in order, or even that they will arrive at all - but it does guarentee that any packet that arrives will be intact and unaltered.
    • The games need to time sync to each other, by sending "here's what time it is" messages to each other and then recording how long the trip took - much like ping.
    • Update packets are sent whenever an object changes. You can do this one of two ways. One is to explictly setting a "changed" flag on the object, and then at the end of the update loop check to see if that flag is set, and if so transmit an update packet. The second is to have a "compare" and a "copy" function for all game objects; you can create a copy of the object at the beginning of the pulse, and then compare it to the current one at the end of the pulse. If they are different, transmit the update packet.
    • Update packets must not rely on each other. They must contain all pertinent information about the object. Typically that will include its current position, its current velocity (vector of motion), animation state, hitpoints, and so forth.
    • The timestamp on received update packets should be compared to the most recently received packet for the object that it applies to. If it is older, discard it. (Remember, UDP can deliver out of order.)
    • The game uses data about the objects' motion and state to continue to animate the object moving even inbetween packets -sometimes called "dead reckoning." When an update packet is received that shows the object in a slightly different position, the object should interopolate (sometimes known as "lerping" in the industry) to its new position so that it does not appear to pop.


    The only remaining issue is what we call "who is right?" If one game claims that a ship blew up because it was hit by shot, and another game claims that the ship dodged at the last minute, who is right? If the game is client-server, the answer is easy: the server is always right. In fact, clients shouldn't even display "big" events like a ship blowing up until it has confirmation from the server that that is what really happened. (Sometimes it's a good idea to use "hint" animations - if the client expects that a ship has been hit and is going to explode, but hasn't received confirmation from the server yet, you might want to show a shower of sparks. Then, if the confirmation is received a moment later, the explosition doesn't seem to be delayed quite so much.)

    In peer-to-peer, things get much tougher. In some cases one of the peers simply declares itself a server, in which case you have the situation above. In true peer-to-peer, it's simply up to the game designers. The most obvious choice is to make each machine responisble for its own position as well as the position of the objects its has created. So the player controlling a given ship has the last say on where that ship was at any given moment.

    In some cases, you may find that certain game elements (especially if it is an action game) don't work very well when you have to deal with 100ms or more of delay on network traffic. In that case you may want to remove or change those elements. You should pick a number where represents your "maximum" allowable delay, based on whether your target audience is modem users or not.
  18. Sounds a lot like our project... by freeBill · · Score: 4, Interesting

    ...except you can substitute Ruby for C#.

    Our Documentation Index page gives a basic list of the areas we have documented. The General Philosophy describes our philosophical outlook, while Core Concepts describe the main ideas which are needed to understand coding FaerieMUD. Our engine is based on the same Design Patterns you're describing. It is open source and is basically finished and tested.

    The game engine is known as "The MUES Engine" (pronounced "muse") for Multi-User Environment Server because it allows many users to simultaneously interact with one or more environments each being served by one or more servers. When MUES is being used for serving MMORPGs or MUDs, the environments are usually called "worlds" but MUES does not make any assumptions about their nature. They can be chat rooms or workgroups for collaboration or whatever.

    The MUES code is pretty well documented, so you may even be able to use it as pseudocode. (For that matter, it may be possible to use it in Ruby since it doesn't make assumptions about how the objects which are served to it are created.)

    Good luck, and let us know if any of your ideas look like they'd help us.

    All of which should not be taken as disagreeing about any of the other advice to look at WorldForge or MUDdev lists or whatever.

    --
    Eternal vigilance only works if you look in every direction.
  19. This is a lot harder than you think. by glyph · · Score: 5, Insightful

    If you're really trying to develop a massively multiplayer game, make sure that you're ready for a collossal failure.

    I can already see the debate about C# heating up over this -- but that's tangential to the real problem. It's not that C# will doom your project, it's that you wouldn't choose C# if you knew what you were doing (and your project weren't already doomed).

    First, my personal suggestion (and I say this as a developer with 2 years commercial MMP development experience at this point): EITHER you want to write an infrastructure, OR you want to write a game. Writing both by yourself will take you the better part of 10 years. Having another programmer around who is doing the other part is handy -- but making sure that they are separate tasks is important. I recommend ditching C# to use Python, and my personal infrastructure project, the Twisted network framework (http://twistedmatrix.com), but if you're not going to use that, then find another high-level language with good asynchronous networking support and the ability to load code at runtime. Other good possibilities are Common Lisp and Scheme.

    If you don't have any experience in the area, and this is for an Open Source project, join an existing project and learn some things from there. I can also highly recommend getting involved with a failed project in the game industry to see how difficult the whole thing really is :-)

    Be prepared to fail at least once. The number of failure points in an MMP project is astronomical: client code, server code, internet latency, even the community itself is a potential "bug". If your technology is great and your game is fun, but it attracts really mean-spirited people for some reason, you might see your servers empty out over the course of a few months, or never even get to a real "massively" multiplayer state.

    --
    Glyph Lefkowitz - Project leader, Twisted Matrix Labs
    Writer, Programmer - Not a member of the TSU
  20. Re:Some advice... by Kerg · · Score: 4, Interesting
    Java never seems to run very well on any given platform.

    It runs just fine on my Windows.

    It always looks and feels awkward, and never 'fits in' the platform it runs on.

    Eh? What are you talking about?

    * It doesn't seem to really be that 'portable' in the sense that Java programs often seem to work in unexpected ways on different platforms

    Having written server software in Java for the past 3 years can't say I've really seen this. I'm still amazed by the fact that I can drop my binaries on the occasional Linux or Solaris box and it just works. It's definately more portable than anything else I've worked with. Most often portability comes down to the experience of the programmer. Java doesn't prevent a newbie from being stupid and screw up portability.

    * He can probably compile C# down to any platform he wants to, as Linux seems to have C# compilation support, and other platforms will probably have this soon.

    It's not the language thats important, its the libraries. Java has them, C# doesn't have them outside the Win32 platform.

  21. Re:Some advice... by curunir · · Score: 5, Informative

    Not exactly true.

    Java has a lot of overhead. But that overhead is there for a reason. Java code gets faster over time as it runs (both due to optimizations done at run-time and the fact that class loading is still an expensive operation). However, in the case of a massively multiplayer environment, Java may be (and probably is) the best choice for the server environment. In a controlled environment where the application is expected to run for a significant amount of time, Java can actually perform as well or better than natively compiled code.

    The "Java is slow" argument is soooo tired. Sure, there are many instances where Java is slower than other languages (even C#). But if you're going to knock Java's performance, explain why or shut the f@#* up.

    --
    "Don't blame me, I voted for Kodos!"