How to define a pawn owner on pawn spawn?

Kaffeetrinker
Sat, 19 Nov 2016 19:09:52 +0000
Multiplayer & Networking

Hi!

I’m building an RTS like game and I’ve run into some struggeling.

I want to place a building which spawns pawns. For singleplayer, no problem.

Now I want to add multiple players and this question came up: how to know, who owns which pawn?

My first thought was to add a PlayerID property to all buildings (Actors) and units (Pawns) and copy playercontroller->player state->player id into that.

Is this the right approach or is there already a better way in UE4 to differentiate between which player controlls which pawns/actors?

Also please keep in mind, in the future, AI controlled players should be possible (have their own Player ID).

C++/Blueprint is both ok.

Thanks!

3 posts - 1 participant