Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 20 Nov 2008
Offline Last Active May 01 2016 06:37 AM

Topics I've Started

Entities interaction

31 August 2015 - 06:00 AM



this weekend I went back to an old multiplayer prototype I was working on. For now, I render the world state 100ms back in time, and interpolate the server states to compensate for lag and updating the server-controlled entities smoothly. When the client performs an action, I send the action to the server, roll back the server state to match more or less how the client saw it when performing the action, and execute it. Than I send the response back to the client.


Everything seems to work fine, but I have issue when simulating two players interacting with the same entity. Let's assume the entity is a monster, and both players will level up if they kill it.

Player A has a very slow connection, Player B a very fast one. A attacks, and a few milliseconds later B does the same. As long as B has a faster connection, B gets its event to the server earlier, get it processed, kills the monster, get the response and levels up.

While this is happending, the event from A arrives: the state goes back to when the moster was still alive, the monster gets killed again, and the response is sent back to A and B. A levels up (correctly because he killed the moster first), but than B is in this weird state where he leveled up, but the new server state says it never did and I need to somehow rollback.


How do you guys solve normally situation like this one? I could execute the events as they arrive to the server, without rolling back. But than nothing works decently 'cause my game is an action-packed game and I have to keep lag in consideration. Any suggestion?



Server side events and world update

25 May 2015 - 02:43 AM

Hello everyone,


I'm proceeding with my prototype and everything seems to be working fine. Entity interpolation has still some small issues but I think it is something I can skip for now.


My server sends world state updates to the clients 15 times per frame, while the server updates at a fixed 30 frames per second. Some events might happen between the world state sync, and I was wondering if it is usual practice to send these events immediately or if they should be queued and flushed when I send the world update.



Client side prediction

13 May 2015 - 01:06 AM

Hello guys,


in the past few weeks I read a ton of material about networking a multiplayer game, prediction, extrapolation,interpolation and whatever. I tried to implement my own solution to predict the movement of the player-controlled character and make sure it is validated by the server, but I have some jumpy movements that, as far as I understood, shouldn't be there.


What I'm doing right now is pretty simple: every client tick I record the state of the input, assign and incremental ID, and send it to the server. At the same time I simulate the client. When the server receives the command, it simulates it and send back to the client the new position together with the id of the just simulated command. Once the client receives the ACK packet, I assign the server position to the player, and then apply all the commands recorded, starting from the last acknowledged one. World state sync is done with a separate message at lower rate, and does not include the player position.


Simulation runs on both client at server at fixed 30fps for now.


When simulating variable (but still acceptable) latency, the player jumps around a little bit. Is it due to the fact that I should take into account the latency somehow when re-simulating the client commands when I receive the ACK packet?


I thought about two alternatives to solve the issue.


The first one is to set an acceptable distance between the client-side position and the acknowledged one: if we are in this range I keep the client where it is. The server will still be autoritative and all the collision and such will happen correctly, and the client won't notice any jumping around.

Or I could periodically send just the client position to the server, and validate the new position there using simple sweeping to check for collisions and such. As long as the movement is linear from point A to B, it should work fine?


Btw, the prototype I'm working on is something similar to realm of the mad god but with less bullets, just to give you and idea about what I am aiming for ;)




Delta compression

23 April 2013 - 03:52 AM

Hello guys,


in my free time I was delving a bit into multiplayer game programming. I made a simple MMO implementation to try out some concepts, and it is working fine for my needs; for the moment I'm relying on delta compressed messages sent at a fixed rate from the server to the clients whenever an object of interested is changed (interest is based on zones where a player is in ATM).


My question is very simple: now I'm sending a new delta compressed message (or packet if u prefer) for every object that is changed between the last update and the new one. I was wondering if this was a valid approach or if it would be better to send a delta compressed state of the whole region of interest at every server frame.

I believe that packing all the zone state into a single message will make my server logic much more easy to write and debug, but at the same time I fear that I might incur into too much overhead (consider that now I'm delta compressing the data at the binary level and then I'm deflating it again to pack it tightly).


The kind of game I'm working on is a very simple arcade twin stick shooter, with very simple modifiable environment (aka: some static objects can be damaged and then destroyed).


Any thought?



ARM Neon clamping

16 July 2011 - 06:08 AM

Hi guys,

I just started playing around with ARM NEON, and I'm trying to do some simple image processing with it. I was wondering if someone of you knows a way to perform value clamping using NEON instructions.
This is my situation: I have an int32x4_t variable which stores the ARGB components of a single pixel, and I'd like to clamp each component so that it fits to the 0-255 range.
Is it possible somehow to do this operation in parallel using NEON instructions ?