Unreal - Structing my weapon Creation workflow (WIP)
Howdy! This post I wanted to talk about my weapon system workflow. Previously I determined how to code combat animations into my game using montage (which hopefully no repercussions down the road), But that's only the beginning. Yes I need enemies and I need to code combat, But I don't want to have just one way to fight with my fists - I want multiple weapons! MANY weapons! And how do I get there?
In board terms, this is pretty straight forward - I just need to make a data table with all of the weapons I want. When my character selects a weapon, they pull it from the data table, and pull the necessary data.
EASYYYY.... right? Unfortunately it can't be that simple. For two reasons: one, The more data we try to compact into a data table/class, the more confusing it becomes. Plus, some data is not directly associated with other parts. For example, a weapon's Attack data only has a limited association with the animation. Different people using the same weapon might have different animations.
For this, I started curating a system of where to put data where for different classes. It's still a work in progress, but It does like this.
There's a UObject called WeaponBase; it holds all of the data of the weapon, and serves as the Weapon Object. The reason it has a class and isn't just a BP struct is that this class can help curate the data the player needs. It also can hold attack functions. Can, as the attacking data has to be handled within an actor component of some sort due to montages.
For our intents an purposes, it's essentially a struct. When the player starts, they load a weapon UObject.
They then fill out two data tables; DT Weapon Attacks, and MetaData. As I'm writing this, I think I'm going to resturecutre it so everything is in one data table - going back on what I said previously, I think that I'm trying too hard to mke the data table readable, when having multiple data tables is just confusing.
However, I will keep animations in a separate data table. That's the key thing; when the player wants to attack, they call the weaponbase to get what type of attack comes next. The Player uses the attack name/data to get the animation, as for different characters this could be different.
I'm actually going to stop here because I want to restructure this to be simpler; I will update this once I make the data tables better. As you can see in the top image, I'm using 3 when I really should only need one. I'll still post this just to inform people this is one thing I'm working on.
Comments
Post a Comment