Q :
Hello all!
I feel like this is a pretty simple one, but I can’t wrap my head around it.
In a multiplayer game with a dedicated server and multiple players in the level, what will GetPlayerController(0) return?
What if it’s not a dedicated server game?
Is the answer different when the code runs on the server or on each of the clients?
My first guess is that the first player spawned into the level has the index 0. My second guess is that the index 0 is always with the “local” player for clients; not sure what it would be for the server. I’m edging towards guess 1 at the moment.
A :
Player 0 is the first player created on the machine that is running the code.
So if you have 2 players on the Server and 2 players on a client and 2 players on another client for a total of 6 players in the game over 3 computers,
then the server’s 2 players will be at index 0 and 1,
and client A’s 2 players will be at index 0 and 1 on their machine. they will also be on the server’s machine but who knows what index they’ll be at there, and they’ll have IDs of -1 because they dont belong to the server machine.
client B, exact same situation.
So server will see 6 player controllers but only its own will have IDs >= 0 the others have IDs == -1
Each client will only see its own playercontrollers.
'게임엔진(GameEngine) > Unreal4' 카테고리의 다른 글
순수 가상함수 사용 한는 방법? (0) | 2022.08.26 |
---|---|
This Repository shows a Code Example of how to use UE4 Online Subsystem Sessions in C++. (0) | 2022.08.04 |
UE4 Get IP Adress C++ (0) | 2022.07.22 |
UFUNCTION BlueprintCallable, BlueprintImplementableEvent, .. (0) | 2022.07.19 |
블루프린트에서의 멀티플레이어 (0) | 2022.07.13 |