1 of 18

Snake to Gecko

4 appendages for a good game codebase

2 of 18

3 of 18

4 of 18

Disclaimer:

Actually Making A Game

5 of 18

6 of 18

Events/Function Listener

Function

Variable (Action, Void *)

Assign

Function 3

Variable 3

Function 2

Variable 2

Variable 4

7 of 18

Events/Function Listener

- Functions, same as Datas, are just “Things” in RAM.

- Usage: Bind OnPlayerTakeDamage -> Update Player Visual, Update UI etc.

8 of 18

9 of 18

Singleton/Manager

Manager Class

Static Self Reference

Contains

Other Classes

Ref

Other Variables and Functions

10 of 18

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?

11 of 18

12 of 18

Metadata/Everything-is-a-string

Object

Contains

Critical Info

Parse

Basic Datatype

13 of 18

Metadata/Everything-is-a-string

- Not just a tool, but a design mentality also.

- Usage: Save/Load; Multiplayer (transfer data through internet); Moddablilty.

14 of 18

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.

15 of 18

16 of 18

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

17 of 18

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.

18 of 18

Combine them !

- Event + Singleton = Event Bus

- Singleton + Composition + Metadata = ECS

- Event + Metadata = Multiplayer

- Etc etc go wild