Phaser 3 + Socket.io issues on Azure App Service


#1

Has anyone here run into any issues using Phaser 3 with Socket.io running on an Azure App Service?

I’ve deployed this multi-player game: https://gameapplinux.azurewebsites.net/

It works fine locally but when running on Azure it glitches whenever you collect a star. You will see the star redraw around 8-9 times and the score will increment by 80 or 90 points instead of 10.

The source code can be found here: https://github.com/rayhogan/phaserufomultiplayer

When debugged through the browser I can see that it fires socket.on(‘starCollected’) 8 or 9 times when it should only fire once.

Can anyone shed any light on why?


#2

Are you certain you’re allowed to use port 1337 on Azure?? See this reference

https://www.auditmypc.com/tcp-port-1337.asp
Port 1337 Details


#3

Hi PBMCube

Thanks for getting back to me. The port shouldn’t be the issue, as:

var port = process.env.PORT || 1337;

Is setting it to the correct port when run in Azure and only 1337 when run locally.


#4

From a quick glance, it seems like client sends ‘I got a star’ to the server, which replies with new position for the star. Only after getting the new position will the client remove the star. So obviously if there’s multiple updates before the server replies with the new position, the star is still there, still colliding, and client still sending ‘I got a star’ message.
It didn’t happen locally because there wasn’t any latency.
Destroy the star right away, or remove the collider and it should be fixed.

But ideally you should consider making the game server-authoritative unless you are in environment without possibility of cheating.


#5

Hi Antriel,

I’ve done a quick test and it appears to work when I destroy the star and remove the overlap collider on first collision.

Thanks for taking a look at the code and offering your insight!

Ray