# Turn based logic, where to store data?

**URL:** <https://forums.unrealengine.com/t/turn-based-logic-where-to-store-data/414889>\
**Category:** Multiplayer & Networking\
**Tags:** database, turn-based, unreal-engine, question\
**Created:** [January 18, 2018, 12:51pm UTC](https://forums.unrealengine.com/t/turn-based-logic-where-to-store-data/414889 "2018-01-18T12:51:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![FinalZer0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@FinalZer0](https://forums.unrealengine.com/u/FinalZer0)\
**Post date:** [January 18, 2018, 12:51pm UTC](https://forums.unrealengine.com/t/turn-based-logic-where-to-store-data/414889/1 "2018-01-18T12:51:21Z")

</div>

Currently i’m making turn-based combat system, but i have encountered a problem.

My game is designed to be played against AI. Both players(controllers) receive 4 pawns. I want to store player data somewhere, but I cannot store it in pawn, because pawns share same data in team. I can’t store data in controller, because AI Controller and Player Controller doesn’t share same parent, so i would have to duplicate everything. Also AI doesn’t have player state. There are no data holders that i can use seperately?

Some other options:  
Instance - Bad to use if i want multiplayer in future.  
GameMode - Bad to use if i want multiplayer in future.  
Database actor object - Lots of casting and have to make logic for data retrieval

---

<div class="post-metadata">

**Author:** ![OptimisticMonkey](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/optimisticmonkey/32/906571_2.png) [@OptimisticMonkey](https://forums.unrealengine.com/u/OptimisticMonkey)\
**Post date:** [January 18, 2018, 1:59pm UTC](https://forums.unrealengine.com/t/turn-based-logic-where-to-store-data/414889/2 "2018-01-18T13:59:03Z")

</div>

GameState and PlayerState are replicated.

> **[Game Mode and Game State](https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Framework/GameMode/)**
>
> Overview of the Game Mode and Game State

---

<div class="post-metadata">

**Author:** ![FinalZer0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@FinalZer0](https://forums.unrealengine.com/u/FinalZer0)\
**Post date:** [January 19, 2018, 3:08pm UTC](https://forums.unrealengine.com/t/turn-based-logic-where-to-store-data/414889/3 "2018-01-19T15:08:33Z")

</div>

I know that they are replicated, but AI Controller does not have PlayerState. Only players have PlayerState. GameState is replicated and i can use it to store some information, but i need to store same kind of information on both controllers (not pawns)

---

<div class="post-metadata">

**Author:** ![FinalZer0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@FinalZer0](https://forums.unrealengine.com/u/FinalZer0)\
**Post date:** [January 23, 2018, 9:07am UTC](https://forums.unrealengine.com/t/turn-based-logic-where-to-store-data/414889/4 "2018-01-23T09:07:01Z")

</div>

I managed to get PlayerState for AI, so i don’t have to duplicate most of my player related data between playercontroller and ai controller. I’m not sure if this is best solution, but it fit me best so i can add multiplayer in future.

This post has instructions for achieving this.

> **[How do you give AI players a PlayerState?](https://forums.unrealengine.com/questions/168533/how-can-i-have-proper-bot-players-with-a-playersta.html)**
>
> I would like to add bot players to my game. Spawning an AIController and making it possess a pawn is not a problem, but how do you give it a PlayerState? There is no way to set a controller's player state, and if you spawn an AIController, it won't...
