Designing Multiplayer Game Engines?
"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."
Holy Mac has the transparent networking architecture in a C# framework. It should work well for what you're trying.
worldforge
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
Take a look at The WorldForge Project. You probably won't learn more anywhere else.
~shiny
WILL HACK FOR $$$
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)
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
Sounds like the architecture you're planning is quite close to FreeCiv's. You might want to take a look at that.
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
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
Back in '97 I did the exact same thing in Perl. It was actually a multiuser accounting package, but the principals are the same.
By blasting debits, the accountants could increase the net value of the company. If they missed, the debit's could rip through the balance sheet of the company...rendering it's offshore shields useless. If that happened a few two many time, it could spin the whole company into bankrupcy and court-ordered liquidation.
I found that the biggest problem was latency. I worked on some time compensation algo's, but I didn't get a chance before I was right-sized by the company.
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.
Yes, it's been done before, by freeciv
I never miss a chance to plug freeciv, because it's my favorite game, and a prime example of what good can come from programming free software.
freeciv takes the same client/server approach you're advocating, and, as near as I can tell, scales somewhat. Now, if you've got a lot of graphics going from client to server, it might not work the same. So I recommend freeciv just as a starting point.
Have fun!
Secession is the right of all sentient beings.
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
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."
What an annoying site. Won't display anything if you're using WebWasher to block banner ads, it just says "WebWasher not allowed".
Just FYI if you're using WebWasher, in the "Proxy Engine" section of the options, turn on "No identification as WebWasher with server", and you'll be let straight in.
What's the sense in blocking WebWasher? If you block people, people aren't going to see your ads anyway, the people blocking them are exactly the people who aren't going to click on them anyway. And especially as WebWasher has an option to hide itself!
If you want to maximize your users, why not use java instead of c#. The syntax is really similar and the performance difference is negilable. On top of that, your users can run the app is solaris, linux, and windows. Along with that, you can build a client java app, so that users can just use IE, Mozilla or Netscape to play the game. My experience with network clients and users, is that they like to use what they're accustomed to. By embedding something into a browser you're cutting down some tech support and installation problems. The other deal is c# is not too tested and requireds special installations for Win 9x and 2000 because they don't come with it. Everybody doesn't have XP yet. I've implemented some stuff like this in java before and it works very nicely due to java's nice network libraries.
can't sleep slashdot will eat me
Divide the map up into areas where you want all users to access the same things. Use a broadcast message to send mass updates to this. This cuts down individual client updates. Say there is an earthquake or something in the game. Broadcast this data to all those that affected in one big message. Java has features for this although I'm sure c# does also.
can't sleep slashdot will eat me
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?
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.
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,
[PowerPoint] is a tool for capitalist presentation
having one "master state" will be hard to scale. Make different states for different "zones" (either physical as on a map, or having to do with aspects of the game), and then you can delegate zones (or subzones) to other machines. Do this also for object-classes (player attribute state may be separate from object state, separate from location states, etc.) so that different subsystems can be independently optimized. A cluster of master META routers can glue these parallel states together to provide a single entry point and consistency. Round robin DNS would be sufficient in most cases (esp if using UDP or persistent (stateful) TCP).
Obviously, until things ramp up, you should be able to do all this with one server, but making these parallel states will make scaling much easier when the need arises.
----- Refactoring is the reason why man does not mistake himself for a god.
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.
Here is the website Terrarium
Just thinking out loud, but it sounds like the client subscribes to updates from units in a particular "area" (defined however you like) and will automatically be subscribed to the "partial" or "distant" updates for adjacent areas. A client's key allows it to subscribe to exactly one area at a time.
Server side you keep a list of client subscriptions and something like the PropertyChangeListener approach from Java to simplify the updates from your units. I think any solution has these or similar elements, your implementation will depend on what C# can do for you. I don't know anything about that. I used Java links as examples , since I didn't find any C# API links out there.
Please let me know how things go, and I'm interested in feedback on my ideas from more experienced MMPG builders out there.
[-- Trust the Monkey --]
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.
GPL Deconstructed
Stuff like "How can I make the networking code as transparent as possible so I don't have to write SendUpdate() after every assignment?" we can't answer. I mean, it's all events, and there are hundreds of ways to write this. There are countless examples. GUIs are event driven, for example.
A long time ago I wrote a multi-user game. It wasn't anything fancy, but it did the basics of what you are trying to do. It turned out that calling SendUpdate() wasn't the problem -- that's easily done with proper design (inheritance, etc). Heck, you can encapsulate the whole message in a class and let the constructor/destructor take care of it, if you want... The main problem was scheduling time to clients, especially when one client was slower than another. For example, it would be unfair for a fast client to send 10 move messages in the same time that a slow client would send one.
Another distinction you need to figure out is what needs to be real-time and what doesn't. For example, if the program supports inter-user messaging, you can implement "soon-enough" delivery rather than "just-in-time" delivery. It all depends what it is used for. That can be done with a MQ type setup rather than a real-time connection, and it can be sent from client directly to another client.
I wish I could work on such a project again.. open sourced, closed source, I don't care, just not commercial. But the internet is littered with the graves of abandoned open sourced programs, which tells me a little about how much commitment people are willing to put into these things.
Use the Jabber protocol for client <-> server communications, or even server <-> communications. You even get chat for free, then, and you could potentially use a standard Jabber client to inspect the server's state, and send administrative commands. All communications are in XML, so it's easy to see what's going on, and there's fewer endianness problems (even if it's more chatty). You can probably use SOAP or XMLRPC via Jabber.
Napster-to-go says "Fill and refill your compatible MP3 player", which is a lie. It's not MP3. It's WMA with DRM.
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.
Basically, I've broken it down into 5 objects: Game, Map, Sector, Player and Item. The ownership relationships are as follows: Game owns one or more Maps, and zero or more Players. Map owns one or more Sectors. Player owns zero or more Items.
There are three subclasses of items so far: Trivial (like swords and onions), Units (like tanks and horses), and Charactors [sic] (like Mario or Frodo). There are also interfaces for the items such as Movable and Jumpable.
Check out Metagame-Sector if this model interests you.
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.
You might like to investigate Unreal's network architecture for ideas.
If you want a successful project, choose solid, mature implementations of equally mature programming languges.
:)
You could succeed anyway, but then you could be a successful pianist with three missing fingers too. That doesn't mean you want to deliberately chop off three fingers.
Yeah, I have to agree about not using C#. You're *much* better off learning a new language on a small project for two reasons. First, the language can affect your design decisions -- a neat feature in one language might make it much "neater" to do things an a particular way. Second, it kind of sucks to be the one trying to forge the way for C# on something as performance-intensive as this. If you find out that C# has only one transparent client-server framework out, and it doesn't fit your demands (latency can jump too high or doesn't synchronize elements of your data), you're going to have to start over and write the whole thing over.
C/C++ currently have (besides the performance benefit) a far, far larger library set than C#. Heck, *Java* has a big networking library set.
Let other people live on the bleeding edge and do the bleeding. C# is proven to be solid for little pet projects -- I wouldn't currently try it for big stuff yet.
I know that suggesting a different programming language usually gets the same kind of reception that suggesting swapping underwear would, but why not consider writing it in Ada 95?
The learning slope will be very steep at first, but once you get the hang of it it will pay off in spades. Ada is a software engineering language, and it makes you do a good bit more thinking before you start spilling code, but over the long haul you end up spending most of your time in the think-program cycle rather than in the more popular but IMO less satisfying program-debug cycle.
Pros:
- Ada is designed for large software projects.
- Bullet-proof against buffer overflows and such.
- Supported by GVD (the visual version of gdb).
- Very strong portability properties.
- Supports both high-level and low-level programming. (OO, generics, etc. all the way down to in-line machine code. But all are optional; you can write simple code when that's what the problem calls for.)
- Built-in support for multitasking and distributed computing, if you want it. (And distributed might be the way to go for a big-game server.)
- If you need a GUI there are thick bindings for GTK+, portable between UNIX and Windows. These bindings are OO, so you can create custom widgets by inheritance.
- Everything mentioned above is available for free.
Cons:Sheesh, evil *and* a jerk. -- Jade
...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.
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
While I'm not sure what kind of strategy game you're doing, but if you're planning to make it scale well it's going to be a lot of HARD work. There're a lot of issues to tackle - server load balancing, bandwidth mixing and dead reckoning. If you're considering what features to build, look at the API provided by RTime www.rtimeinc.com. I find their model pretty comprehensive.
...this?
Eternal vigilance only works if you look in every direction.
Normally I dont responf to AC's but the fallacy in his thinking needs to be pointed out
Windows service packs are released for free
So no need to upgrade just to play
1. Ms has made it quite clear that they wanted people to pay for XP as a subscription model.
2. There is no early reason why they would make the claim that the "value" you get for your subscription money is an up-to-date system which includes bug! The point is that they dont feel that they should continue to their software for free.
3. That means, that You will no longer get service packs for free as these can be viewed as Service Pack upgrade or even a NEW VERSION, the point being that you will need to pay
4. The other point, that MS has back off from, for the time being, is that they want software to be time-limited, which is to say that if you dont pay a subscription fee, then you no longer have the right to use the software, ie, in another words MS has clearly stated they want to change the way people view software from being views as a buy once commidity to something like Cable Tv in which you pay every month, and if you dont pay, you dont Watch, ie you cant play your games on their OS.
Sorry for being so long
Sigs are dangerous coy things
From the intro page:
.NET Framework.
Terrarium is a multiplayer ecosystem game developed using the
It will probably give you some ideas on how to implement this kind of thing.
Donate background CPU time to fight cancer.
"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. "
Obviously you haven't been paying attention over the past several years.
Ultima Online
Everquest
Asheron's Call
Many many numerous others, I know I paid $10/month for a bit to play Allegiance. Going back in history we have examples at Compuserve and so forth.
Ongoing charges has been a factor of life for multiplayer gaming since almost it's beginning some 20 years ago.
Take your FUD elsewhere, troll. If people find enjoyment with the game and the value of paying per month exists they will do so. Otherwise the game will fail.
In the case of the XBox what I see as viable is for them to have a one time charge to access a large farm of hosted servers that grants access to many different multiplayer games. As things stand right now each different game asks for a seperate $10/month fee. Most people I know do not get addicted to just one game, they may play several, or go months at a time without ever touching one particular game.
I'm not at liberty to say how I know this but this is what I know of Everquest (the most popural MMORPG):
.... reseting crashed NT servers.... yes, that's right. full time server reset people...
They used NT and C (Asm too?) to develop Everquest and they are paying for it dearly.
Everquest has had up to 80,000 simultaneos users which were distributed over 200 NT servers.
These servers are in two locations and they have two FULL TIME employees who walk around all day -- their sole job
In addition, they've had nightmare situations with patching and keeping these systems up to date.
And another thing I know is that their next game (forget the name) they have started nearly from scratch and are developing on a UNIX derivative (may be linux... not sure) mainly because the costs of running the game on NT are too great...
learn from experience...
...he might as well learn a language that's actually useful, rather than C# (pronounced ``see-crash''). Ruby is not only extremely useful, but you also don't spend too much time counting spaces to make sure your code blocks are where you think they are... (-:
Oh, and you can run it in a JVM (did I mention portability?) and spit it out as C if you like.
Got time? Spend some of it coding or testing
3. You are planning to use an unproven language purely for its hype.
.NET framework combined with an innovative XML protocol for the information superhighway! Wow! That will impress every PHP on Earth.
So to sum up, you have no clue what you are doing (the very fact that you asked it on slashdot, of all things, is an evidence of that); you don't know the language you want to use; and, instead of evaluating your options, you decided to ride the hype, perhaps to make your CV buzzword-compliant. Therefore, this project is doomed before it is even started.
Oh, and just to throw in some more buzzwords, I suggest you make it a Web service using the
___
If you think big enough, you'll never have to do it.
Here are some Slashdot articles that have been posted about cheating in online games. You may want to give them a quick read if you're developing an online game.
Combating cheating in online games (16 November 2000)
Multiplayer Game Cheating (16 July 2000)
The only thing necessary for the triumph of evil is for good men to do nothing. - Edmund Burke
Did you decide this just to generate a deluge of flames?
Too big to fail? Does that make me to small to succeed?
1) Slow down a bit, and give this project the respect that it truely deserves.
/. to show you all that you need to do.
2) Don't use C# for everything*
3) Break the project down into parts that are actually accomplishable (i.e. network layer, world engine, actual game). Choose one of these layers and actually get it to work.
4) Read lots of books because it's gonna take a lot more than a couple of comments from
I don't really know of a great networking book, but you would really need to brush up on newtonian physics. There is an aweful lot of physics involved and 3d hardware will for the most part, not calculate this for you.
5) Pay your dues on some open source gaming engines. Get your feet wet before diving head first.
* C# is bad only because your gonna need big time speed for the 3d engine. The server is likely to require a bit of speed in handling client requests efficently too.
For these areas, I would recommend C, or C++ if you know C++ _really_ well. C++ can be just as efficent as C but you have to know _exactly_ how C++ works and you must know the spec inside and out.
C# is really fine for the frills of the engine, but any VM based language would not do well for the heart of the engine.
Key is to use languages where they are appropriate.
int func(int a);
func((b += 3, b));
Please DO NOT LISTEN to this guy.
Try supporting a large java app, with folks who may have to install JRE's, open up security settings in their browser sometimes talking to an admin before being permitted to do so, who will find ENDLESS incompatabilities between various versions, and will discover that that java does NOT look "like what they are accustomed too" and you have yourself a gargantuan support, installation and education headache the like of which you probably have only had nightmares about.
Mix that with the fact that you WILL be taking a performance hit by going to java, and the difference in performance between Java and C# is only likely to INCREASE and the technical arguement becomes even simpler. Remember that Microsoft will be droping Java support as fast as they can, do you think future IE/Windows is going to have a JVM? No chance.
Mix with the face that C# at least so far appears to be an HONEST open standard, unlike Java's endless standardize promises, which have been repeatedly broken so that the only ones who continue to defend their promises of open standards are the insane java zealots, and you have a solid business (open standards are better, safer, and do not put you on the hook to a commercial company) and even moral decision that is clear cut.
Here is a very in-depth look at the networking model for StarSeige: Tribes and Tribes2. It is written by Mark Frohnmayer and Tim Gift, who kinda wrote the thing. It goes into great detail about all the things you're going to have to think about, including construction of the stream layer, the perception of real-time play, preemptive client prediction, etc. A must-read if you're thinking about programming this kind of thing.
You might also want to check out GarageGames for some other game development resources.
-3Suns
~~~~
The Revolution will be Slashdotted
If you are advocating Common Lisp, *please* tell me what compiler you're thinking of.. I've looked over them, and they are all inappropriate for a game. They may have late binding, but not always, and its the 'not always' part that bites you.
I want to build a car using (insert new untested material here) because its new. I know I'll need some windows, and wheels, and some sort of engine. I don't really want any suggestions about what materials would work the best because I want to learn how to use the new (untested material). What I really want to know is has anyone else ever done this before, and what should I look out for? I'm pretty sure I'll need to make sure it gets good gas mileage, but it will have to be really heavy, acceleration isn't important, but I want it to be responsive in the turns...
Why would anyone ask a slashdot group about a C# project?
Casca
Really, writing something as sophisticated as this with a new language which neither you nor it's developers completely understand yet is a really, really bad idea. I wouldn't use C# for any major production project yet. It's not ready for it.
;-)
If you have no prior experience writing this kind of application, I'd recommend using somekind of a framework to provide you the basics. This will save you the roughly 1 billion design mistakes you are likely to make. If you were experienced with this kind of thing, I'd give you different advice. But for your first run it'd be a smart idea to learn a decent design that someone else has already done.
You could look at a few open source projects which are doing this thing. If you don't like any of them, the other thing I'd suggest is using a J2EE solution. What you're describing sounds like a good fit for a JMS-based solution, particularly using message-driven beans. The nice thing with a J2EE solution is you have a proven framework to work within that can provide you with the scalability, availability, and reliability that you need.
I'm not against reinventing the wheel, but it's best if you have some experience before you do that, otherwise you'll end up with a triangular shaped rock.
sigs are a waste of space
I won't cover the networking problems, because that's not my forte, but rather the issues of physical proximity of players. You have to assume that a player has a limited range of sight and effect to cull the amount of data sent to a player in real-time. Assuming a perfect 56K connection, you can only send about 600-700 bytes per 100msec frame, so (BOE) you can really only send position updates for about 20-50 other players, depending on compression techniques, etc.
Spatial Data Structures (Hanan Samet) describes a set of aglorithms such as quadtrees (2 - 2.5D), and octrees (3D) which can be used to solve the proximity problem in log time in multidimensions, i.e. you can find the N players within a reasonable distance in a pretty short period of time. In fact, you only have to traverse down once, then traverse back up until you're out of range. Insertions are log N as well, so the server should be limited on network bandwidth, not processing power. You can also give priority (send this packet first) to the player that you're looking directly at (or who's looking at you), with diminishing interest in other players (if his back's to me, and mine to him, I don't care quite as much as if I'm looking directly at him),
The second part is "what happens if I don't get a packet for an assigned player in time", a typical UDP problem. In a flight/driving sim game, you can "guesstimate" with an area of probability where the player's going to be, and if you're shooting at him, give the probability of a hit. Sometimes you'll miss when you should have hit, and vice versa, but you have to do something.
Do the canonical system first, with objects in 3-D space which can manueuver and shoot to tune your algorithms on the server, then you can refine the game. Doing a simple "space shooter" should be relatively easy. You can make robo-clients with scripts to test out your weights and probabilities. Once you have the empty space shooter, you can add a world with static objects, which should be replicated on each client. Dynamic worlds (walls falling down, etc.) are much more complicated, where you have to set the before and after on each client, and kick it off with a trigger. Dynamic interactions get a tad too complicated even in single player games.
If you're doing a game with animated players, it's easiest to have pre-programmed positions (running, shooting, slashing with the sword, kicking), so only a code for the target of the action has to be sent down. You can't ship down full animation information, it's too expensive. Unfortunately, it makes fighting unrealistic, because there's no reaction to the pre-programmed code. Doing interactions between figures is an N^2 problem (I block his kick), which while doable, requires a lot of hand-animation work. Full inverse kinematics is computationally prohibitive (AFAIK), but there are approximations that are quite realistic.
Keep your hopes up. There's a lot of stuff out there that's not very good because it was put together in a hurry.
For the networking stuff, try some tuning of packet sizes and rates for different scenarios (modem, DSL, high ping times) to figure out what's most efficient in terms of accuracy and percentage of arrived packets. You should be able to figure out your optimal packet size and rate for each scenario.
"These servers are in two locations and they have two FULL TIME employees who walk around all day -- their sole job .... reseting crashed NT servers.... yes, that's right. full time server reset people... "
This sounds to me more like a management problem.
Instead of having two full-time employees walk around all day rebooting servers, why not just hire one competent sysadmin to read the fucking logs and find out why the servers are crashing? Or maybe hire a few competent programmers (that find the problem and fix it, instead of whining about the OS) if it's the EQ code that's at fault?
Oh wait, my bad, I forgot this is Slashdot, where we bitch about MS, without a link or anything else substantial to back up our slander.
-Tommy
"I got a half gallon of Jack, and 2 dozen Ant Traps. I'm about to get wild." -me
Why not? .NET you can create a distributed application, where the app is hosted on the server. So if you make a change to the client code, the clients automatically get updates.
Being Java based, C# has great networking capabilities, and there's a lot of Java code out there that could be ported to C# easily. It also has the performance advantage over Java, which is important in a network game.
With
C# is an excellent choice for this project.
Check out the Terrarium game at www.gotdotnet.com, they use quite a bit of this technology.
Good luck, and ignore the Linux Jihad!
Offtopic, Inflammatory, Inappropriate, Illegal, or Offensive comments might be moderated up.
I wouldn't use C# right now because it is too new.
On one hand I understand the appeal of using the latest and greatest language: I fell into the same trap with Java in 1997, and this was a wrong choice: the library was full of bugs and I spent half of my time working around bugs..
C# is very new, so I wouldn't bet on it.
Oh BTW don't believe the press, at the same time I was badly hurt by the bugs in Java, I kept reading reviews which were swearing that Java was the greatest things since sliced bread (in Byte or Doctor's Dobbs)..
If Microsoft has an open bug report process, first check the "level of bugs" before..
I should have looked at Sun's bug parade before choosing Java, it shows the true state of Java (a looooonnnnnng time to correct the bugs.).
Did the thought ever occur to you that maybe the server code for the game is buggy? In that case, from managements perspective it maybe be more cost effective to have 2 fulltime server resetters then spending programmer hours on finding/fixing/testing/deploying the fix.
And if its not the server code then it may be the drivers (ie. network card) that is causing the crashes and not the OS itself.
I think that most Unix systems are more stable because the vendor (ie. sun, sgi) has direct control over the hardware that it ships with and can fully test the default hardware config with their flavor of unix. If MS was able to test every possible PC configuration then maybe they would be able to guarantee 99.9999% uptime, but NT's uptime reputation is at the mercy of driver developers of other companies.
(I had to remove some information, especially ascii art sheets which the lameness filter catches)
This is a replacement signature.
Cool. I will be sure to check them all out.
Perhaps I should develop my own re-targetable meta-language so that I can defer the language decision until later?
Also, you heard of unlambda? I think it might be a worthy addition to your list.....
C# has no useful for games networking capabilities whatsoever -- it's based on the idea of a remote (procedure,method, ...) call while networked games have to deal with asyncronous streams of requests and messages. One can reduce those streams (plus all related structures that describe which stream describes which instances of objects, and how their state should propagate between clients and servers) to calls but that would be like writing a GUI on a Turing machine.
Contrary to the popular belief, there indeed is no God.
You raise some very good points - I actually hadn't really given that much thought to using a separate language for the server. Reason is that there is a certain advantage in using the same language for client and server in that you can get some *serious* code re-use.
I think the biggest issue is development speed. You only have to write all the object representations once, and you avoid all the bugs that could occur when you update the server but not the client and vice-versa. Less of an issue for a big commercial house, definitely an issue for a "Lone Wolf" coder like myself who needs to stay sane and motivated.
You can also use server code in the client to handle updates. My first draft at a networking protocol made heavy use of this - updates to the game are propagated where necessary and applied to both the client and server states of the world to guarantee synchronicity. The client and server representations of the game state are the same class, and it would be a real pain to develop two versions in two languages simultaneously.
You can even make the client and server the same program, to enable P2P style operation. Haven't thought it fully through yet, but If you had a muli-side battle with multiple players per side (lets say 50 players total?) it might make sense for some of the clients to become "servers" for their own side, taking the load off the master server.
Then there's always a whacky AI idea that I am planning to test out - Clone() the entire game state and let the AI try a genetic algorithm on possible command combinations. This could solve the classic "lack of collective intelligence" problem a lot of strategy game AIs tend to have. Admittedley you would probably want to do this on the server, but it seems like there could be a potential to offload some of this work to clients, e.g. letting a client process the moves for an "allied" AI so they would make no gain from trying to throw a spanner in the works.
Problem with all non-gc langauages is that they *really* suck at serialization/persistence because you basically have to roll your own code for every type of object you deal with. C can't traverse an object graph automatically because it has no idea where you have put your pointers.
Which is a right PITA for a network game..... not that it's impossible, but it's highly bug prone and very time consuming to update as you build your engine. And isn't laziness one of the three virtues of a great programmer?
C has it's good points, network programming unfortunately isn't one of them.
This is actually very interesting to me...
You could basically write a game that put a display up on multiple X terminals. This would have multiple views into the same world and allow multiple keyboard and mouse inputs to that world. The server system and network would have to be very fast to support this game. It is practically impossible to cheat with this setup too.
The other end of the spectrum would have the game distributed onto each machine, with all updates from every machine being multicast to every other client at the same time. This would allow each client system to distribute part of the load of the game and its display across the network. You would need a very fast network for this.
In between these two extremes is a central server that has clients connect to the server. The best way to distribute the work on this system is to look at what needs to be done. The local system will render the view and play the sounds. It will need to send it's mouse and control movements to the central server. The central server will look at all the inputs and send back update information to all the clients.
It can also be slowly uploading the information it will need for the next level while you are playing the current level. You may also have an encrypted CD at each client that can only read the information when the server gives it a valid key. The key is not cached. You may also want to authenticate that the client is valid by performing a checksum on some portion of the system in memory and returning that to the server.
This way the rules are all on the server, so cheating will be at a minimum. But they will have all the map data, so a hacked client may give them more info than the other players have.
The next step is to also download the rules to the clients at game time and let the clients decide what is happening for themselves, then send an update to the main server which just distributes the info to the other clients on a need to know basis. This would eliminate all mouse and keyboard data uploads.
But having modified clients that allow cheating could be bad. You can minimize this by providing stripped binaries that authenticate to the server, but a determined cracker can get around that.
-- Never make a general statement.
"Hi, I'm an experienced programmer who is going to implement a massively complex project in a brand-new and probaly buggy language. Also, the language in question (C#) will never work on any platform other than Windows and I would like advice from Slashdot readers (??)
.NET archicecture, I'll be able to send all game state changes to thousands of clients at the same time from a single server."
I'm so experienced at programming that I don't need to know what exactly it is I am doing. Since I will be using the
Conformity is the jailer of freedom and enemy of growth. -JFK
I used to work for the CBOE as a Systems Support Analyst. In this job I was supposed to do hands-on troubleshooting of the options quote distribution system that populates the arrays of screens with stock tickers and options prices.
At the core was a huge tablespace (database) of product:Bid:Offer:Last:Timestamp. That was an Amdahl mainframe running TPF (like the Sabre system backend for Travelocity). From there, the prices went through a ring-buffer where they were synchronously distributed (by another corporate entity: OPRA) back to all the derivatives exchanges including the CBOE. This happened over a T-1 in my time. Some Stratus Continuum (Wicked expensive redundant out the wazoo HPPA boxes running VOS) modules massaged the data out to and back in from OPRA. No traders on the CBOE floor have yet seen the effects of their bid/ask changes or last-sales on the overhead ticker displays.
The Stratus modules maintained a first-tier subscription list for 10 georaphic "cells" (really called "posts" at CBOE), and streamed the appropriate updates to a "Post Display Server" (PDS). Each PDS server maintained a second-tier subscription list for 4 (possibly more) "Remote Control Node" (RCN servers) which fed a third-tier of subscriptions to the RCN displays, the end-client, a Tektronix X terminal running proprietary quote-screen software locally.
We could never get clocks on all the servers to synchronise completely, but I estimate it took less than 500ms for a price change to make it to the screens, and peak trading times would see delays of 2-3 seconds.
The multiple tier distribution system is designed to limit the impact of demand/performance spikes to the fewest number of clients possible. For example: your MMPOLG might have a server for each "city" in your game. I've always thought this might be a good application for a Beowulf cluster because of all the paralellism in dealing with all the clients simultaneous actions. Basically, you're a database of game state, and you have to sort and forward events to the fewest clients possible in order to keep things from getting overloaded. Clients recieve state, and they feed input to a state-engine, which generates events, which get sent back to the clients. The server sends the client a pond, the client throws a stone in it, and the server sends ripples back to all the clients at the pond. Your job is to keep that process as lightweight and distributed as possible.
Good luck.
--- Nothing clever here: move along now...
Well, I can agree that you can never guarantee security in today's systems.
I also haven't looked at cheating, yet, but I have a couple ideas.
One: PKI. If every packet sent by the server is signed or encrypted, then a client should obviously only trust signed packets. Prevents some man in the middle issues. If both client-server uses PKI, then this applies in both up and down stream situations.
If you use both global and personal keys, then you can encrypt messages in two ways. Personal keys are for specific P2P communications (such as important state changes) while the global keys can be used for multicast information (like monster movements or screen updates). This of course depends on the strength and inassailability of the keys, but that is a technical issue and not a policy issue.
This doesn't address the ability of miniservers to create state. I haven't decided yet if that's going to be allowed, but if it is, one possibility is to have multiple mini servers correlate data, to increase security and robustness. This is still imperfect because a group of friends who play together can still cheat together (bad clients, for example, or proxies, or whatever)
On the other hand, cheating can be curbed, I think, by good game design; where cheating is reduced by making the benefits of not cheating much higher. That's another policy design. IE, a bunch of friends won't cheat each other, if they're really friends...
GPL Deconstructed
Interesting papers...
*grins* Somehow, I hope that the author reads his replies.
At any rate, one of the papers (forgive me, but it's the one with the link on the right side of the page) mentions a method of runtime polymorphism (or something very much like it) that is accomplished by attaching categorized properties to an object.
The paper then implies that the categories themselves are fixed prior to runtime (showing a UML-like class-graph indicating two categories "can use" and "use").
While I believe that flexibility and utility can be served with few categories, and also believe that the categories themselves probably align well with the object model (if one "can use" something then does "use" something, or "can take" something then does "take" something... etc), I find myself wondering if any thought was given to a more general extension system where whole categories themselves could be given to an object during runtime.
I arrived at the desire to do something similar (flexible runtime polymorphism) at a high level of abstraction while considering MMORPG from a graphics-engine perspective, and looking at developing an MMORPG runtime engine based on a directed acyclic graph (just as many graphics API's use the concept of a "scene graph", an MMORPG runtime engine could use a "world graph" in the same way).
Looking at the same example as the paper presents, there is an in-game object, which is furthermore a weapon, which is wielded by one who is pure-of-heart, which has the added effect of undead slaying (my apologies, I know the paper doesn't use those terms, but it's close).
Using a "world graph", it might be worthwhile to view the object as a node, and view the property of "being a weapon" as a sub-node. From there, the "can use" set of properties would be a sub-graph rooted at the "can use" node rooted at the "being a weapon" node rooted at the object's node itself.
At this point, the idea of a "world graph" really isn't any more powerful than the categorized lists, but the framework might be (I believe) more flexible if organized as a graph, and the implicit ability to add seemingly nonsensical properties to an element of the world would _almost_certainly_ appeal to the game-designers ("...wow, I just made a door that can be wielded as a weapon once it's torn from its hinges, bet you never figured we could do that..."). And _hopefully_ the framework could do that without modification to the runtime engine.
*ponders* Yes, sorry. Long post. But in sum, I like the concepts presented in the papers, I'm just wondering if there was any specific reason to truncate it (runtime processing overhead & etc) from a more general approach to runtime polymorphism
I've never had to count spaces with python -- and it's been my primary application language for years.
It's a fine point to try to debate with, until you try to actually use the thing and realize it never comes out at all (as opposed to counting curly braces in other languages, which really has happened to me).
Further, Python too can be run in a JVM or converted to C.
Ooh, time for an editor crusade! (-:
Knew about Jython (which see-crash can't do for political reasons) but didn't know about C as a compiler target.
I hope that there will never be a JVB compiler, but would find a VB compiler with Python, Ruby or even something ruder like Java or C for a target highly useful as a stopgap from time to time.
Cheers; Leon
Got time? Spend some of it coding or testing
Argh! Why couldn't he have called to pytusi or at least py2c? There's already a p2c for Pascal which is in wide use.
Got time? Spend some of it coding or testing