The most recent addition to Rail Spirits is a system for giving the player weapon choices and weapon upgrades during a run, as well as two new weapons. I’ve added a video at the end of this post with a demo of the new features.
Making a centralized weapon system
I started with building a weapon dictionary class and scene to have a central repository for all weapon data in the game. The class is basically a bunch of dictionaries and methods that other classes can use to do things like select a weapon’s scene based on an index, pull information (such as what upgrades a weapon can have) for a specific weapon, or get a weapon’s name, description, and image. This class also has dictionaries for the various weapon stats in the game, as well as what data type they are stored as, to make anything involving weapons as easy to scale as possible.
After that, I needed to actually implement weapon stats, since this update involves giving the player the ability to upgrade their weapons. This was by far the trickiest part of the game’s code so far, and took me a while to decide on a good way to implement it. I settled on using separate Godot arrays for the weapon stat values, the increments for the stats, and the modifier for those increments (whether it multiplies, adds, subtracts, etc.) – this way I could use an index to pull stat info and set the stats for weapons dynamically. This method makes it easy to interface with the weapon dictionary (for upgrading stats at checkpoints), as well as iterate through the stats to initialize them when a weapon is added to the player’s cart.
I plan on adding a way to permanently upgrade weapons soon, so I also went ahead and refactored the weapons so that they inherit from a base weapon class, which runs through the weapon stats and, if the weapon has been upgraded, applies the upgraded stats to the weapon. The weapon class also has functions and node variables that the inheriting weapon classes all use.
Adding a checkpoint system
Next, I added a new UI state for when a player reaches a checkpoint. This does two things:
-
- For each weapon the player has on their cart, they are offered an upgrade for a random stat that the weapon can be upgraded on (permanent upgrades upgrade on all of the upgradable stats, while checkpoint upgrades only upgrade on one).
- For each empty weapon slot on the cart, the player is offered a random weapon (based on whether or not the weapon has been unlocked yet, which is determined by a player’s progress in the game).
When the player reaches a checkpoint, the UI displays and populates with these weapon choices, pausing the game in the process. After the player makes a selection, the game is resumed, and the player’s selection is applied to their cart.
New Weapons
Lastly, I worked on adding 2 new weapons with this update:
-
- A weapon that fires homing bullets that automatically head toward the closest enemy.
- A weapon that shoots a wide horizontal arc of energy that passes through enemies.
The homing weapon will still need work done on it later on, since it currently heads directly to the enemy as soon as it is fired, and I’d rather it have some intial velocity in the direction the weapon is pointing first. It also has some weirdness and doesn’t seem to head directly to the center of enemies sometimes, so I’ll have to dig deeper into why that is occurring (I already spent too much time trying to figure it out this past week).
I feel pretty good about how the horizontal arc weapon’s model turned out; I’m not sure if it’ll be the final design (and I’ll be adding textures to it at a later point), but I think I’ll use it as a standard for the upcoming weapons I plan on making. If you’d like to take a better look at it (since the test zone is pretty dark), I’ve added it to my ArtStation portfolio here!
Next Steps
The next thing I’ll be working on will be the majority of the menus the game will have, which will let me work on the progression system where players will be able to permanently upgrade their stats and weapons between runs. I also plan on starting work on enemy models soon. That said, with Monster Hunter Wilds out, and with me wanting to take some time to work on improving my character modeling (since I’ve mostly only made building and objects), it will likely be a while before I make another update here.
Video of the Recent Additions
Stats
User Stories Completed:
31 for this period | 114 total
Bugs Found:
1 for this period | 9 total
Bugs Fixed:
2 for this period | 8 total
Commits:
55 for this period | 224 total
