Hot answers tagged

41

I may be wrong, but your question makes it seem like you are missing a lot of knowledge in order to successfully write an MMO server. I know this message will likely fall on deaf ears because I was in your position when I started programming. My answer: If I were you I would start smaller. If you want to learn to write an MMO server I would do the following....


37

You don't want to send player input to the server. What you probably want to do is send an abstracted representation of what the player wants to do to the server, and then run the logic on there. Likewise you don't necessarily want to send back everything the client needs to do. For example, you can send some kind of message saying "NPC X died", and the ...


36

Most MMOs (or projects using similar architecture) I've worked on or know of use the first method: the game servers work mainly with the RAM on the machines running the server processes, and only periodically serialize the relevant game data to a SQL database for archival (if one is used at all). The problems you note regarding power failure are valid, but ...


36

First of all, are you sure you really need that? Have you calculated the memory footprint? A small back-of-the-envelope calculation: A single mob and its state should fit into 100 byte of data. Let's give it a whole kByte, in case you are doing something extraordinary. When a cell has 1000 such entities, it requires a MByte. If your world is 100x100 cells, ...


23

You should prefer to keep your rendering code separate from your game logic, as they are separate concerns. If you separate your rendering code from your client/server code, you get a couple of advantages: Creating a dedicated server will be easier, as any code that renders will be in one place. You can separate your update phase from your render phase, ...


23

Two words: headless client. Basically it's an AI driven client that's had the all graphics bypassed so that you can run many multiples of copies on a machine, you can even run them on servers because you never initialize the graphics at all. Above all those clients is a supervisor that is responsible for starting, monitoring and stopping all the clients to ...


18

It depends on the nature of the content: Is it an asset that is loaded by the game, like a model or a texture? You want a version control system. Is it some form of data not loaded directly by the game, but used to build data directly loaded by the game, such as a localisation spreadsheet? You want a version control system. Is it a document outlining the ...


18

From an API design perspective, when deciding whether to make multiple separate communicating programs or just one, the question is: can each program function meaningfully without the others? The answer will vary based on your project and preferences. If they can't, it's not worth thinking about. Clearly they're so heavily linked that they're not really ...


15

For traffic load testing there are many tools, but you're going to need to test other things as well that will be specific to your game server because network traffic is only one part of the equation -- the processor utilization and constant database queries are two others that immediately come to mind as important factors that you'll want to measure (there ...


15

Independent of feasibility (yes, depending on scale) there are often better or easier ways. For instance, in your typical MMO, the server really only needs to know about the coarse navigation map used by AI and player pathfinding. Instead of storing the location of a tree, you can instead just cut a hole into the navmap at the location of the tree. Likewise ...


15

1000 player may or may not be a problem. It depends on how often you need to update the database. However there is a simple solution: put the database on its own server. I had a peek at how the database system works a game that people would call an MMO-Lite – which one I will not disclosure – yet I can tell it consistently has more than 1000 players, this ...


14

The world being separated into chunks is indeed the first step you should take, with each chunk being handled separatedly. Static objects? Purely static in the sense that they never move, and never disappear? Then you could simply incorporate these objects into whatever data structure you're using for player navigation in the world (such as a grid, ...


14

Well, you got answers but your real answer is at "try yourself". The things differ from game to game. I did couple of multiplayer games for some distributed network game design course. The most challenging was doing a realtime action game where many players involved and sending inputs like hell. When it comes to that point, everything becomes problem. As ...


14

Attack vector 1: The netcode As already pointed out by Mario, one important factor when designing the network protocol of a client/server application is to not blindly trust the client. You can't control the software which runs on the client machine. You can't even tell that it's your software and not something the user programmed themself. The same ...


14

One way you could solve this problem is not actually storing state on disk, but just setting up your generation code to use a seed for the random number generator, so it generates the same thing for a given area every time the area is generated, deterministically. Then you just keep the 1000 or so most recently visited areas in memory. When areas are ...


12

Web browsers disable some Javascript features for security reasons. My bet is that you just hit Google Chrome forbidding XMLHttpRequest on local files by default (see this answer on SO for how to disable that, but beware: this is dangerous). See this page on the Chrome dev site for details. This is why you have to setup a local HTTP server to workaround ...


12

is it worthwhile to have a separate process that listens for connections and messages from clients and sends the data via local sockets or stdin to another process that runs the actual game server? To answer whether it is worthwhile, you had to first ask yourself, what is the problem you are trying to solve by adding a dedicated queuing service. If it ...


11

As others have said, the first step is separating logic that's shared from logic that's not. While it's great to draw that line wherever it's clear, your addendum illustrates that sometimes you don't have a clean line to split the code down. So, how do we solve cases where the client and server want to do semantically the same thing (play a sound), but take ...


10

I'm not sure what it is exactly that you want to achieve. But, there's one pattern that is used constantly in game servers, and may help you. Use message queues. To be more specific: when clients send messages to server, do not process them immediately. Rather, parse them and put into a queue for this specific client. Then, in some main loop (maybe even on ...


10

Configure your servers to capture and save crash dumps (if you run on Windows, MiniDumpWriteDump and SEH is a good place to start) so that you can diagnose hard crashes offline. You'll probably want to make sure your release builds generate and archive a PDB or other symbol- and debug-help related data internally as well as provide a mechanism to allow you ...


9

I'm working on my first multiplayer game as well. It can be daunting just learning the problems specific to multiplayer, so I highly recommend that you get good at making single player ones first. First, see if any of the game/networking engines fit your needs. For an Android game especially, starting with a well-developed toolset is almost always a good ...


9

Speaking as somebody who's been paid to do this.. In a standard MMO server network configuration, you have three main pieces: A point server. This server has a public IP address, and contains nothing of value. When a client chooses to connect to the game, the first thing it does is query this server. This server provides the IP addresses (and ports, if ...


9

After searching around, it seems that synchronizing the clocks of 2 or more computers is not a trivial task. A protocol like NTP does a good job but is supposedly slow and too complex to be practical in games. Also, it uses UDP which won't work for me because I'm working with web-sockets, which don't support UDP. I found a method here however, which seems ...


8

I think you are worried about the wrong things Milo. I see from your other questions you are planning on writing the game is C++. Even a not very well coded sever written in a scripting language would be able to handle 100's if not 1000's of requests with out apparent lag in a card game. These kinds of technical details are probably not going to be a ...


8

In my opinion there are a few types of mobile games. Single player / action / arcade puzzle - these doesn't really require a server side anyway and you can go a long way with openfeint or gamecenter to implement the social functions. Multiplayer / MMO / MMORPG - These require a strong backend with very quick response times and the BAAS solutions are really ...


8

After the user authenticated itself to the loginserver, give it a token (an unique, randomly-generated string too long to be guessed). The loginserver picks a gameserver. Send the token, the username and all other relevant data about the user from the loginserver to the server it picked. Send the token and the hostname of the gameserver to the client. Then ...


8

Whichever you do, it doesn't matter. If you rely on clientside calculation of anything you will get hacked. All the "anti-hacker" tooling has AFAIK been thoroughly penetrated, new versions often themselves being hacked in a matter of hours after release. Given that, browser games are a major PITA IMO (poor usability) though they do offer ease of installation....


8

Scrambling the transmitted score is probably worthwhile. To avoid cheat-engine type stuff, you can always scramble it in memory too. If you're storing seven variables, each of which, %10, is a digit, and you add a random number of 10s to each variable whenever a score changes, then it will be tricky to find a variable that matters. You could also get quite ...


8

One way to do this is not to change the actual values in the database in realtime. When the player logs on, you see how long it's been, and how much stuff he should have if he were earning during the time he was logged off, then update the value accordingly. One benefit of this is that if a player never logs on again, you're not spending server time and ...


8

I think the "MMO" aspect of the question here is mostly irrelevant (although it does provide trade one major optimization for another, discussed later); the core issue is the same as would be faced by any game with large worlds and many gameplay entities that need pathing. There's a handful of things you can do to help with this. The tl;dr is to make sure ...


Only top voted, non community-wiki answers of a minimum length are eligible