Problem: Spaghetti (Code)
Reported By: David Tarnowski
October 30th, 2023
Figure A. Not your mom's spaghetti
THE PROBLEM
As we navigated the complex maze of game development, we stumbled upon a codebase conundrum that was anything but trivial. Our state scripts, once a well-oiled machine, began to show signs of chaos. The intricate web of logic started to snarl, leading to erratic enemy behaviors and intermittent functional glitches (FIGURE A). Moreover, the redundancy of nearly identical scripts for different enemy types was becoming a source of inefficiency and confusion.
THE SOLUTION
Figure B. So fresh. So clean.
Our path to clarity began with a meticulous restructuring of our class scripts. We introduced a parent class for each state, letting unique behaviors manifest in child scripts. This not only eliminated redundancy but also gave us the agility to implement diverse enemy actions with minimal code manipulation.
Figure C. We're all moving towards virtual anyways. Right?
Yet, the heart of our refactoring lay in a seemingly simple change—relocating the labyrinthine 'if' check conditionals into independent functions (FIGURE B). This design decision had profound implications. By isolating conditions and results, the new architecture offered a cleaner, clearer view of each state's logic. Additionally, it opened the door to overridable functions, allowing for easy customization without tampering with the core logic (Figure C).
Through this endeavor, we've not only streamlined our code but also set a foundation for more robust and versatile enemy behaviors. This recent overhaul stands as a reminder of our relentless pursuit for perfection and innovation. And as always, our commitment is to you, the player, to offer an unrivaled gameplay experience that leaves you on the edge of your seat, in awe and wonder.
Stay tuned for more insights and thrilling updates on our game development odyssey!
Thank you for your continued support!
Get Psyche
Psyche
Welcome to your next great souls-like adventure!
Status | In development |
Author | Sad Ogre Studios |
Genre | Role Playing, Adventure |
Tags | Atmospheric, Fantasy, Indie, mind-bending, psyche, Sci-fi, Singleplayer, Souls-like, Third Person |
More posts
- Problem: Harder Isn't Always More FunDec 14, 2023
- How to make the controller feel more responsiveDec 14, 2023
- ModelMayhem: A Programmer's TaleDec 08, 2023
- Problem: Face Your FearsDec 03, 2023
- Time to show our real main characterDec 01, 2023
- Problems: melee combat system is too boringNov 24, 2023
- Problem: Frames Win Games?Nov 17, 2023
- Problem with camera transitionNov 16, 2023
- Combo Attack systemNov 11, 2023
- Problems with code reusabilityNov 03, 2023
Leave a comment
Log in with itch.io to leave a comment.