I’m having a hard time figuring out how to make a controller/player setup for a turn based local multiplayer game, similar to Heroes of Might and Magic, in blueprints.
Aim
- In short, multiple human players (and AIs) taking turn in controlling their set of pawns.
- I’d like to use classes like Player and Player State to be able to later add online multiplayer as well, without major rewrite.
My attempt
When I’m making multiple Players (Create Player node) to get Player State for each (to hold player data), I’m getting multiple controllers as well. That’s working fine, but when I try to switch Controller ID to pass the controls of keyboard and mouse (ID 0), the engine crashes. I tried setting the previous controller to -1 to avoid both having 0, but that didn’t help, still crashes.
Using one controller?
So I’m thinking that maybe I should use just one Player Controller (ID 0), and only switch Player States. But I’m not finding a way to change the State at runtime, in blueprints. Is it even possible? Or where else should I keep the data for each player, so it’s easy to be replicated, later on when I try adding online play.
Thanks for any advice.