Skip to content

Why is running Phaser on the server "something you really shouldn't do"? #6037

@LZoog

Description

@LZoog

Sorry in advance if this should be on StackOverflow or Phaser Forums. I'm filing this here since it might be a feature request, or just a request to update the documentation here with more details.

I'm using NextJS which allows my application to be rendered server-side. After searching for React + Phaser integration opens, I found this issue in ion-phaser, and was able to get the page with my Phaser app working by disabling SSR for that page (see this comment).

In that issue, I mention that I'm interested in getting it server-rendered, to which two others responded similarly, and I've also found similar questions online, making me believe this isn't an uncommon ask. I found this blog post on phasertutorials.com on a similarly asked question on Phaser Discourse and one or two other tutorials which I was planning on exploring, but this recommends setting up Phaser on the server in 'Headless' mode and as pointed out in a comment on that ion-phaser issue, the documentation specifically states, "This mode is meant for unit testing, not for running Phaser on the server, which is something you really shouldn't do."

It seems like it would be best practice to keep the state of the game on the client synced with a state on the server to validate client actions and prevent cheating. If not, how do you verify client actions are legit?

Someone else asked this question 3 1/2 years ago and didn't seem to get a satisfactory response ("you can add random code to ping your server with checksums" seems a bit messy), and a comment on a different post mentions, "Scaling would be a PITA.", but it's 6 years old and I'm not sure how accurate that is.

If it's not best practice to set it up in headless mode to run on a server, what's recommended?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions