From the start up I have been in charge of programming everything that has to do with the character itself, I implemented weapons and weapon switching several weeks ago so we could get a proper gameplay loop up and running , but this wasn’t really suited for a full game, most stuff was hardcoded etc.
The last 2 weeks I worked together with frederic to get a proper inventory up and running. While he made the graphical side and worked on the inventory management , I started rewriting the character code so it interacts with the inventory correctly. Now we almost have a fully working inventory in which everything is working independently . with a bit of tweaking i think most blueprints could be used in different games entirely.
First up our character now has 2 hands and thus 2 equipped slots , these just need a “base_weapon” , when something gets equipped it gets dropped in the right hand. Drop it in the left hand and it gets mirrored correctly and can be used by pressing the left mouse button , idem for the right hand . This essentially allows you to dual-wield any combination of one-handed weapons. To balance this , we only allow you to use a weapon’s “secondary” ability if you only have this weapon equipped, with the most obvious use of this being aiming down the sights of a gun. We will also be implementing 2-handed weapons (rifles , big axes?) .
As a final note I would like to express my thoughts on the way blueprint programming works in UE4. I really see this as one the greatest tools there is in the UE4 engine for modular programming, it really opened my eyes to using inheritance in gameplay programming and I think it is vital for our game and has saved us a ton of trouble. For example , the way our pickups etc work. Let’s say our axe (Interactable->Base_weapon->Weapon_Axe) interactable allows us to interact with it in the world , if it’s a base weapon , we know we can equip it and weapon_Axe essentially contains the information for “firing” the weapon. Looking at a lightswitch (Interactable->Lighswitch_A) , here we can see it is just an interactable , the lightswitch code on “activate” just simply switches a light , other interactable items can be added to the inventory on the “activate” event , see keys etc.
So , this was a wall of text, I tried to make up for not writing anything last week and implementing that in this post.