Psi2d a web multiplayer shooting game copes with lag


As a Commander Keen nostalgic (yes I know about NETKEEN) I wanted to do a  2d platformer, with some modernities: it had to be a  multiplayer  shooting, and it had to run on most devices (i.e. mobile friendly).

The last point I solved by implementing a swipe detector that can handle both movement swipes (e.g. swipe left  on the lower part of the canvas => player moves left) and fires (single touche). For what concerned make it mobile friendly, the only option became to use javascript and make a web based game :)

But then I found the biggest osbtacle: lags.

The problem is: player make very fast moves because of the nature of shooting games, and other players will receive its information with about 0.1s  delay! How to cope with it?

This is so far one of the oldest yet one of the most useful resources around: https://developer.valvesoftware.com/wiki/Latency_Compensating_Methods_in_Client/...

To implement it I had to make the client be able to "simulate" the server world as long as it was waiting for updates from the server. This is why I chosen to write the game in node.js (❤️). he same exact code that the server runs to simulate the world was easily run by the client! 

And here I have a nice working version of the game:

https://psi2d.itch.io/psi2d

Leave a comment

Log in with itch.io to leave a comment.