Jump to content

Phaser 3 on server side to validate client actions


Damian Pastorini
 Share

Recommended Posts

Hi everyone, I was looking for some info about this but didn't find any so far...

Does anyone had worked with Phaser 3 on the server side?

What I'm looking for is to move scenes logic on the server to avoid client side hacks.

I've tried to create a Phaser game instance on the server but I'm getting a lot of errors like "window not defined"' and so, since it all the code seems to be deeply related to the browser.

Maybe I can call just the scenes or the physics classes?

Any recommendations will be appreciated!

Thanks!

Link to comment
Share on other sites

A few more notes:

  • I'm looking to validate players position, since speed values could be changed on client side, to get for example a faster player or a faster attack, also collisions, to validate range attacks, titled maps walking areas, etc.
  • I know I could find other solutions to avoid use a full Phaser instance on server side (I mean not using Phaser), since I'm already loading scenes data from the DB. So, I could for example validate the walk area on the map, or when to change scenes (in my case maps), but since Phaser has all these already "calculated" I though that could be easier to re-use the game and scenes instances.
  • Doing some research I recently found the following:
    http://www.html5gamedevs.com/topic/20587-how-to-make-a-phaser-game-running-on-the-server-side/ > but here none recommends to use Phaser on server side.
    https://medium.com/@16patsle/running-phaser-3-on-the-server-4c0d09ffd5e6 > and so far I wasn't able to make this second example work as I need (still getting Phaser issues while trying to create a HEADLESS game instance).
  • I've also found that I could use http://zombie.js.org but again looks like an overload of work / server resources to just get positions, collisions, etc, which are all pretty basic features.
Link to comment
Share on other sites

Hi @presidenten , that's even more overhead on the server, for that matter I would use just headless Phaser but now I'm looking into just get the physics from it to validate actions.

P2js looks as a good option but is been a bit complex to understand for me so far.

I'll be posting as soon I get something good working.

Best,

Link to comment
Share on other sites

Not sure if this make sense since Phaser is a client side app and all exposed Javascript. Running it in puppeteer on server would be formidable task.

You can  obfuscate the Phaser bundle, so you make it difficult for someone to hack it. In addition, you can add random code to ping your server with checksums, so when the user restarts a game  just reload a new version from the server and verify immediately the new checksum. This way it throws off hackers. Anyone who cheats, ban them. 

Another option is to have code on your server end that validates reasonable ranges of physics and transforms. 

Unfortunately, Javascript is patchable by determined hackers. So you need to play cat and mouse.

You may also be able to employ blockchain. Here is a link that may give you ideas. https://loomx.io/developers/en/ 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...