Skip to content

Instantly share code, notes, and snippets.

View NouCake's full-sized avatar

Kevin Fischer NouCake

View GitHub Profile
@mrhelmut
mrhelmut / style.md
Last active December 26, 2022 10:06
Coding style for pure C# game development projects

Coding style

Over the years of porting pure C# games to consoles, we defined a set of coding guidelines which ensures that porting and performances go smooth on every possible platforms and C# runtimes.

The main reason for these guidelines is that C# runtimes on exotic platforms might be very outdated and/or limited in language features due to the very nature of using Ahead-of-Time (AOT) compilation, or even sometime going as far as transpiling IL Code to C++. Some runtimes are also extremely sensitive to garbage collections, which can produce very visible micro freezes during gameplay, hence our guidelines also target the limitation of garbage.

These guidelines will be very counter-intuitive to enterprise C# developers. Bear in mind that C# is a language that wasn't designed for games and performance in the first place, that using it in this context isn't effecient, and that pretty old C# runtimes mean that we have to bend the language to make it fit our needs. Also keep in mind that we can't count on