You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Nick Hayashi 267e41a0a6 readme 8 months ago readme 8 months ago
glad.c first 8 months ago
glad.h first 8 months ago
glfw3.dll first 8 months ago
glfw3.h first 8 months ago
glfw3.lib first 8 months ago
khrplatform.h first 8 months ago
main.cpp first 8 months ago

you can compile this (windows only, debug version, assuming you have cl.exe available) using:

cl.exe glad.c main.cpp /nologo /W3 /MTd /Od /Zi /RTC1 /fsanitize=address /link /out:game.exe /incremental:no glfw3.lib

the .exe will be around 1.5mb in this case.

or, in release version with a smaller .exe size and better perf (181kb with clang-cl, dang just barely missed 128kb total size!), no debugging symbols etc.

clang-cl.exe glad.c main.cpp /nologo /W3 /O2 /GS /clang:-fno-asynchronous-unwind-tables /link /out:game.exe /fixed /incremental:no /opt:icf /opt:ref libvcruntime.lib glfw3.lib


cl.exe glad.c main.cpp /nologo /W3 /O2 /GS /link /out:game.exe /fixed /incremental:no /opt:icf /opt:ref libvcruntime.lib glfw3.lib

the first 10-20 frames in debug mode are prone to run below 60fps on my machine, which I unfortunately wasn't able to fix in 16 hours - my computer is fairly weak though, it's about 10 years old and has no external GPU. You may fare better :). Subsequent frames perfome many times better.

  • [Y] - snake-like 0 player game
  • [Y] - need to support on the order of 8k+ snakes concurrently (we're going to choose a max of 8192)
  • [Y] - if the head of a snake touches the tail of another, the snake who's head touched the tail will merge up with the 'eaten' snake.
  • [Y] - all snakes start with one segment
  • [Y] - when there is only one snake left, the game must restart
  • [Y?] - game data under 128kb - achieved if this means game state, not quite if it means .exe size (we're about ~1mb .exe size after trying to minimize size)
  • [Y] - 60fps minimum, or locked
  • [Y] - static memory allocation, avoid heap
  • [Y] - minimal or zero usage of libraries (except glfw and opengl)