Skip to content

Instantly share code, notes, and snippets.

View mrhelmut's full-sized avatar
💭
Working on a new game project 👊

Thomas Altenburger mrhelmut

💭
Working on a new game project 👊
View GitHub Profile
@mrhelmut
mrhelmut / Easing.cs
Created March 16, 2018 16:40
C# implementation of Robert Penner's easing functions
// TERMS OF USE - EASING EQUATIONS
//
// Open source under the BSD License.
//
// Copyright © 2001 Robert Penner
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
//
// Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
@mrhelmut
mrhelmut / MiniPCG32.cs
Last active January 14, 2022 09:38
Minimal PCG32 Random Number Generator in C#
namespace PizzaDough
{
/// <summary>
/// Random Number Generator based on Permutation-Congruential-Generator (PCG), which is a fancy wording to
/// describe a family of RNG which are simple, fast, statistically excellent, and hardly predictable.
///
/// More interestingly, PCG allows to generate multiple sequences with the same seed, which is very handy
/// in game development to have a unique seed per game session while using different streams for each
/// RNG which requires an isolated context (e.g. generating a procedural level, but we don't want the loot
/// generation to affect subsequent level generations).
@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