Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vlang/doom
DOOM translated from C to V.
https://github.com/vlang/doom
Last synced: 7 days ago
JSON representation
DOOM translated from C to V.
- Host: GitHub
- URL: https://github.com/vlang/doom
- Owner: vlang
- License: gpl-2.0
- Created: 2019-06-11T01:36:08.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-07-08T11:06:45.000Z (4 months ago)
- Last Synced: 2024-08-01T15:25:21.552Z (3 months ago)
- Language: C
- Homepage:
- Size: 2.89 MB
- Stars: 489
- Watchers: 21
- Forks: 33
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DOOM.v
DOOM translated from C to V. Builds in 0.7 seconds (x25 speed-up).Current problems that will be fixed asap:
- #define consts are replaced with their values
- No indentation in functions
- Music works fine, but monster and weapon sounds don'tIt 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:
```bash
# 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:
- Globals
- `++/--` expressions and int to bool conversions (`for i-- {`)
- Variables can be unused
- Immutability is not enforcedAll of these except for the globals are going to be fixed by the translator:
- `++/--` expressions will be replaced with statements at the right place
- unused variables will be removed
- mutable variables will be marked as mutable.## How to build and run this demo
### Preparations (Ubuntu Linux)
1. Install dependencies
```bash
apt install libsdl2-dev libsdl2-mixer-dev libsdl2-net-dev
```2. Download doom1.wad into `~/Downloads` from [here](https://distro.ibiblio.org/slitaz/sources/packages/d/doom1.wad). (ref: `External links` section in [this doomwiki page](https://doomwiki.org/wiki/DOOM1.WAD))
### Clone, build and run the demo
```bash
git clone [email protected]:vlang/doom.git
cd doom/
DOOM_FOLDER=`pwd` && ./build_whole_project.sh
```