How do I coordinate scenery through Photon?

0 favourites
  • 5 posts
  • Hi,

    I've been using the photon network plugin for a few days. I want to populate space with asteroids, I create them at random coordinates, I save it in the room cache, when another player enters, they get asteroids but in different places.

    How do I coordinate the positions of the asteroids between all the players?

  • Without seeing your project code, it sounds like your client is running code that should only be run by the server. When the client connects, does it run the code to randomly set the position of the asteroids or does it get the position from the server and just set the asteroids using that information?

  • InDWrekt You are 100% correct the client is running the code, how do I run this function from the server?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ok, just a real quick rundown. The instance of the game that is the server/host should be the only instance that decides where objects are, the state they are in and the actions they are taking. It should then send out a packet of information to all connected clients updating them with all the information they need to display properly.

    All client instances should only collect user input and send it to the server, receive updates from the server and draw the clients viewport from the updated information.

    How do you do this? Well, there are LOTs of different ways to handle it. Some games have a separate program that just runs as a server with all the server code and a client program with just the send/receive/update code. Others use a variable which defines if the current instance is the client or the server and runs the necessary code accordingly. Construct has an IsHost expression that can be used for this.

    Unfortunately, you are going to have to evaluate what will work best for your specific project.

  • InDWrekt I'm not using Construct's multiplayer plugin, I'm using Photon's.

    I understand your reply, but if I were using the native plugin.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)