Jump to content

Velocity makes objects stop moving if you click off the screen.


spacely_j
 Share

Recommended Posts

So im making a multiplayer game, and the projectile uses velocity. but when a projectile is spawned, a player can just click off the screen to stop the projectile from continuing and it wont continue its path until the player clicks their screen again. 

 

This behavior would be okay for a single player game, but for multiplayer i want everything synced up. is there a way to make it so the velocity wont freeze when you click off the screen?

Link to comment
Share on other sites

There's this rule out there, "Don't trust the client." I don't think it always applies -- if I were making a game meant to be played on a network against your friends then who cares; if your friends cheat you can yell at them or cheat back or something.

 

But if you're making a multiplayer game for arbitrary Internet players to play against each other then you probably don't want to trust their browsers to tell you the state of the physics world.

Link to comment
Share on other sites

I agree with Dr Hayes, and to expand on this: the only time I ever played with making a multiplayer web game I found some success in using one instance of Phaser purely to render on the frontend, and one instance purely to calculate physics on the backend (I was using NodeJS for the backend with websockets).  This is kind of bloaty, because you're using half of two instances of Phaser, but it got the job done for a simple game.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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