Skip to content

AbsentiousVespera/Devinia-C

Repository files navigation

DeviniaC

DeviniaC

An ECS-first programming language for games, built upward from HolyC.
One C file. It compiles itself to native x86-64 at runtime, snapshots its whole world in a memcpy, and draws its own pixels.

The world is just memory.


DeviniaC is a small, self-contained language and runtime: explicit-width HolyC types, a real entity-component-system with a parallel scheduler, a three-tier JIT (tree-walker → typed bytecode → native x86-64 with 2-lane SIMD), raw memory, world snapshots, and its own graphics window. It is deliberately one file you can hold in your head. See MISSION.md for the charter and the dedication to Terry A. Davis, whose work this stands on.

Runs on Windows and Linux. This repository is source; prebuilt binaries are attached to Releases.

Build & run

Windows — needs GCC (WinLibs):

winget install -e --id BrechtSanders.WinLibs.POSIX.UCRT
.\rebuild.ps1                       # -> deviniac.exe (embeds the app icon)
.\deviniac.exe --test               # self-check; prints "self-test PASS"

Linux — needs a C compiler and X11 headers:

sudo apt install build-essential libx11-dev     # Debian/Ubuntu
./build-linux.sh                    # -> ./deviniac
./deviniac --test

Play the flagship

deviniac demo/rewrite.dc

DEVINIA CHRONO: Rewrite Reality. A neon arena where you rewind time — and releasing branches a new timeline. The reality you abandoned lingers as a translucent ghost re-walking its path, with a red ✕ where that past-self died. Die with chrono energy left? Rewind out of your own death.

Rewinding the entire world (you, enemies, bullets, sparks) is a LoadWorld — a memcpy — because in DeviniaC the whole world is flat memory. The engine's save-game feature is the gameplay.

A first program

// hi.dc  —  run:  deviniac hi.dc
class Pos { F64 x, y; };
class Vel { F64 dx, dy; };
for (I64 i = 0; i < 1000; i++) { Entity e = Spawn; Add(e, Pos); Add(e, Vel); e.Vel.dx = 1.0; }
system Move : reads(Vel), writes(Pos) { each (Entity e : Pos, Vel) e.Pos.x += e.Vel.dx; }
Move;                                 // compiles to native x86-64 on first call
"entities: %d\n", EntityCount;

Top-level code runs immediately (no main); a string literal is a print statement. Full reference: LANGUAGE.md.

What it has

  • Language: explicit-width types, class structs, arrays, functions (default args + forward declarations), full C control flow, #include, raw pointers (MAlloc/*p/p[i]/&x).
  • ECS: generational entities, structure-of-arrays storage, each queries, systems with declared reads/writes, an auto-derived parallel schedule on real threads, command buffers, in-system spawning, hot-reload of running systems.
  • The forge: each bodies compile to typed bytecode then native x86-64; single-class float kernels vectorize to 2-lane SSE2. All three tiers produce bit-identical results (JitStats / JitDump).
  • World snapshots: SaveWorld/LoadWorld — save games, rewind/replay.
  • Its own window: a FrameBuffer() you draw into through a raw pointer, DrawGlow/DrawLine, window-local input (KeyDown, MouseX/Y/Down).
  • Tooling: a CLI (--test, -e, --tier, stdin, script args), clean source-context errors, a one-command test gate, and a tier-parity fuzzer.

Demos

demo/rewrite.dc   REWRITE REALITY — rewind + ghost timelines (the showcase)
demo/chrono.dc    rewind survival (simpler)
demo/neon.dc      neon twin-stick shooter
demo/firstlight.dc  glowing galaxy that follows your mouse
demo/verify.dc    a sim that proves itself bit-identical across 3 tiers, live
demo/galaxy.dc    30,000 bodies on the SIMD lanes
demo/color_scenery.dc / dense_color_plasma.dc / codex_night_sky.dc  terminal art
showcase.cmd      guided terminal tour (Windows)

Testing & stress

.\run_tests.ps1                                  # gate (Linux: ./run_tests.sh)
./fuzz/fuzz.sh 2000                              # tier-parity fuzzer (Git Bash)
.\deviniac.exe bench\stress.dc 1000000 100       # a million entities (tunable)
.\deviniac.exe bench\perfsmoke.dc                # realistic frame benchmark
.\deviniac.exe -e "I64 *p = 0; p[7] = 1;"        # bad input must be a clean error

Repository layout

src/deviniac.c        the entire language, one file  (src/deviniac.rc = icon resource)
LANGUAGE.md           full language reference
MISSION.md            the charter + dedication
CHANGELOG.md          release history
rebuild.ps1           Windows build   |   build-linux.sh   Linux build
run_tests.ps1/.sh     the test gate   |   fuzz/fuzz.sh     tier-parity fuzzer
demo/  bench/  tests/  assets/

Contributing / bug reports

A good report: the exact command, expected vs actual (copy the output), your OS, and — if a compiled result looks wrong — whether --tier 1 (the portable bytecode VM) gives a different answer. The interpreter and bytecode tiers are pure C; the native tier is the place to suspect first on a new platform.

License

MIT. DeviniaC builds upward from HolyC / TempleOS by Terry A. Davis, which he placed in the public domain. God's grace on the road ahead.