2024-01-04 19:42:04
Challenge: Create a compact Maze Game in C# under 2KB without
.NET Runtime, Small enough to fit in a QR Code
Process:• Self-Contained: Includes all necessary components to run on any
OS.
• Game Type: A graphical maze, utilizing
Win32 APIs, avoiding WinForms.
• Size Reduction Steps: 1- Initial Size:
64MB (with
CoreCLR)
2- Post-Compression:
35.2MB 3- IL Trimming Applied:
10MB 4- Native AOT Compilation:
1.13MB 5- Removing Unused Features:
923KB 6- Using bflat Compiler:
882KB 7- bflat with Zerolib:
9KB 8- Direct PInvoke:
8KB 9- Eliminating Debugging and Relocations:
7KB 10- Targeting x86 Architecture:
6.5KB 11- Final Step with Crinkler Linker:
1,936 Bytes Outcome: Achieved a C# game small enough to fit in a
QR code!
[ Full Article ] : https://migeel.sk/blog/2024/01/02/building-a-self-contained-game-in-csharp-under-2-kilobytes
#CSharp #DotNet #Optimization #LowLevel
@ProgrammingTip
12.6K viewsMoien Tajik, edited 16:42