GithubHelp home page GithubHelp logo

doomenstein-3d's Introduction

Wolfenstein/DOOM style software renderers

project screenshot

  • src/main_doom.c: a DOOM-style software renderer
  • src/main_wolf.c: a Wolfenstein 3D-style software renderer

Building & Running

$ make doom|wolf|all, binaries are bin/doom and bin/wolf respectively

doomenstein-3d's People

Contributors

jdah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

doomenstein-3d's Issues

This is a mess to compile on Linux.

So I was going to compile Doom on Linux Mint, typed in make doom and I got this error:

rsync -a --include '*/' --exclude '*' "src" "bin"
make: brew: No such file or directory
/bin/clang -o bin/src/main_doom.o -MMD -c -std=c2x -O2 -g -fbracket-depth=1024 -fmacro-backtrace-limit=0 -Wall -Wextra -Wpedantic -Wfloat-equal -Wstrict-aliasing -Wswitch-default -Wformat=2 -Wno-newline-eof -Wno-unused-parameter -Wno-strict-prototypes -Wno-fixed-enum-extension -Wno-int-to-void-pointer-cast -Wno-gnu-statement-expression -Wno-gnu-compound-literal-initializer -Wno-gnu-zero-variadic-macro-arguments -Wno-gnu-empty-struct -Wno-gnu-auto-type -Wno-gnu-empty-initializer -Wno-gnu-pointer-arith -Wno-c99-extensions -Wno-c11-extensions -iquotesrc -Ilib/SDL/include src/main_doom.c
make: /bin/clang: No such file or directory
make: *** [Makefile:70: bin/src/main_doom.o] Error 127

So I thought "OK, I'll compile myself" and typed gcc ./src/main_doom.c just to be greeted by this other error:

./src/main_doom.c:3:10: fatal error: SDL.h: No such file or directory
    3 | #include <SDL.h>
      |          ^~~~~~~
compilation terminated.

After changing SDL.h to SDL2/SDL.h to comply with Linux's include file structure and tried again.
It threw a bunch of errors regarding boolean values which prompted me to also #include <stdbool.h>.
I gcc ./src/main_doom.c'd again just for it to throw me this other beautiful list of errors:

/usr/bin/ld: /tmp/ccoViwXv.o: in function `rotate':
main_doom.c:(.text+0x39): undefined reference to `cos'
/usr/bin/ld: main_doom.c:(.text+0x6d): undefined reference to `sin'
/usr/bin/ld: main_doom.c:(.text+0xb2): undefined reference to `sin'
/usr/bin/ld: main_doom.c:(.text+0xe6): undefined reference to `cos'
/usr/bin/ld: /tmp/ccoViwXv.o: in function `screen_angle_to_x':
main_doom.c:(.text+0x3f3): undefined reference to `tan'
/usr/bin/ld: /tmp/ccoViwXv.o: in function `normalize_angle':
main_doom.c:(.text+0x460): undefined reference to `floor'
/usr/bin/ld: /tmp/ccoViwXv.o: in function `render':
main_doom.c:(.text+0xefd): undefined reference to `atan2'
/usr/bin/ld: main_doom.c:(.text+0xf61): undefined reference to `atan2'
/usr/bin/ld: main_doom.c:(.text+0x10ba): undefined reference to `atan2'
/usr/bin/ld: main_doom.c:(.text+0x1141): undefined reference to `atan2'
/usr/bin/ld: main_doom.c:(.text+0x1253): undefined reference to `atan2f'
/usr/bin/ld: main_doom.c:(.text+0x126a): undefined reference to `sin'
/usr/bin/ld: main_doom.c:(.text+0x1c66): undefined reference to `SDL_Delay'
/usr/bin/ld: /tmp/ccoViwXv.o: in function `present':
main_doom.c:(.text+0x1de9): undefined reference to `SDL_LockTexture'
/usr/bin/ld: main_doom.c:(.text+0x1e4d): undefined reference to `SDL_UnlockTexture'
/usr/bin/ld: main_doom.c:(.text+0x1e61): undefined reference to `SDL_SetRenderTarget'
/usr/bin/ld: main_doom.c:(.text+0x1e85): undefined reference to `SDL_SetRenderDrawColor'
/usr/bin/ld: main_doom.c:(.text+0x1e99): undefined reference to `SDL_SetRenderDrawBlendMode'
/usr/bin/ld: main_doom.c:(.text+0x1ea8): undefined reference to `SDL_RenderClear'
/usr/bin/ld: main_doom.c:(.text+0x1ee0): undefined reference to `SDL_RenderCopyEx'
/usr/bin/ld: main_doom.c:(.text+0x1ef4): undefined reference to `SDL_SetTextureBlendMode'
/usr/bin/ld: main_doom.c:(.text+0x1f32): undefined reference to `SDL_RenderCopy'
/usr/bin/ld: main_doom.c:(.text+0x1f41): undefined reference to `SDL_RenderPresent'
/usr/bin/ld: /tmp/ccoViwXv.o: in function `main':
main_doom.c:(.text+0x1f8d): undefined reference to `SDL_Init'
/usr/bin/ld: main_doom.c:(.text+0x1f96): undefined reference to `SDL_GetError'
/usr/bin/ld: main_doom.c:(.text+0x1feb): undefined reference to `SDL_CreateWindow'
/usr/bin/ld: main_doom.c:(.text+0x2003): undefined reference to `SDL_GetError'
/usr/bin/ld: main_doom.c:(.text+0x2047): undefined reference to `SDL_CreateRenderer'
/usr/bin/ld: main_doom.c:(.text+0x2072): undefined reference to `SDL_CreateTexture'
/usr/bin/ld: main_doom.c:(.text+0x209d): undefined reference to `SDL_CreateTexture'
/usr/bin/ld: main_doom.c:(.text+0x2191): undefined reference to `SDL_PollEvent'
/usr/bin/ld: main_doom.c:(.text+0x21ce): undefined reference to `SDL_GetKeyboardState'
/usr/bin/ld: main_doom.c:(.text+0x2248): undefined reference to `cos'
/usr/bin/ld: main_doom.c:(.text+0x2273): undefined reference to `sin'
/usr/bin/ld: main_doom.c:(.text+0x25b1): undefined reference to `SDL_DestroyTexture'
/usr/bin/ld: main_doom.c:(.text+0x25c0): undefined reference to `SDL_DestroyTexture'
/usr/bin/ld: main_doom.c:(.text+0x25cf): undefined reference to `SDL_DestroyRenderer'
/usr/bin/ld: main_doom.c:(.text+0x25de): undefined reference to `SDL_DestroyWindow'
collect2: error: ld returned 1 exit status

I've run out of solutions so I'm going to post this in hopes of someone having a solution.
Best Regards,
Simón "Silicosis" Peña.

Potential typo in wallshade variable?

In the DOOM-style renderer, should this statement

          const int wallshade =
                16 * (sin(atan2f(
                    wall->b.x - wall->a.x,
                    wall->b.y - wall->b.y)) + 1.0f);

be changed to this statement

          const int wallshade =
                16 * (sin(atan2f(
                    wall->b.x - wall->a.x,
                    wall->b.y - wall->a.y)) + 1.0f);

since wall->b.y - wall->b.y is zero? It makes a pretty subtle difference in the color of the walls but it stuck out to me as a possible typo when I was reading that code.

Super cool video and thanks for releasing your demo code!

Error compiling on macOS

rsync -a --include '/' --exclude '' "src" "bin"
/usr/local/opt/llvm/bin/clang -o bin/src/main_doom.o -MMD -c -std=c2x -O2 -g -fbracket-depth=1024 -fmacro-backtrace-limit=0 -Wall -Wextra -Wpedantic -Wfloat-equal -Wstrict-aliasing -Wswitch-default -Wformat=2 -Wno-newline-eof -Wno-unused-parameter -Wno-strict-prototypes -Wno-fixed-enum-extension -Wno-int-to-void-pointer-cast -Wno-gnu-statement-expression -Wno-gnu-compound-literal-initializer -Wno-gnu-zero-variadic-macro-arguments -Wno-gnu-empty-struct -Wno-gnu-auto-type -Wno-gnu-empty-initializer -Wno-gnu-pointer-arith -Wno-c99-extensions -Wno-c11-extensions -iquotesrc -Ilib/SDL/include src/main_doom.c
make: /usr/local/opt/llvm/bin/clang: No such file or directory
make: *** [bin/src/main_doom.o] Error 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.