- Published on
Weekly GameDev Standup - 4
- Authors
- Name
- Ryan Flores
- @_TrustyTea
Shmup
Hello and welcome back to another GameDev Standup! It's been a little over 2 weeks since my last post and video, but today I have some cool stuff to talk about. The format of this blog is going to be a little different, I used the DevLog app I made last week while I worked on the game to generate these "sessions". So instead of a formal blog post, this will read how I did things, what problems I ran into and solutions I may have come up with. If you have any suggestions or feedback on this format, please let me know in the comments!
Adding StatusEffects
Opening Notes: I started by creating the "StatusEffectManager" class, which is going to be a small clone of the "StatsMediator" class.
Entries:
- I created a list of stats in the manager class, which I'll use to tick down on the Character class. Then I copy the flow of the Stats from the StatsMediator class, which marks a StatusEffect for removal when the timer is done. Otherwise, we keep ticking it down.
- I gave the StatusEffect fields for VFX if it wants, and duration/amount. I'm going to be making this pretty simple, so nothing can affect the duration. It'll be a flat amount per second.
- Right now I just want to verify that this system works before making it more designer friendly.
- I have the timer do "Amount/Duration" damage each tick. I'll make an editor to make this clearer, so it'll say something like "Does X damage over X seconds." or similar.
- Running into a problem where the projectiles aren't applying the status effects. I'm not sure where to at this point, I'm adding some logs to see if I can catch anything but nothing is showing up yet.
- WOW. What a dumb mistake. As always. Guess what? Copying and pasting part of your code to replicate often leads to unintended behavior, who knew! I copied the if statement on the StatMediators, which checked if it was populated, then continue (it was an inverted if statement)... so I was checking if the list had values, well... don't do anything. Fixed that and... I now know that the effects are being added, now I need to make sure that they are actually doing damage now.
- I need to tidy up the way I do damage. This spot I use negative numbers, but on abilities, I use positive numbers, so I was healing the enemies with the status effect at first, but now everything is working as intended! I can hook up the VFX if I want and it should be good to go. Thinking about it now too, I might have to create a new type of ability, one that can heal overtime. Or damage themselves over time? Would be an interesting idea to explore for a class design...
Closing Notes: That's it for this session, I feel a cold coming on, I'm going to wrap it up shortly here. I honestly expected this to take me a little while longer, but I managed to build it up quite quickly, and in what I'd say a relatively clean way too. Sure there are some rough spots, but that'll be my next session. Clean up time!
Adding Items
Opening Notes: I am going to start by figuring out how I want to implement this, going to tinker around, but thinking about doing ScriptableObjects to start with. We shall see.
Entries:
- Before I begin, I was thinking about making items 2 types. Passive and Active items. Passive meaning it's a basic item like "Gain 25% Move Speed", and active "Every time you hit an enemy, you have a 10% chance to shoot a mini fireball". Something with conditions and triggers.
- I'm not going to think about that right now. I'll implement the most basic item first, then expand upon it.
- I'm going to create a new class to manage items. "Inventory" sounds like a nice name for now.
- There is a small bug right now, stat modifiers aren't working, which is what I'm relying on to work for these basic items.
- I figured it out. It's because I'm messing around with speed, but I don't actually ever change the speed because it's on a separate class, I just need to hook it up somehow.
- Now it's causing stack overflows, wtf. I'm going to bed.
Closing Notes: Idk what happened here. I thought it would be easy enough to implement this basic item, but things are breaking now and it sucks. I have to return to this when I have more energy, it's time for bed now.
Fixing Items
Opening Notes: I fixed the StackOverflow, there was an infinite loop happening with the UnityEvent being invoked from the player class when the movespeed stat was modified. I removed that for now. I've successfully managed to give an item that upgrades the max health of the player, I'm just cleaning it up a bit, and I'll move to a store where I can purchase items, or fix the move speed item before I do that.
Entries:
- More infinite loops from health and stat mediator classes causing StackOverflows, I'm not sure what's going on.
- Okay, so performing a query on a stat also calls the "OnStatModified" event, so I was listening in on that, to update the health to the correct ratio, and entered an infinite loop.
- Okay, I think I have a solution. I'm going to expose the "StatsMediator" from the character class instead of the "Stats" class, this will allow me to add a modifier to the health class, with a special case. I had also added the same Mediator class to each object that needed it instead of creating a new one for each, now I can just say
character.StatsMediator.AddModifier(modifier);
which will look if it's a health one, and do something specific. - I added an if statement to adding a stat modifier, if it's health, it goes through the health class and adds the modifier there so it can handle the adjustment, I'll make this a static method so I can call it anywhere maybe, but also if this works, I'll need to update this change to affect resources too.
- Okay, so that indeed worked. I hooked up the resources part of it too and it's working good. I also confirmed that the regen amount / rate is also working as intended, time to move onto the move speed now, then I can add a store and have the player purchase items from it.
- Again, it's the fact that when I call the query, it also calls on stat modified, so I can't wait on the event for the stat to be modified, then update it, it enters an infinite loop. So now I'm using update unfortunately, and now I can't seem to move after that change.
- Mission accomplished! Time to add the store now!
- Oh btw, I couldn't move because I had accidentally unset the Input Actions :P
- I had some lunch, working on getting the UI working for the shop now. I've removed the temp event firing off from the shop and added a "Pass" button which I'm going to use to test that it still goes to the next scene okay.
- The pass button works, I need to fix spawns for the next level after so I can properly test items. I hadn't updated these after I made some changes to the way I spawn in player & enemy.
- Okay, well... now going to the next level is having some issues, I'm not sure what it is, but I'll look at it after I'm done with the items. I'll populate the Manager with a list of potential items, it'll pick random 3. Items have data and I'll just populate the fields, if the player chooses the "Buy" option, it'll move to the next level, but after it adds that item to the Player's inventory.
- Items are populating the store page, and I can buy them (I think). I can't confirm until the next level.
Closing Notes: I'm going to end this session for now, I got a decent amount done for now, I'll come back to fix the level issue.
Fixing Level Weirdness
Opening Notes: When I go to the next level after the shop, the player spawns OOB, which isn't supposed to happen. I'm getting some out of range exceptions for some reason, I'll have to look into it further.
Entries:
- I've figured out that it's the player not being set to the proper spawn point that is causing this problem. Since the player is spawning out of bounds, there are no enemy spawn points available (since I'm reaching for a certain range within a distance from the player), which turns out to be 0 and thus I get that out of range exception.
- Aha! I had hard coded the spawn... dummy me :D.
- Okay........ that didn't fix it either.
- I have figured out that the events are not firing off somehow. From player enabled, to the level data, to receiving the spawn point. Well, it looks like it's going off, just nothing is happening.
- Okay, now I set the player transform when I spawn it, taking the data from the LevelData instead of trying to do event stuff.
Closing Notes: Okay, I got it all working now. Items are being applied on the new level now. I suspect that there is an issue with how many times the items are being re-applied, but I'll look into it next session.
Other stuff I worked on
I didn't open my DevLog app for these tasks, so this section will look a little different
Tasks
- Added an Upgrade Menu on the Title Screen
- This is a meta progression system, allowing players to use the permanent currency to apply global multipliers like increased movespeed or health. This makes new runs easier as players continue playing and unlocking these upgrades.
- Added Post Processing Volumes to Each Level
- Just makes the environments look a little nicer :)
- Fixed a bug where enemies that died with StatusEffects on them, and respawned through the GameObjectPool, continued to take damage from the DOTs.
- I fixed this by passing in
float.MaxValue
to each StatusEffect on the enemy when it dies, and then trigger another update at the same time, removing anything that was on it.
- I fixed this by passing in
- Fixed a bug where the Player's pickup radius was counting toward the Player's hit-box.
- Added a "Ghost Area" visual for enemies that use an Area of Denial ability type.
- This makes it easier for the player to see where an enemy is going to attack, and move accordingly.
- I updated the StatsMediator class, removed the unnecessary event invocation of the
OnStatModified
event which was incorrectly being called when any Stat was retreived.- This lead me to optimize the setting of the MoveSpeed stat to the
ThirdPersonController
- This lead me to optimize the setting of the MoveSpeed stat to the
- Turned on the multiplier for the animations for casting, effectively creating an attack speed knob.
- Right now I have a potion that increases AttackSpeed by 5x, which correctly speeds up the cast speed of the player by speeding up the animation.OnStatModified
- Started work on a DevConsole of sorts, it's some basic UI right now, but I can toggle the menu, and activate things like "God Mode", "Skip Wave", and "+100 Coins".
- Added FEEL package, which I'm only using right now to "flicker" the material of an Entity when it takes damage, giving some feedback to the player.
Upcoming Sprint
Here are the tasks I plan to focus on during the upcoming sprint:
- Add Melee Skills back into the game
- Tidy Up DevConsole
- Move ActionBar from UIToolkit to Canvas
- Make UI Look Nicer