Code-It-Yourself! First Person Shooter (Quick and Simple C++)
Why Stack Overflow recommends it
Stack Overflow users cite it as the tutorial they are following when asking about console buffers, raycasting movement bugs, or porting its Windows-specific code to Linux or Python.
Recommended by 0 people across 0 different months, 2019 to 2020.
What it is
javidx9 builds a first-person 3D engine that renders as ASCII text in the Windows Command Prompt, using roughly 200 lines of C++. He walks through the raycasting approach, the console buffer setup, player movement and the map, with the code on GitHub.
What people said
Cites David · 2019-03 · Stack Overflow · on “How to Manually Write to Console G++ Linux W/O printf / cout?”
I want to follow [this video] tutorial, but at one point the author manually allocates the console to be more efficient. He uses what looks like Windows specific instructions, but I want to achieve the same thing on Linux. I am on Debian 9.8 and using g++6.3. This is the code I want to duplicate on my Linux end. #include <stdio.h> #include <Windows.h> int nScreenWidth = 120; int nScreenHeight = 40; wchar_t *screen = new wchar_t[nScreenWidth*nScreenHeight]; HANDLE hConsole = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, 0, NULL, CONSOLE_TEXTMODE_BUFFER, NULL); SetConsoleActiveScreenBuffer(hConsole); DWORD dwBytesWritten = 0; I already tried finding a solution to this and I couldn't find
Cites kiner_shah · 2019-09 · Stack Overflow · on “C++ Increasing while loop refresh rate speed?”
Maybe you can get the console window in a buffer and use that buffer to do your drawing. I saw someone doing it here [this video]
Cites Caspian Ahlberg · 2020-06 · Stack Overflow · on “Assert that movement works in my Raycasting engine”
I am following the raycasting engine tutorial by javidx9 (the tutorial is here: [this video] ), but I am writing it in Python instead. Note that I am stuck at around the 20-minute mark. He is able to achieve movement (back and forth, forward and backward, etc), but I am absolutely stumped as to why this is not working in my version. I have no error messages, I have tried setting variables such as the ray angle as constants, and I have tried modifying the map to see anything else than the standard bars appearing; but it doesn't seem to budge! All of the dependencies are built-ins, so it would be easy to test. Could someone more experienced with raycasting math tell me what I am doing wrong? # Sour
Cites volt2054 · 2020-11 · Stack Overflow · on “WriteConsoleOutputCharacter in c++ loads of ?s on console”
So I am following this tutorial here [this video] and I am new to accessing console buffer and that. I started debugging when I realized my console looked like this [LINK] when I ran it. And I narrowed it down to this line of code WriteConsoleOutputCharacter(hConsole, screen, nScreenWidth * nScreenheight, { 0,0 }, &dwBytesWritten); the values in this are set to: HANDLE hConsole = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, 0, NULL, CONSOLE_TEXTMODE_BUFFER, NULL); wchar_t* screen = new wchar_t[nScreenWidth * nScreenheight]; int nScreenWidth = 120; int nScreenheight = 40; DWORD dwBytesWritten = 0;