~/talk

Safety first! Low-level C# without the unsafe keyword

Talkat NDC Sydney 2024 · 2024-02-12..02-16· [dotnet, software-architecture]
slides:none on file

Ports original Doom from C to C# while avoiding the unsafe keyword, reproducing game logic, demo playback, input and rendering and reaching about 80% feature parity with sound added later. Replaces C pointers and void* uses with delegates/lambdas for function hooks, preallocated arrays and careful sizing instead of zone alloc (original used a 6 MB zone). Benchmarks on .NET 6/7/8 with AOT show preallocated arrays ~6.7 µs and lists about ~1 µs slower; Spectre.Console, MAUI and Avalonia front ends work.

AI-written summary · about

  1. 0:00Project introduction
  2. 1:49Developing the port
  3. 5:07Challenges of C to C#
  4. 5:55Understanding unsafe code
  5. 10:49Performance benchmarks
  6. 13:45Memory management
  7. 20:40Data structures and arrays
  8. 26:43Reading binary data
  9. 35:14Function pointers and lambdas
  10. 40:35Game thinkers and logic
  11. 46:00Console rendering
  12. 48:18Conclusion and Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.