Hi everyone. So I’m still pretty new to unreal engine 4. After a few weeks I’m finding I really have to adapt my normal thinking process for software architecture when working in UE4 and I wanted to get some thoughts and opinions on everyone else’s thinking process. Keep in mind though that I am only an intermediate level C++ programmer with just a couple years experience. I’ll try and keep things simple by focusing on the ideas of encapsulation and the single responsibility principle when designing my overall game class structure.
Let’s take an example. Say I want to create a player character class in C++ so I go ahead and derive my C++ class from UE4’s Character class. I now have my PlayerCharacter with an inherited movement component class. But say I want to create my own custom movement logic for the character in C++. In UE4 fashion it’s usually best to inherit first from one of it’s base classes, in this case movement component, and then maybe attach it to your character via blueprints or something else (instead of manually changing the actual movement component C++ class inside UE4). If I do this though I now have extra duplicate code logic, two separate movement components, which is unnecessary.
I will always want to separate logic where appropriate in order to not have one class with multiple responsibilities since that can lead to hard to read and maintain code. My question is is it better then to start simple, maybe with just a pawn class, and then add all the components I believe add need separately instead of specifying a more specific class early on in the design process? If so, then what are the situations where you would want to have some character C++ classes instead? In my mind I guess the character class (as well as other classes) are there for flexibility and ease of use. However it seems this flexibility and ease of use would come as a trade off for stability and maintainability. Please let me know if you think what I’m saying makes sense or that I just don’t understand how to use UE4 properly yet which just may be. Thanks for any help on this topic.