DOOM translated from C to V.
515
stars
122
commits
C
primary language
Jul 8, 2024
updated
DOOM translated from C to V. Builds in 0.7 seconds (x25 speed-up).
Current problems that will be fixed asap:
It is possible to translate files one by one and gradually replace C with V. Object files compiled with V have full binary compatibility with object files produced by C, and can be a drop-in replacement:
# Download and build DOOM
git clone https://github.com/chocolate-doom/chocolate-doom
cd chocolate-doom
cmake .
make chocolate-doom
# Build p_enemy.v and replace the object file
wget https://raw.githubusercontent.com/vlang/doom/master/p_enemy.v
v -lib translated p_enemy.v
cp p_enemy.o src/doom/CMakeFiles/doom.dir/p_enemy.c.o
# Rebuild it again with p_enemy.v.o and launch it
make chocolate-doom && src/chocolate-doom -width 640
There are several things that are allowed in translated code:
++/-- expressions and int to bool conversions (for i-- {)All of these except for the globals are going to be fixed by the translator:
++/-- expressions will be replaced with statements at the right placeInstall dependencies
apt install libsdl2-dev libsdl2-mixer-dev libsdl2-net-dev
Download doom1.wad into ~/Downloads from here. (ref: External links section in this doomwiki page)
git clone git@github.com:vlang/doom.git
cd doom/
DOOM_FOLDER=`pwd` && ./build_whole_project.sh
C
47.4%
Verilog
35.1%
V
15.2%
DOOM translated from C to V.
515
stars
122
commits
C
primary language
Jul 8, 2024
updated
DOOM translated from C to V. Builds in 0.7 seconds (x25 speed-up).
Current problems that will be fixed asap:
It is possible to translate files one by one and gradually replace C with V. Object files compiled with V have full binary compatibility with object files produced by C, and can be a drop-in replacement:
# Download and build DOOM
git clone https://github.com/chocolate-doom/chocolate-doom
cd chocolate-doom
cmake .
make chocolate-doom
# Build p_enemy.v and replace the object file
wget https://raw.githubusercontent.com/vlang/doom/master/p_enemy.v
v -lib translated p_enemy.v
cp p_enemy.o src/doom/CMakeFiles/doom.dir/p_enemy.c.o
# Rebuild it again with p_enemy.v.o and launch it
make chocolate-doom && src/chocolate-doom -width 640
There are several things that are allowed in translated code:
++/-- expressions and int to bool conversions (for i-- {)All of these except for the globals are going to be fixed by the translator:
++/-- expressions will be replaced with statements at the right placeInstall dependencies
apt install libsdl2-dev libsdl2-mixer-dev libsdl2-net-dev
Download doom1.wad into ~/Downloads from here. (ref: External links section in this doomwiki page)
git clone git@github.com:vlang/doom.git
cd doom/
DOOM_FOLDER=`pwd` && ./build_whole_project.sh
C
47.4%
Verilog
35.1%
V
15.2%