Stabby
đź“… 2023-04-21
Full disclosure: Bad mental health day. Whoops. The rule is you should load Unity up and do things even if you’re not feeling it, and the same goes with these development blogs. So okay, I loaded Unity up, and since I had an appointment today and couldn’t commit to systems, and was feeling stabby, I figured I’d wire up some of the inventory items that have yet to be wired up. Specifically, the knife.
And if you’ve been following development, I’ve been using HFPS, or Horror First Person Uhh… I don’t know what the S stands for? Could it really be shooter? Anyway, I refer to it as Horror Kit, and it’s a pretty stock standard little Unity / Unreal premade that comes with a few systems to help people get started. For a whopping 50 big ones - USD - you get a collection of systems that, theoretically, could be added to your game so you don’t have to reinvent the wheel for basic shit like a decent character controller, a menu system, an inventory system, a save / load system, a footstep system, rigidbody dragger, and some premade UI stuff. This would be great because a lot of those systems, specifically the inventory and save load systems, are boring as fuck to make. Or, it would have been great, if it were built like actual middle-ware and was actually modular.
Unfortunately, every system it comes with is so tightly wound into the other systems with dependencies, prying one system from another requires more work than it’s worth. The inventory is not customizable without stripping out giant chunks of functionality and ripping it apart, despite me liking some of the custom editor stuff that works with it. The player to UI dependency, each with roughly 10 scripts that CANNOT be removed even if you dont need the systems, breaks the entire thing if you even dare to change certain things. It’s awful, I could not recommend it less, for those thinking of spending some cash on it. Don’t.
I spent so much time during the development of November going through the code line by line, to try and pull it apart. And it feels as if it’s been purposefully designed that way too, like they hide functionality across several editor scripts so if you want to find out how to do anything, you need to open a dozen scripts and slowly follow the upside down logic used to make it all work. I admit I haven’t worked with a lot of professional programmers, but if I had to do code review on these scripts, I’d tell them to go home and rewrite it from the ground up.
Wow, anyway, this isn’t meant to be a review. Just… just dont fucking buy it. It would be way easier to look at the list of features, and buy cheaper systems that do the same thing so you can have some sort of modularity to how it all works. It’s also a buggy mess, out of the box it’s riddled with bugs, and of course it is, because it’s a giant ball of dependences. Want to use their health system? Be prepared to also have to use 19 other scripts spread across 30 parts of your player model so it can function - oh, you don’t want to use those other 19 systems? Well, fuck you.
Okay I’m mad. Sorry, like I said, bad mental health day. The thing has mixed reviews, some people seem to like it, if it works for you - gravy. You get the gist. And to be honest, the only reason I’ve not ripped it out entirely is because a) sunk loss fallacy - I spent the money, I should get some use out of it, and b) the inventory system is actually okay, once you spend 30 hours learning how it works, across the 40 scripts that it requires. I haven’t ripped apart the inventory system yet like I had with November, but it’ll be something I have to do eventually because I need more functionality, and I need the UI to look like anything other than RE3R.
If you’re playing an indie horror game with a lantern and an RE3R inventory, chances are you’re playing a game by somebody who got duped by the Horror FPS Kit peeps. Duped is harsh. Swindled? I don’t know, it does what it says on the box, but its so rigid that it ONLY does what it says on the box. I’ll stop complaining.
Why do I bring this up? Because today I decided to rip apart some of the systems functionality so I can wire up some unique items - that is, a knife, a screwdriver, a crowbar, and a hand shovel. I don’t even want to get into the intricacies of why this is so difficult with Horror Kit, because I have a custom character model, and I have a game with working mirrors, so I can’t use the method they are using for holding items in front of the camera - that is, if you activate a weapon, a giant floating arm spawns out of your body, holding the inventory item. Very normal.
Of course, this is a method that isn’t uncommon in first person shooters, but trying to customize it in Horror Kit is a pain. Firstly, while the documentation is all of 10 pages, they do have a section about changing your character model over to work with the labyrinthine dependencies within the system. Of course, this does NOT include the item switcher arm/item combos. So if you’re using a female player character, get ready to have giant burly masculine arms holding all your items. My girl buff as fuck. Luckily, I had already converted the candle over to just a normal animation mask over the character models hand, and ripped apart half of the system to make it work with other items properly. So todays task of taking the preset buff man items and changing it so I can actually have some usable held items, wasn’t too wild a task.
So I don’t need the pistol, or the shotgun, I don’t have the energy to deal with a two handed axe, the lantern is played the fuck out, and I already have the candle, so I figured let’s just convert over the flashlight as a test run because it’s been a month since I did the candle. First, I went in and ripped out the flashlight from the hands of buffman that was glued to the camera, and I placed it in the rig of our main character.
I went in and “fixed” the flashlight for HDRP by ripping out all of the parts of the flashlight script that referred to the actual light itself, because I tried to convert it over to HDRP but something somewhere in the nightmare of code dependences was causing the light to disable constantly, even when I coded out half the script. I then decided to rip out all the other functionality because I really disliked how it worked - plus, batteries? What is this Alan Wake, lets leave that game trope in 2010 or whenever that game came out, I dont need it.
I then made a new animation that only affected the main character’s left arm, since we’ll be using an avatar mask like we did with the candle, to blend it over the other animation states.
Very simple, we need almost unnoticeable animation over a long period of time, just to avoid things feeling too static. I then threw the animation into the animator on the arm layer, created a simple bool paramater “Flashlight” and rewrote the arm weight code a little to make it work better.
And hey presto, we have the flashlight working, or at least, it did?
Okay so something broke while writing this. Fun. Hang on, let me reload Unity. Lmao, okay that one was on Unity, you’re off the hook this time Horror Kit. But I’m watching you. But yes, it works, ta-da! Oh nevermind, it broke again. Ahh, it was Horror Kit - I disabled the old camera items after I turned them on to show them off all at once above, and the whole thing broke. Anyway, got it working.
So it works if you use the hotkey. But. get this, right? You can equip items in the inventory, but you cant UNequip items in the inventory. How about that. You can equip a new item, but the only way to unequip an item you’re holding in Horror kit is to DROP the item completely. Like, why fam. Oh, and here’s another error that you get sometimes, the lantern just never turns off, even when you switch items or use the hotkey.
Anyway, I’ve been complaining for way too long. After I got the flashlight working, I went through and added the new items, basically this meant adjusting the inventory items for each one to connect to the prebuilt item switcher, dragging the items to the hand position on the model, removing all the inventory scripts so it was just the model, and writing up a new item switch code for each item - I basically just emptied out the flashlight script and duplicated it 4 times, and then made it work for each new item. I could have written something more universal but eh, I just wanted it to work.
Then I went through and did a new animation for each item, added it to the animator, connected the transitions via a simple bool, and voila, we’re cooking with gas. Of course, we still have the issues that the Horror kit just has built in, I cant unequip items unless I switch to a new item, which sucks. There’s also some timing issues with it, but hey it works.
Also I guess you get to see a preview of what the new inventory is looking like, for those that might care. But that was my day in Unity, not a huge amount done - to extend it, I need to fix the inventory issues, and then add another animation to the screwdriver, knife, shovel, and crowbar, so we can actually use them. Apologies for being such a whiny bitch today, it be do like that sometimes.