Replies: 2 comments
-
Existing discussion from many years ago, but one that I always think back to when ever this question comes up, and think it holds up even today as a valid answer: Running Phaser on Node.js - How I did it and why you shouldn't do it |
Beta Was this translation helpful? Give feedback.
-
@Arcanorum thank you for the link 👍 I hadn't come across that one in my search and there's some helpful links in there. Some are saying that it's bandwidth and too resource-intensive. I wonder if anyone has benchmarks? There's some interesting comments (especially on page two) that talk about running it successfully:
and this one:
It seems like there's a few other architectural options to explore from that link you provided that I'd like to look into a little more closely. I guess there's not any Phaser docs on best practices for this (please correct me if I'm wrong), which is what I think would be ideal. I'm also a little confused as to why the blog post I linked with this tutorial is on phasertutorials.com if it's bad practice, but I suppose I don't know if they're directly affiliated with Phaser or not. |
Beta Was this translation helpful? Give feedback.
-
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?
Beta Was this translation helpful? Give feedback.
All reactions