Hot answers tagged

6

Client-side prediction depends very heavily on a deterministic physics model that exactly replicates the way the game object behaves on both the client and the server. Even small floating point errors, differing random seeds, or slight differences in time if your time step is not fixed can cause very different results. These results can then rapidly diverge ...


6

A combination of both strategies would likely yield the best results. Just keeping track of when user join/leave might not account for situations where the user is unexpectedly disconnected. A periodic poll would likely have to happen too often to get reasonably updated list of players joining and leaving. So, update the list when a player joins or leaves ...


6

You only need to update the database in two cases: the user performs an action or requests information from the server another player wants to interact with said user Periodically checking if the database needs to be updated would put a lot of strain on your servers. Instead, information should be updated only when it is needed. In other words, you don't ...


6

As far as I'm aware, this is essentially what many console games do. This was even brought across to some PC games, like Call of Duty: Modern Warfare 2. There are, of course, some drawbacks: Any coding effort to "do some checking to stop cheating" would almost have to be more complex than the physics code itself. You can't trust the client, pure and simple....


5

The essence of the "host advantage" is having a low ping (round trip time to the server). If you are the server, you'd have no ping time, but even being really close to the server would result in a small ping and still have a large "host advantage", so I'm just going to call it a "low ping advantage" instead. It really depends on the game and how the ...


4

Client-side greatly reduces your costs. The server is doing less calculation, so you need less server power per player. Assuming you want to display the path to the client, doing the calculation server side requires you to send the whole path down in one big chunk, while doing it on the client only requires sending up the actual movements (which is about ...


4

You are right that when a client does the AI calculations for its own player, it's an invitation for cheating. But what you could do, is make each client do the AI computations for randomly chosen other players. Players could then still screw with the games of others, but as long as the computation tasks are sufficiently anonymized, there would be no ...


2

This document explains what you need to know.


2

You could try using a lerp (linear interpolation) function using the current client rotation and the last rotation received from the server. Because you always want to use the same time period to update the rotation you could reset a variable each time the server receives a message and increment it by delta time each frame. For example, if you want the ...


2

The answer is that it varies. A lot of the foundational code, messages and protocol handling and so on, can absolutely be shared. At the game-object layer, it's often more advantageous to have separate client and server implementations. In a class-based system, it may make sense to have a common shared base class for each entity or component. The ...


2

I would recommend you to allow both, because it allows your players to have both of two worlds. They can run it on servers in datacenters to provide a permanent meeting-point for their social circle. But they could also open an ad-hoc server from their client. You could easily do this by implementing the server in a DLL which is used by both the client ...


2

Sending data to the server can usually happen at a higher rate to data coming from the server. That's because the main bandwidth restriction is usually on the server's outgoing connection to all the clients, and also because the client generally needs to send much less data that it receives. However, this will vary based on what sort of game it is, and how ...


2

It's hard to tell for sure from the information given but it sounds like what you are trying to do is make the client and server run deterministic code such that if they start with the same starting state and process things on the same loop numbers that they will result in the same values for the same calculations. Is that correct? One thing you are doing ...


2

CPU 100% is most like a loop running, maybe to check if mouse has moved? You have to realize, that if you don't restrict message sending with time passed, you might send thousands of packets per second, when moving mouse. 1: Client-side prediction is movement you do, before server says it's ok to move. So, Client pressed move button and instead of waiting ...


2

Every network application requires some system to act as a server. There are two ways to implement a multiplayer game: peer-to-peer - in every match, the machine of one player acts as a server, the others as clients. client-to-server - there is a dedicated server application all players connect to but which doesn't play itself. It is either hosted by you or ...


2

The industry standard network time protocol (NTP) also takes into account the latency of the server processing. This means there are 4 timestamps, one each for send/receive of client/server. when properly calibrated it would look like: t_cr > t_ss > t_sr > t_cs and t_cr - t_ss == t_sr - t_cs That is: the travel time of the packet from client to ...


2

TCP is generally viewed as being slow because of the guarantee of delivery, and the guarantee of delivery in order. When the packet is not received, it has to be resent. It seems that the delay to resend the packet is implementation dependant. If a packet is missing, the software will have to wait for that packet to continue it's process, even if the ...


2

I'm not familiar with Google Play Game Services, however it might be worth looking into how old console games did randomness. Often random number seeds were taken from hidden but not random states within the game and then the numbers come off a hidden list or calculator. What frame of the game's start menu 'start' was hit on. What enemies were killed in the ...


1

Yes this is possible. Less code can mean the executable shrinks. Compiled code is generally pretty compact, so a non-trivial amount of code would need to be removed for the difference to be noticeable. Refactoring or simplifying code has a tendancy to involve removal and this will cause the executable to shrink a bit. This can happen in an update to the ...


1

In the data you send with the message, you include information about what the purpose of the message is. Not just the relevant data. For example, you'd create an enumerate of possible message types: enum MessageType { MovePlayer, AttackPlayer, ChatToPlayer, Disconnect, }; When you send some data related to moving a player, you don't just send the ...


1

The answer to all of these questions is "It depends". 1.) and 2.): There are two types of networking, one is a traditional one, it only has 1 server and every client is connected to this. The data always goes through the server. This is generally considered as the safer method. The other method is called peer-to-peer (or P2P) networking. It doesn't have a ...


1

Get Minecraft Forge Go here: http://files.minecraftforge.net/ Download the MDK (latest is usually best for development) Follow the instructions for setup There's no reason to decompile Minecraft yourself, the Forge team has already done everything that needs to be done and in a way that... Complies with the Minecraft EULA Insures compatibility Prevents ...


1

This implementation shared by Stephen Toub is literally the second Google search result for "blocking queue c#" so don't underestimate the value of doing your own research. ;) Code reproduced below in case the link ever breaks. Comments are mine: using System.Threading; using System.Collections.Generic; class BlockingQueue<T> : IEnumerable<T> ...


1

Figured it out myself. This was a Unity glitch and it has been patched in Unity version 5.6


1

Talking about online games - all logic/collision/actions should be manager on server. (because user is a cheater by default) I understand that maybe one single unit jump with 50-100ms ping will looks weird (as websockets guarantee package delivery, but also a bit slower because works under http). So let's imagine jump logic: user press space (or up) to ...


1

Yes, you'd essentially create a bridge - no wrapper - but that's terminology. The basic idea is to use two network connections. You've got one listen port that will act to the actual game as if it was the actual game server. The bridge will also establish a connection to the real server and pretend to be the actual game client. The rest is pretty simplistic:...


1

The question is rather unclear. How exactly the client should manage info about who he is, if that is just to display on players screen "I'm Mike" or to send out commands "I'm Mike, moving knight from c5 to e6" ? When client connects to a server, it says who he is during login. Then both client and server have that info. Since servers can't trust clients, ...


1

First of all, use tick counts instead of time. There's no good way to synchronize the client and server clocks. You will also have to set a minimum tick rate, if a client fails to match this rate there's not much you can do. Note that this tick rate doesn't have to match the FPS rendered, it could be lower or higher. In order to make sure the client and ...


1

There is a concept called "synchronous networking", that means that all actions in the game are deterministic and thus will return the same result on all devices. If that is a given then you simply execute all actions on all devices in the same order and will end at the same state. onMovePlayerLeft(player): player.X += 1 Now instead of sending over the ...


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