Snake to Gecko
4 appendages for a good game codebase
Disclaimer:
Actually Making A Game
Events/Function Listener
Function
Variable (Action, Void *)
Assign
Function 3
Variable 3
Function 2
Variable 2
Variable 4
Events/Function Listener
- Functions, same as Datas, are just “Things” in RAM.
- Usage: Bind OnPlayerTakeDamage -> Update Player Visual, Update UI etc.
Singleton/Manager
Manager Class
Static Self Reference
Contains
Other Classes
Ref
Other Variables and Functions
Singleton/Manager
- It sounds like hacking, because it is.
- Usage: Wider than you might expected; Very dirty trick if you are in rush (like a game jam ;>).
- Do you need singleton, or can you use static functions?
Metadata/Everything-is-a-string
Object
Contains
Critical Info
Parse
Basic Datatype
Metadata/Everything-is-a-string
- Not just a tool, but a design mentality also.
- Usage: Save/Load; Multiplayer (transfer data through internet); Moddablilty.
Bonus: Reflection
- Code that read codes within the same project.
- Very handy in procedural generation
- Object pool, enemy pool. Even self-made in-game programming language if you are crazy like me.
Composition
Entity
Enemy
Boss
Playable
Regular
Bob
“The Ultimate Adventurer Killer; End of All End;
Eater of hope”
Warrior
Bob
Enemy
Playable
Warrior
Enemy AI Component
Health Component
Input Handler Component
MultiPhase AI Override Component
Rage Component
Composition
- If there are more than 3* layers of inheritance, start to think if all of them are necessary.
- Usage: If you like me and like game that piled with multiple items that all do sth different yet similar (POE, Terraria, Card Games).
- Bonus: If you feel like you have to have an ultra ancestor class, try using interface and attribute.
Combine them !
- Event + Singleton = Event Bus
- Singleton + Composition + Metadata = ECS
- Event + Metadata = Multiplayer
- Etc etc go wild