Making a racial system where each race has different starting stats and im having trouble making it especially since there won’t be an actor to set the stats to (or at least I don’t plan on implementing one right now). I’ve made a data table and enumeration but I can’t seem to structure it so it accounts for the race the player would pick. I’m new at this and it’s completely possible I’ve messed something up. So any and all tips would be appreciated and the more detailed the better.
You can use classes, and set a main class for all your characters or actors with all races, then set a sub-class for each specific race. In your main class you can insert the common race parameter variables, and in your sub-classes you can set their default values.
Never messed with classes or sub classes at all, mind elaborating to help me understand it better?
Yes, maybe with blueprints only is not easy to understand classes, but they have classes too! If you make a new Blueprint, it should be derived from a base class, which can be Actor (AActor in C++) or Object (UObject in C++) or other classes. A new Blueprint is essentially a new class, so when you create a new Blueprint, you can choose another Blueprint that you created as a base class, instead of Actor or Object for example.
If you make a base Blueprint class for all your races and then a Blueprint that uses it as parent for each race, you can manage better what you want to do.
So for a 2d game which blueprint should I use? After a bit of research I’m not sure which one would be best, game instance seems like the right one but player state could also work it seems? And would I even need to include actors/characters/pawns in a 2d game?
I suggest you to read this documentation article: Unreal Engine 4 Terminology | Unreal Engine Documentation
all type of classes of the engine are important, that’s not only one blueprint that you should use, and you need to write your code where it’s needed in an efficent way. GameInstance is used for persistent things, while PlayerState or GameState is used for a specific game. The documentation is explaining these things much better than me, so read it, and feel free to ask any question!
Thanks for all the help, made a post about this on the other forum and only got 1 answer but it did help.
"I use a data table with the stats of all my characters. In the event init of the Gameinstance blueprint, i extract all this information and i put it in a table of structs.
In the character or enemies blueprints, i got a variable type enum with the name of enemy. In the beginplay of the characters i get this variable and look for the corresponding struct in the gameinstance, and then i copy everything from there to the character."
Would this kind of thing be possible because after fiddling with the engine it seems like it would be?
It’s a way of doing it, but I wouldn’t have done it in that way. Anyway the GameInstance exists only on the instance where the client or the server are running and it has no replication, so if you want to make a multiplayer game, you should think about that. If you want to save player stats for a single player game, you can use SaveGames (Saving and Loading Your Game | Unreal Engine Documentation) but if you want to make races and save them on the server for multiplayer, you should choose another method. In any case I prefer the class method, but if you want to make a data table and load it, it’s ok, you’re the developer at the end, so it’s your choice!