Jonas Tyroller Profile picture
Aug 24 22 tweets 6 min read Read on X
Best Code Architectures For Indie Games (Thread) Image
Firstly: I am a professional idiot, don't listen to me. Image
Secondly: Most games are pure spaghetti code so no need to feel bat if yours is as well. Image
If it works, it works. Image
Write reusable systems that are independent from each other. It reduces complexity and increases the chance that you can reuse them in future projects. Image
Glue your reusable system together with some dedicated glue code, whatever you prefer, game managers, event busses, signals... Image
Limit spaghetti length. Keep systems as small as possible. Image
Spaghetti needs to stay on the plate. Image
Spaghetti is neatly rolled up on various plates. (Wait, am I still talking about game dev...) Image
So you have reusable systems and glue, but you also have data. You want to keep your data separate and organized. Image
Happy game designer easily finds all of his data. Image
Angry game designer has to look for the data all over the place. He is very angry. Image
Having a good database is so much of a win that it's almost worth it to design it first, and then build the other systems on top.

But only after prototyping and verifying that what you want to build makes sense in the first place (duh). Image
When I say database, I mostly mean immutable data. Mutable data can live together with the code, or not (e.g. if you like ECS), up to you. Actually, it's all up to you but that is not the point of... eh..
There is one very long spaghetti you can't avoid. Image
Time Image
All your systems need to connect to that super-spaghetti and it often creates a mess (for some games more than others). Image
Controlling execution order carefully yourself and not bothering with Unity's random f*ing update and awake events can be very much worth it for bigger projects (probably, need to verify with big projects). Image
Separate your game into simulation and view. This makes tasks even more granular and your project even more modular, and hopefully less complex. Image
So kinda like building 2 games at once. Each has its own systems, its own glue, and its own data. Data for the view would for example be stuff like colors, sprites, meshes, animations. Image
Most importantly, stay organized, whatever that means for your game. (It means something different for every game, because every game is different and has different requirements.) Image
Lastly, tell me where I'm wrong and what you would add so I can do better next time. I have much to learn. Thank u.

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Jonas Tyroller

Jonas Tyroller Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(