Tag Info

Hot answers tagged

5

One of the most common misunderstandings of TCP vs UDP is that TCP's main feature is reliability. The main feature of TCP is that it abstracts a stream of data to send from one socket to another. Reliability, as provided by TCP is a requirement for the abstraction to work, but is not the central idea behind TCP. You might want to consider basing your ...


2

Maps, items, monsters, etc. gives you many factors that can be tipped out of balance by 1 small difference in a floating point operation. A character moves a little bit more to the right, he bumps into another character 1 frame early, then suddenly the whole world implodes and monsters die on some clients but not others. You'll have a much easier life ...


2

It appears what you are going after is called the Peer-to-Peer Lockstep model, according to the relevant article in Gaffer on Games. That is: Each peer runs a separate game simulation Peers share their own player's moves to all other peers (that's the peer-to-peer part) Peers simulate the same game using the same set of inputs, and don't proceed until ...


2

Let me answer your question with another question. Assuming your game is checking for input every frame, you'll be reading input from the user about 30-60 times a second; which means you would be sending about 30-60 packets every second. That's a fair amount of packets to send every second, you might want to consider something more like 1 every 10 frames. ...


2

As for the update frequency it depends from the type of game. For an action type of game 30 updates per seconds should be perfectly smooth, but for an mmorpg (where you have thousands of players) better use something like 10 per second, to save server time. I doubt there will be any reason to have 60 updates per second, that will just use a lot of server ...


1

I think the main problem is that you try to send the whole game state every interval. A better way would be to split the sync into events and states. Events are important things like a spell that gets casted or damage that is dealt. Events need to get send over TCP because such packages are reliable and sequenced. States are components like the position and ...


1

I am not 100% sure that this will solve your problem but it seems that you forgot to register the PositionMessage class. Be sure to register it in the same order on the client and the server and also, do not register the server and client classes.


1

Broadly speaking there are three approaches to rewinding game state (with various flavours in between): reversing/undoing actions, replaying actions from an earlier, fixed state, or storing all states and just picking the right one on demand. The first is more flexible but in the worst case you need to double your work, creating reverse versions of all your ...


1

In the OnServerReady callback the connectionID is passed as -1 to indicate a no connection between server to server. In the connectionID parameter you should pass the connection between the localClient and server using NetworkServer.localConnections. If localConnections return only -1, then it means that you are not connected as localClient. Refer unity docs ...



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