Demo Progress Day 2: Refactor + Enemies
I recall a conversation with my dad at one point in the long past, I don’t remember what it was about, but the thing he said that I thought was very applicable for today was
There was a plan, and there was an execution. But there was no execution of the plan.
The Plan
The plan for today was to get some enemies that actually take damage when you roll. For this to work properly, I also had to refactor some things since I hardcoded a lot of logic to just “Make it Work”.
In my career as a developer I’ve learned to follow the “Make it work -> Make it right -> Make it better” approach. I’ve often seen that in game jams they just focus on the working bit, but since I want this to be a base for a full game, I need to be a bit more “proper”.
The idea was to get the DiceRoller
class split from the SixSidedDie
, and have that as part of the Player. The SixSidedDie
then needed to have 4 Skills
equipped, instead of hardcoded values, and those skills needed to apply effects using Events. I then wanted to add Enemies, also with a Skill
each, and then give them and the player health so we can duke it out.
The Execution
I ended up spending way too much time on the SixSidedDie
, since I decided to start creating the NSidedDie
interface for when I want to add the EightSidedDie
. Problem with this is that I don’t need it yet, and it complicated things. I eventually got my existing code working with the new DiceRoller
(which manages state between rolls) and the SixSidedDie
, but ended up breaking some behavior which took longer than expected to fix.
In the end, I created a Prefab for enemies, added a Text component to show their current health, creating a Health
script which can take damage and destroy the parent object when it “dies”, and hooked up the DiceRoller
to call the ApplyEffect
function on a skill.
What I didn’t do as planned was using Events for the rolls. The plan was to have a roll broadcast the effect of the Skill
and anyone who listens can react on it. You would select your target enemy and they would then register for the events and things would flow nicely. But instead, the Skill
now searches for all Health
components and filters out the player or enemy (depending on the skills target) and then calls the TakeDamage
function on the component.
This is fine for showing it works, but not what I would consider the “correct” implementation, so part of tomorrow will be fixing that up.
Next Steps
In addition to using Events instead of search and filter, I’d also like to replace the Cube and Spheres with some free models I have for use, and then I’d like to make it so you can click and choose your target, rather than just using the first one it finds.
Then I’d like to give the enemies a skill each, and have them take a turn as well. Pretty boring when only you attack and they do nothing…
If time allow, I’d like to make the Skills ScriptableObjects
which I can use to easily create new skills to use. Currently I just code them all by hand, which isn’t ideal. Once I have this in place, I want to start working on the logic for actually equipping skills, since they are currently fixed.
Since the plan is to eventually have you upgrade and select skills between fights, I’ll at least need to plan out how that would work.
Get So this is how I DIE
So this is how I DIE
Horde survival custom dice roller. Oh yes.
Status | Prototype |
Author | DuhblinnZA |
Genre | Role Playing |
Tags | 3D, Dice, Indie, Roguelite, Turn-Based Combat, Unity |
More posts
- You snooze you lose 😴51 days ago
- Time doesn't necessarily happen in chronological order.92 days ago
- Not dead yet...💀🎲Apr 20, 2024
- Thank you 🫶 (also, what's next)Mar 11, 2024
- We did it! 🥳Mar 01, 2024
- Small update on Alpha Demo releaseFeb 29, 2024
- Pre-Alpha Progress Update 7: Getting close...Feb 28, 2024
- Pre-Alpha Progress Update 6: End of Feb is when!?!Feb 26, 2024
- Pre-Alpha Progress Update 5: I have no idea what I'm doingFeb 18, 2024
- Pre-Alpha Progress Update 4: Scope CreepFeb 11, 2024
Leave a comment
Log in with itch.io to leave a comment.