what I’m doing, I’m making a multiplayer shooter game, but im having problems with the camera, i want it to be a camera that doesn’t have to show everyone at once, but when I’ve added cameras in the actions with different numbers and attached to different players it only wants to focus on the person last added to the action list to follow, would anyone know how to fix this?
Can you provide screen shots of your events? It’s hard to visualise what you’ve done based on your brief description.
ive made sure that all the cameras are attached to the correct person and that none of the cameras have the same number for a name
I’m not sure what the camera numbers do, but they don’t mean it’s a separate camera for each object. Moving camera 2 still moves the scene for everyone.
Is your game meant to be played on multiple devices? You haven’t got any code to connect with P2P or to a multiplayer lobby, so it’s not clear what you planning to do or are expecting.
the other code to join a lobby is on another scenes events. what is a P2P, and yes the game is meant to be played on multiple devices.
P2P stands for peer to peer, Connecting one device to another.
If the game is played on multiple devices, then you need to look at the game differently than if it were played with everyone on one screen.
Each player has the same version of the game, and each player wants the camera to be on their character. So you need to program the game so it runs the same for each player, and is played from the player’s perspective. You’ll need to work out which character belongs to the player who has logged into the lobby, and move the camera to that player character.
For example, say you and I were playing, and you’re player 1 and I’m player 2. We both run a copy of the same game. For your version, the events identify your character based on your login, and moves the camera to it. For my version, the same events identify my character based on my login, and moves the camera to my character.
The camera positioning on your copy of the game running on your device does not affect my copy of the game. Your copy is using your character, and anyone else’s is irrelevant.
HTH
The platform or device the game is played on won’t matter. It that the game presents the scene for the player playing it that matters.
do you think you could send a screenshot on how to do it then, or do you think it would be easier for me to follow Gdevelops guide on how to use P2P?
This is a link to the wiki page on using the multiplayer lobby, it has a great video at the beginning.
And here’s how I did it. It’s not good for an unlimited number of players as it doesn’t expand easily, but if you only have a fixed number of players (4 in this case), it’ll be fine:
I created 4 player objects. Each had top down movement behaviour, and each had the MultiplayerObject behaviour. The “Player owning the object” parameter was set to the player number in the object name:
These are the events in my lobby scene:
And these are the events in my MultiplayerGame scene (WhoAmI is the little text box in the top left of the window indicating which player it represents):
And this is how it plays:
thank you so much, i will start working on it in my game tomorrow.