Tag Info

New answers tagged

0

As http://gamedev.stackexchange.com/users/30331/ben points out in his comment, this may not be the best way, especially if your state info is big. Otherwise: Is there a pattern to store multiple independent copies of the game state from different times, so that they can be easily compared? Have a look at the Memento pattern. You could have Mementos ...


0

You'd want to check out optimistic locking. For a practical implementation, if you are using HTTP for your communication, check out how HTTP uses ETag and If-Match HTTP header for conflict detection. If you don't use HTTP for your communication or if you use HTTP only as an envelope to your own request, try to base your design like ETag and If-Match. In ...


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


15

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


4

I agree with ratchet freak. As long as you have a single gameserver, it's not worth the trouble. However, this architecture might prove useful when you need to scale up horizontally. When one gameserver is no longer enough and you need to distribute your game on multiple gameservers for performance reasons, the "socket server" architecture could very easily ...


3

It probably isn't, most languages has asynchronous sockets that allow you to use multiple connections at a time without blocking while data is waiting. This shifts the "socket server" part to the OS/kernel. With an explicit socket server you will incur the cost of a few extra copies as you pass the data through the local socket; one thing that will kill ...


1

First, I haven't found any indication that another game does this. Having said that, I'd love to try it, or find examples of it, and was looking for examples when I came across this question (hence the (somewhat) necro - but an answer hasn't been accepted, so I might as well give one). I believe such a method would be useful, though its value would vary by ...


2

I see the following reasons to encrypt data: Protect your users' actual sensitive data by adding to the amount of encrypted traffic. If hackers have to wade through not sensitive game assets, they're much less likely to find a user's actual sensitive data. Protect your servers. Using asymmetric key encryption (like TLS, what people still commonly refer to ...


2

It depends where the bottle neck is. If you IO bound (the game is always waiting on network IO) then yes compressing will help. If your game is CPU or memory bound then it will just run slower. You should compress before encrypting because cipher text is less compressible as a result of trying to remove patterns that could be used to reverse engineer the ...


1

Encrypting the data each player receives makes cheating and ripping of assets a bit harder, but not impossible. The data needs to be decrypted by your game client anyway, so the encryption algorithm and key must exist on the users machine. That means the users have everything they need to decode the network traffic. So you only add a layer of security ...


-4

Do you care if people can get your assets? Do you transfer gameplay data? If any of the questions is true, then encrypt. I would use XOR cipher. It's super simple, super efficient, not super secure but you apparently don't care (it WILL make cheating harder of course, if you send gameplay data though). It works with streaming data, and the encryption is the ...


0

From what I understand your question can be boiled down to one simple problem: the input from each player is applied to the shared game state in different order. In the image above I am illustrating this problem with the coloured dots (which represent the players' input). Assuming 3 players, their shared game state should be the one labeled "real order". ...


13

You can use random seed. Select same 32-bit value in server and client (or server can send it to client at start). Use it as seed for random generator. You can send actual seed from server to client with game state update. If you don't want to send it you must be sure that client and server generates same number of random numbers by this random generator. ...


2

If both the server and client agree on the seed, most randomizing algorithm will output the same values.


0

Even in a fixed time-step environment(yes, you should use some sort of "turn based system" instead of timer, as you can easily slow down/up your turn duration), you will see math diverge. This is a really trick problem called "determinism". Modern different hardware is non deterministic, especially when it comes to float math, due to specific acceleration ...


2

Skew happens. This is a clock synchronization problem. Two nodes on a network can't know for sure what each other's clocks are. You can send the current time, but the receiver can't know for sure how old that value is. A good guess, though, is that it's stale by half the ping time. See http://en.wikipedia.org/wiki/Round-trip_delay_time. One approach then, ...


0

The solution I prefer is to put all game-specific logic in the client. The server only acts as an I/O reflector to make sure all clients are up to date. One benefit of this approach is that the same server can serve different games, since it knows nothing about the content of any specific game. There are a few things that have to be done centrally, such ...


5

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



Top 50 recent answers are included