Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Steamworks.gml example

Sample project for Steam-based networking for GameMaker. · By YellowAfterlife

How to handle death of vessels ?

A topic by MeLikePixels created Aug 20, 2017 Views: 668 Replies: 9
Viewing posts 1 to 10

Hello

first thank you for your incredible job. This is amazing and helping me a lot to create a multiplayer game on steam with gamemaker.

I am trying to handle death of vessels. I wonder where should I do that :

1°) the first possibility is to handle that on the client side. Each client checks if his vessel receive a bullet and then if it is the case, send a packet to server to say he is dead. Here I wonder if this would create some syncrnizing problems but I am not sure since I am very new to this kind of problematic.

2°) the second possibility is to do it on the server side, once we have receive a packet (player move or bullet move...) we chack if one of the vessels is dead. If it is the case, we send a packet to all clients to say a vessel is dead.

Developer(+1)

It is hard to give advice without knowing what the game's like, but, in general:

  • In cooperative games, clients are usually allowed to check their own collisions, notifying the server when they get hit (and by what), as you want the game to favor the players and for players just generally have fun.
  • In competitive games, all checks and additional logic are usually done on server, as you want the game to be as fair as possible and to leave fewer opportunities for anyone to cheat. Exceptions are sometimes made for instantly-hitting  projectiles (laser beams, etc.), where damage is dealt if the player was certainly aiming right at the enemy on their side.

Thank you very much, this is very clear.

I have read a few articles about how to handle latency exposing some mehtods  to deal with that : prediction, reconciliation, interpolation.

http://www.gabrielgambetta.com/client-side-prediction-live-demo.html

For now, I have tested your extension with two computers on the same internet connection. Each one has a different steam account. I dont have implemented any of the methods cited before (prediction ,reconciliatiob, interpolation) but I do not see any lag for now. I wonder if the packets are send locally or if they transit trought steam. In the first case, this is not good because I am not testing the game in real conditions. Then how is it possible to test a multiplayer game with gamemaker with simulated lag ?


Developer(+1)

You would generally use something like Clumsy to artificially add lag on packets. Standard utility "netstat" can be used to figure out how and where Steam sends the packets (so that you know how to set up the filter condition in Clumsy).

Great. Thank you.

I wonder how to code the lag compensation trick because current_time is a local variable (it depends on when the client has started his OS).

Developer (1 edit) (+1)

Lag compensation shouldn't be affected by offset  of current_time, as time measurements would be entirely relative (to time when previous information arrived).

Thank you very much. I am developping a multiplayer game which look like nuclear throne for less than 10 players. Do you think I have to implement advanced technics like lag compensation and so on ? Or is it enough to only send states variable when an input command is pressed locally (send the satte variable, not the input) and then the server modify the true state game and send this to every client  ? I am very new, so maybe I am saying bad things... ?

About your answer, I understand what you say. Therefore, the lag compensation trick only works if the latency is the same all the time, which is generally the case.  However this technic needs that every client send packets regularly, lets say every 3 steps for example, otherwise you can not rebuild the full scene ? Right ?

Developer(+1)

Not necessarily advanced, but you would want a bit of extrapolation and interpolation - have the objects move in last reported direction (with steady velocity) while there's no data, and smooth out that predicted position to the actual one over a few frames when the information about the current position arrives.

For things like fired projectiles, you would only need to transmit initial velocity and impact position - the rest can be played out client-side.

I'd generally suggest to not go with "sending inputs only" - that implies input delay, which is not a thing to impose on players without a good reason. Sending the complete or changed state every frame is also a big task in itself.

You can also check out older blog posts on Monsters & Monocles' developer blog for various notes on networking in games of this.

Ok, to summarize, tell me if I am wrong, what I have to do :

1°) Send changed state variables to server only when it is triggered (for exemple, one client press up, , then u send the new y position of the object) and not every frame because it costs too much

2°) Use extrapolation and interpolation on client side in order to smooth a little bit the movement of other players

3°) Dont use lag compensation because it is a small game.

Finally, I wonder if it wouldnt be better to use fast protocole (UDP) instead of reliable (TCP) ? Indeed, with interpolation and extrapolation , it is not a problem anymore if a few apckets are missing ? What do u think ? In ur example, u have set everything to reliable.

Anyway, thank you a lot, I will try that.