Heartbeat and Score


Hello all,

I’m working on a game which would be hosted on a local network, but played as a HTML5 game. I’ve got a small server running on the LAN (which serves the game), and want to monitor player’s scores when they die in this (single player) game. I’ve been thinking about ways to do this, but figured before I jump in and start making things I should check with you guys what would be a recommended approach.

I effectively want the server to maintain a highscore of all games which were played on that LAN.

Currently I am thinking of two options:

I am already comfortable with Colyseus for multiplayer development, and think it’s probably far too much for what I am trying to do.

Any help is greatly appreciated.

Spencer WF



HI @SpencerWF!
Regarding the socket-way of doing it, we recently released a new extension-websocket that should work well to send messages to/from your server.

1 Like


Thank you for linking that Mathias, I’ll have a look. I haven’t looked at this kind of thing before and I want to ensure that people can’t fake a high-score by viewing their client-side page and sending a socket message directly, do you have any recommendations on ensuring that can’t happen? I thought potentially the defold html5-build process would limit a viewer from being able to dig through the code, is this the case?



This will always be a problem with client-server based games. Especially if you don’t have an authoritative server.



I use Colyseus for the multiplayer games I have worked on (which is authoritative), I could just use it for the single-player games and use a very limited subsect of the features of Colyseus. Would that be one of the few potential mitigations? Thank you for the helpful answers Britzl and Mathias.



Yes, having some kind of server side validation will reduce the risk of cheating at least.



Hello @britzl,

I seem to have an issue with Colyseus and Defold, it appears that the “/websocket/client_async.lua” can’t be found, and I was hoping to get an idea from you if the latest update could have caused this issue? (It built fine just before I updated Defold, 1.2.174)




See my reply here: Colyseus and Latest Defold Update