Lost on where to put RPG code/variables
So I've looked at a few other posts regarding where to store some stats, but after looking at all the answers I don't know I know enough to store my variables. This is probably because most answers are fairly general-purpose and I am not sure how to translate it to an RPG type of game.
I have many, many more variables similar to these but i'm wondering where each of the above would go. Player State? Player Character? Game State? Game Instance?
And lastly, I am planning of having save-games. I know of the existence of some save slot functions in UE4 but never really got anything working. Thats a whole topic for another post, but the variables that I keep in other places, like PlayerState, do these ALSO need to be stored in a SaveGame (or only in a SaveGame?)
Are things like PlayerState, SaveGame, GameInstance, and GameState things that need to have a blueprint created in my Content, or need to have a Pawn placed in a (or every) level? Or are these transient things that should be created by a blueprint without any sort of persistence (like a blueprint creates a SaveGame, then sets some variables)
Overall I am a bit confused where my variables and blueprint-logic are supposed to go, specifically where to store combat rules (how damage is calculated), where to store my AI (would this be like an enemy's PlayerState?), and where to store general information, like what is in my player's inventory or what level they are.
I am still slowly consuming some of these UE4 tutorials on YouTube, and have seen some on networking/savegames/variables/blueprint classes, but I think most of the general-purpose stuff doesnt quite make sense until you work it into something.
asked Apr 03 '19 at 03:07 AM in Blueprint Scripting
That's a lot of questions! I can try and guide you on some of it, some I am unfamiliar with (multiplayer, although many things will be the same) and others you will honestly just have to figure out on your own because it will be highly specific to your game. So for the things I do know....yes you can parent BPs to share features. I probably wouldn't parent an enemy with the player because they should be different enough and desired in different ways to not warrant that. For example, "get all enemies" may be something you want to do. But I don't know why you would want "get all enemies and friendlies" likely you will only be doing something to one or the other. For something where it really doesn't matter like distance to...."get all actors" would serve just as well. So I would recommend 2 "master" BPs one for friendlies one for enemies and make children from that. Variables you want to save all need to go into a save game object at some point otherwise there is no way to remember the data. If your players will control different characters during gameplay but you want certain abilities to be transferable keep those in a player controller as it won't get destroyed when you switch characters. Things specific to one character can be stored in the character specific BP. Things like player score that may need to be replicated I hear you store those kinds of variables in player state. Game instance holds global variables needed for game play and persists between levels. It is a good place to perform save/load cycles because it is one of the first things to be created when you hit play and the last to go when you quit.
For other basic stuff, or tutorials on save/load, variables, game instance, game mode, interfaces, parenting etc that will be useful to you as you create this RPG game you can check out these beginner tutorials. Might find some answers there too.
As for the other questions, I am sure the community will chime in soon with more help/advice.
answered Apr 03 '19 at 03:28 AM
Nebula Games Inc
Follow this question
Once you sign in you will be able to subscribe for any updates here