Hot answers tagged

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, ...


17

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

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

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 ...


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 ...


11

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

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

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 ...


7

30 times per second is a common packet rate, but that's really a very very small part of te equation. Check out Networking for Game Programmers for a great intro article to game networking for latency sensitive designs like shooters.


7

Tribal Wars is a browser-based, massive multiplayer online real time strategy game, set in the Middle Ages. Now Tribal Wars is a browser based game and was released in 2003 as a text based game. Browser-based games usually rely on some kind of server-side code, such as Perl, PHP, Ruby, Python, or Java; though some will use technologies like Flash, ActiveX, ...


7

One library to use is ENet, which implements a generic network API suitable for many games. Or libevent even, which just handles the low-level network events. There is not a direct need for threads on most platforms, though Windows forces their use for large numbers of clients. Separate threads can be useful when you need a fixed response time or a ...


7

What about VPS servers? They can be pretty cheap and easily upgradeable because of their flexibility. VPS ( Virtual private server ) servers differ from real servers in the fact that they are actually just one of many virtual machines running on a real server, which makes it pretty customizable and flexible.


7

Do not copy the entire game model to the server, you wouldn't like to load all the textures and detailed meshes on your server. Keep it as simple as possible, handle all the important processes like the location, health, any movement but do not load everything. - NEVER TRUST THE CLIENT. There are many books, along with multiple wiki's. Every engine ...


7

Do the LOS and AOI (Area Of Interest) filtering on the server. Yes, any data you send the client can be hacked. OR extra programs can be inserted as a proxy between client and server to sniff excess data, like the old EverQuest viewer that lets players not only see far-away monsters but even what loot they would drop (which is a bit mind-boggling why that ...


7

Yes - it is feasible. MMOs often split the game world into multiple areas, as this makes the job easier, but you can still do it with 1 massive area - you just need to use a good spatial partitioning scheme. Because most objects in MMOs don't move, you can also perform a preprocessing pass where objects are used to create collision checking trees. Memory ...


7

Both approaches are used with MMORPGs. Keeping everything in memory and periodically check pointing it to disk seems to be the most popular option, at least for older games. It has the advantage of being fairly simple to implement and scaling fairly well, but making it reliable is completely up the to the developer. SQL databases provide ACID properties ...


6

OK, the obvious answers would be: Don't do drawing on the server. Just have the server tell the client what it needs to draw and let the client handle the actual drawing. Have the client keep track of the information it's previously received, so that the server only needs to send it a list of changes rather than sending everything again. Have the client ...


6

1) Would one embed the script itself in the entity object before persisting to it to the disk? Is this okay? You'll get cleaner diffs in your version control and encourage reusable scripts by providing the actual script out-of-line and having the entity merely store, say, a filename and script parameters. Storing the script in the entity itself is viable ...


6

There are many reasons I wouldn't suggest that: Computer resources are valuable. even if they are free, you shouldn't waste them. consider the case where two or more server are running simultaneously on one computer. If a single instance of server consumes all CPU cycles, other instances will simply fail. Surly OS will try to handle this kinda greedy ...


6

Can't be done. Haven't you ever been in a 10mx10m TF2 server where you'd just wait for drops? Neither have I! ;) You could implement some sanity-checks on your server, but then you'd have a central server. Can you afford a central server for such checks?


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