Datahandling: Structs or Class
I run into a problem of my experience in c++ and unreal engine.
In my game, the user can create (local) multiple players, which putted in an array. The last created user will be the "activePlayer" (you can switch the activePlayer by choosing on other in the GUI). From there, the active player have a levelprogress, which stores the highscores of these players, the items, level and much more.
Now is my question, actually I have this two things (Player, LevelProgress) in structs. My savegame contains an array of Player and each player have a LevelProgress. The active player is also an Player. It would be better, if I have the activePlayer as an ID/GUID, so I can just pick thrue this out of array and edit if something changes.
When I put a propertie like GUID or ID into the Player it wont work.
There must be a better solution, then always do a "make struct" and "break struct" and save new to array or context istnt very useful.
How do you handle this data in your project (in big projects).
Structs would be nice, because I've a REST API with JSON. And only structs can be converted directly to json.
I come from JAVA, C# world, so for me there are Entities or DTO, which I easely can create with "new Player()" and have an instance of this object with his own data and can reference it anywhere I want with the GUID / ID.
asked Jul 22 '15 at 11:26 AM in C++ Programming
Follow this question
Once you sign in you will be able to subscribe for any updates here