Indie Devlog #2 – Inventory System
Hey everyone, and welcome to this week’s devlog!
If you’re new here, I post weekly devlogs logging the progress of the new game I’m developing, so consider following me to be updated on the progress of my game!
I kicked things off by finishing up rolling and dashing before moving on to new things.
- Dashing now segments the circle instead of being a tangent.
- Distances rolled or dashed now increase when walking or running
- Players cannot roll while aiming or crouching, and can only roll in the direction of movement or when stationary.
- and finally, swiping down while running causes the player to roll or dash in that direction.
I then went on to fix some bugs with my Unity3D assets simple scroll-snap and simple side-menu, and after I submitted the updated versions of my assets, I got back to working on my game.
The first thing I decided I would tackle this week was thinking of how the player would aim and shoot. I decided on using two joysticks. One would be for aiming, and the other for shooting and controlling recoil. I considered making my own joystick component, but then I realized I was trying to reinvent the wheel… so I just downloaded this free joystick asset on the asset store and tweaked the source code slightly, as it didn’t quite fit my needs off the bat.
Next, I started work on the looter aspect of the game. The idea for the players inventory was to implement my own wedge selector system where the player presses down, holds, and then releases to select their wedge.
This must be as streamlined and intuitive as possible, because it’s a mobile game.
Both the weapons and consumables had to be selected, used, canceled and swapped this way, so I had a lot of work cut out for me…
after finalizing the base of the component, I moved on to actually adding the items that could be selected. Before I could do that though, I needed to create the class structure and system for adding new items to the game. An example of an item would be a gun which, has a predefined magazine capacity, recoil spread, muzzle velocity, etc… which can all be modified to create new items that can now be used in the game.
I then made it so that the wedge selectors populated the different items in the player’s inventory, and showed the quantity of the throwables or consumables, and the number of bullets for guns.
I started with the progress system, which would show the progress when swapping to a different weapon, reloading a gun or using a consumable.
Once I was happy with that, I started working on a system to be able to cancel the progress made by clicking on the wedge selector while it is in progress.
I downloaded a couple of placeholder animations from mixamo.com, and began working on a system that would allow for the swapping of weapons and using of consumables. In order for a successful weapon swap to happen, the player must put away their current weapon in their selected weapon slot, and then take out the weapon in their targeted weapon slot. For consumables, this is a bit trickier, as they have to put away their selected weapon, use the consumable, and then finally take out the selected weapon again. I achieved this by creating a system where you could queue up actions, and then dequeue each action until none are left in the queue.
That was the easy part…
The problems poured in when I needed to figure out a system of how to cancel actions. You see… when actions are canceled, you can’t just drop the item you’re holding, you need to reverse the animation, and then check the action history stack to see what your previously selected was.
I finally managed to implement this, however it was definitely easier said than done… Players could now cancel actions midway, and revert back to their original state. Next up I got to work on matching the players actions to the wedge selector, so that it could show the current progress, and allow the players to accurately cancel the actions. Another thing easier said than done, but I eventually got it right, and I was happy with how it all turned out!
So that’s what I managed to achieve this week if you’re new, I’d encourage you to follow, and give feedback in the comment section below! Tell me what you like, what you don’t like, and what you want to see for the future of this game!
Anyway, thanks so much for reading, and I’ll see you in the next one!