Projects that shouldn't work: doomcr

I did a fun and useless thing: put Doom in the terminal with Crystal.
Why did I do this? Because why not.
Honestly I fully expected this to explode. It did not.

Repo: omarluq/doomcr

It can run either:

  • shareware doom1.wad (default)
  • Freedoom (DOOM_WAD_SOURCE=freedoom)
docker run --rm -it doomcr:latest
docker run --rm -it -e DOOM_WAD_SOURCE=freedoom doomcr:latest

You can also mount your own IWAD if you already have one.

If anyone wants to try it and roast the terminal rendering/input handling, I’m all ears.

1 Like

Wow, this is so cool!!

1 Like

Can I run it directly on my x86_64 linux laptop without docker?

I tried with podman, but failed, I guess it caused by some incompatible by runc/crun

I do some hack for Dockerfile support podman, but still build failed.

STEP 12/20: RUN crystal build src/main.cr -o /app/bin/doomcr --release
/usr/bin/ld: /app/src/doomcr/../../build/native/libdoomgeneric.a(doomcr_bridge.o): warning: relocation against DG_ScreenBuffer' in read-only section .text’
/usr/bin/ld: _main.o3.o: in function create': /app/src/doomcr/native.cr:31:(.text+0x569f): undefined reference to doomgeneric_Create’
/usr/bin/ld: _main.o3.o: in function tick': /app/src/doomcr/native.cr:35:(.text+0x56b1): undefined reference to doomgeneric_Tick’
/usr/bin/ld: /app/src/doomcr/../../build/native/libdoomgeneric.a(doomcr_bridge.o): in function doomcr_get_screenbuffer': doomcr_bridge.c:(.text+0x67): undefined reference to DG_ScreenBuffer’
/usr/bin/ld: /app/src/doomcr/../../build/native/libdoomgeneric.a(doomcr_bridge.o): in function DG_DrawFrame': doomcr_bridge.c:(.text+0xa3): undefined reference to DG_ScreenBuffer’
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status

Neat! Omar, maybe we can make the niche for crystal be “doing weird shit”

Not sure if there is a business case but it’s fun ;-)

1 Like

@zw963 Seems that the Podman build ended up with a libdoomgeneric.a that’s missing a few Doom symbols (doomgeneric_Create, doomgeneric_Tick, DG_ScreenBuffer), so the final Crystal link step fails.

I pushed a fix it will use the vendored doomgeneric instead, if it still failing maybe try to build it without the cache

 podman build --no-cache -t doomcr:latest .
1 Like

Tested, works on my arch linux with podman now, thanks!

1 Like