Page 1 of 1

Game Code Design Patterns

Posted: Thu Jun 06, 2019 9:37 pm
by Karai17
https://github.com/excessive/love-game-patterns

Here is an example of various ways to write game code, written by @shakesoda. This includes a bare procedural approach, an OOP approach, and an ECS approach. Bonus inclusion is a hand-minified version of the procedural code cut down to only 1318 bytes! All of the examples are functionally identical and provide a look into different ways of structuring game code to provide the same results.

If you have some other way of reimplementing this exact game, feel free to send a PR! Any questions about the various approaches are welcome, we're all here to learn! :D

Re: Game Code Design Patterns

Posted: Tue Jun 11, 2019 1:46 am
by CameronGoble
Wow! Really illustrative. I love how you so clearly show the same result from these three different approaches.

I'm a hobbyist programmer from the 1990s: the heady days of OOP. So that's my go-to. Lately, I'd been curious about ECS. Your demos answer practically every question I could think of as to what the different approaches entail.

Much appreciated!

Re: Game Code Design Patterns

Posted: Tue Jun 11, 2019 2:46 am
by Karai17
Awesome! I'm glad you found this useful. If you have any unanswered questions, feel free to ask!