multiple cameras - one for each player

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Tova

i’m creating a multiplayer game and i have multiple players on the same map, and each one of them needs to have its own camera, but there can apparently only be one active camera in a scene

Do you want split-screen?

Zylann | 2018-07-04 19:01

no, it’s online multiplayer

Tova | 2018-07-04 19:07

:bust_in_silhouette: Reply From: eugene

You may want to check the document of Viewports.

i checked it out but i’m not able to make it to work, could you give me a more detailed answer?

Tova | 2018-06-29 15:19

:bust_in_silhouette: Reply From: RODGIMA

i know there are two vertions of Godo, one is server and second is the client.

in that case, every client could have its own camera, and the server make them know the position of each one, by network comunication. Make a server with Godot Server (Linux) and try to comunicate the clients on diferent computers, with their own camera.

:bust_in_silhouette: Reply From: Tova

ok, so for anyone who is interested i managed to do it by attaching a camera node to my player, then instancing that player scene and spawning it in a map, and then in a player script in _ready function i check if is_network_master and execute camera.make_current()
and it works fine for me :slight_smile:

does this have any drawbacks comparing to ** eugene**'s answer (viewports)?

Ankeris | 2019-10-27 18:52

2 years later and that’s exactly what I was looking for :slight_smile: thanks! Btw, did you ever figure out viewports?

Hitri Krtek | 2020-06-30 15:38