Snaiel / Godot4ThirdPersonCombatPrototype

A prototype project for third person combat. Contains basics for player movement, camera, animations, combat, enemy AI, user interface, sound effects, and background music.
https://www.youtube.com/@Snaiel
MIT License
117 stars 17 forks source link

REDUCE COUPLING #39

Closed Snaiel closed 1 month ago

Snaiel commented 1 month ago

this codebase is just spaghetti in an unconvincing composition mask

What's bad?

TODO


man i have no idea what im doing. I just spent hours removing everything from the enemy script, then spent hours putting it back bruh. Also the swordsman's movement is broken now. like how does that even happen.

OKAY here is my new plan. turns out a base enemy requires a lot of components to get started. But i realised that attack, block, parry, spell components are the ones that need to be able to swapped in or out. So i just need to make it so that doing this swapping is done nicely in a modular way. The base enemy shouldn't have declared references to these components.

I might just be going crazy now but handling weapon impact in the enemies should be more modular right? If those components shouldn't be referenced, ill need new handlers for when an enemy gets hit, blocks the player or parries the player. So essentially make the _on_hitbox_weapon_hit method modular. So nodes for backstab, dizzy finisher, hit, block, parry? Maybe doing it this way can allow for new/other types of behaviour when handling an incoming weapon.

I also feel the same for the character animations script. There really shouldn't be much exported variables. I also think setting and getting parameters in the animation tree should be done similar to how beehave handles the blackboard. Basically use a custom getter and setter for flexibility.

Also probably should be done for function calls in the animation tracks. Instead of accessing the animations script directly, just send a message to the parent animations script which will handle all the dispatching. OH MY GOD THIS IS THE MEDIATOR PATTERN. Edit: this is actually the command pattern. Bro all these design patterns are like the same thing lmao. no but i get it. i think...