Having a journal is nice. I admittedly suck at Notion so this space will be reformatted often.
Just like my codebase. That was a smooth segue and was completely unintentional.
It’s time to refactor.
Now that I have a better idea of my architecture and my most stringent requirements (card effects probably), I should be able to create a much better system for myself
I know the smart thing to do is to leave the legacy code alone so that I can just get something out, and refactor later. But I’m not lacking in motivation to work on the project and it’s not like I have a deadline. I have the most amount of time anyone could have. So I may as well spend lots of time making small changes to get it done right, instead of getting it done wrong later and demotivating myself from updating huge amounts of code.
I wonder how many more times I’ll end up refactoring…
Regardless the things that need to be refactored are as follows:
- Weapons
- Do I want to put weapons as part of PlayerData, or keep Weapons separate from PlayerData? I.e. Should a player’s weapons be considered part of its stats or should a Player just hold a weaponShooter and let the shooter handle the weapon details?
- Also it’s time to make bullets use the same prefab and have the exact same behavior
- This will let me change bullet details while also being able to change behavior. If I had a bounce bullet and a cannon bullet use different prefabs and models, then (1) the hitbox would change when I switch weapons and (2) it would be annoying to reconcile differences in base stats of each weapon with previous weapon upgrades gotten.
- Although… I just realized… it’s easy to change from cannon to bounce bullet by simply letting the bullet bounce. I can also make the bullets pellets to make it unidirectional. But what if I want a laser? I can’t exactly change the bullet to function similarly as a laser…
- Even if I make laser and bounce mutually exclusive cards, how do you transform a pellet into a laser??
- This makes me realize I probably want several characters with different weapons
- Pellet, laser, point-and-click poison??, sniper (also point and click) or mortar (can’t move and also click)?, Shield (can reflect enemy bullets? but what’s the main weapon?), etc
- What makes one weapon’s cards different from another? I guess each has their own exclusivity and so on?
- Oh maybe I can make each weapon associated with a card… then you can easily attach exclusiveness! And each player starts off with their weapon/player chosen card! That on its onHover tooltip shows its player starting stats! I like that
- I’m not sure if I need the managers/listeners done like it is now. I might decide to refactor that (but that’s for much later)
- Ideally Player and Aliens extend from the same class (Creature?).
- This is less refactoring and more code architecting/creating new things, but we should really have interfaces like IDamageable or IPoisonable or something
Also it occurs to me that I should be comfortable with changing details in ScriptableObjects or GameObjects, and grabbing objects through Unity’s lookup functions. This codebase will probably have both and I’ll be using the latter a lot in the future.