New this week
This week I accomplished the 2 tasks I set last week. Namely Speed control and setup for passive items. I created a passive item and an accompanying temporary effect to test its functionality.
On top of this I added enemies into the other greyboxed tiles and delved into inspector scripts to make this process more efficient. I edited my object pooler to be more performant (with some tradeoffs).
Notification System
I added the speed control to the notification system. When a message is sent a second rate is also sent which multiplies the speed of the animator. Because of the way the development flowed (going from a failed modify the speed every message system to 2 queues, one of strings and one of floats) the system works fine but I am displeased with the overall outcome. Having 2 queues opens up possible errors if the queues were to get misaligned somehow. So, in the future I may convert it to 1 queue of a struct containing both the message and the rate.
Passive item system
Implementing this was almost comedically easy because of how my item system works. And, because its passive, I don’t have to worry about calling it in other scripts. Passive items exist as just another handler but focused more around an update function rather than a titular OnEffect function.
New Items
2 new items were added this past week, a far lesser amount than last week but the items have unique effects.
The first item is the lightning rod. Whilst airborne a damage multiplier builds up and shooting or landing causes and AOE explosion discharging the multiplier with variable damage and range. This item underwent a few iterations. The first iteration involved a fixed damage radius and a threshold. The explosion would not trigger before the airborne time reached a certain value. This, conceptually, was interesting but in testing it was rather annoying. Landing without an explosion or shooting too early just led to the overwhelming of feeling “why is this like this”. So I made it not like this. Now any time airborne causes an explosion but rapid shots or short airtime causes minuscule low damage explosions. Still bonus damage but nothing to count on. On the other hand, if the player finds a way to stay airborne for obscene amounts of time the player can let off a map wide explosion causing unfathomable damage. Currently this is not difficult as surfing on non-walkable surfaces counts as being airborne. I will change this in the future to be a little harder to exploit. I may also re-add the threshold system but at tiny values. This will just prevent extremely fast firing weapons to spawn too many tiny meaningless explosions. The explosion also gives of a temporary sphere just to visualise it.
The second item I added is Second Wings. This item gives the player +1 jump (much like feathered boots) but killing an enemy whilst airborne resets the jump counter mid-air. This, obviously, synergises well with the lightning rod. I may change this item as well though. Resetting jumps is quite an unusual experience as muscle memory can be torn by the number of jumps now available. A possible rework for this item could be +x jumps on airborne kill. This would strengthen the item as an induvial but weaken it in builds already with large amounts of +jumps. This will take far more consideration before deciding.
Tiles and enemies
As I added enemies to the remaining greyboxed tiles I noticed a strange issue. There seems to be something that causes navmesh links to just not work. Maybe the placing of prefabs with links in runtime causes issues, maybe the sheer amount of them causes issues. I’m not sure but I’ve developed a solution. Since there is already a system that enables all the enemies when the player enters the room, I also enable all the navmesh links for that room alone. From my testing so far, this has a 100% success rate, but I don’t know if that’ll hold forever. The act of adding enemies to a tile is really tedious so I made my first ever editor script to solve it.
Editor Script
The previous method of adding enemies to rooms goes as follows: Add enemies in correct positions. Have them all be child gameobjects of organisational empty “— Enemies —”. Assign all those enemies to a list in a script under a sibling gameobject. Disable all the enemies. The act of adding enemies and ensuring they are all appropriately childed is a menial task. But assigning them to a list array and disabling them is rather tedius.
I created an editor script that puts a button under my combat zone script that searches for the “— Enemies —” gameobject and automatically adds all the first depth children to the appropriate array. The name of the organisational object is inherited from the scaffold, so I never have to worry about the name changing. I usually dislike search for gameobjects by their name but since this script does not run during the game’s runtime I don’t see an issue using it. The editor script then determines if the prefab is open as a prefab stage or if its just in a scene. Because this changes the method of saving it. If the prefab is in a prefab stage then the stage is marked dirty and autosaves. If the prefab is in a normal scene then the changes are applied to the root. It is very important to never apply the changes to the root inside a prefab stage. Doing so will override the base template and is difficult to undo if not caught immediately.
Changes to object pooler
Previously the item pooler, when creating a new pooled item, would spawn the entire pool at once. This worked fine for smaller pools but had the potential to cause a lag spike. The new system progressively spawns them over time at quite a fast rate. This should lower the chance of a lag spike occurring and be less intrusive to overall gameplay.
What’s next?
Next, I’m going to add a tile for the treasure room and put the item chest within. Then I’m going to create a template for the boss room because there’s some interesting changes to the procedural generation that will need to happen to properly integrate the boss room.
Leave a comment