Code-It-Yourself! Retro Arcade Racing Game - Programming from Scratch (Quick and Simple C++)
Why Stack Overflow recommends it
Stack Overflow users link it as the source of the pseudo-3D road technique when asking how to recreate that effect in other frameworks, or when explaining how to draw a game frame to the console.
Recommended by 1 people across 1 different months, 2018 to 2021.
What it is
javidx9 builds a retro pseudo-3D arcade racing game in C++ that runs in a plain command prompt, using simple maths and a per-row perspective trick to draw a curving road. The video is a live code-along in his Code-It-Yourself series, about 39 minutes long.
What people said
Recommends Maximilian Gerhardt · 2018-02 · Stack Overflow · on “Write to console screen without Console.SetCursorPosition(?,?)”
General idea of solving this problem: Compute the current "frame" of your game, which is just lines of text, completely Clear the console Print the entire "frame" to the console Wait for input, modify in-game objects, repeat. E.g., I wrote the following "console game": The player is a "*", the rest is filled with "-". Window adapts to resizes automatically. Player can move in every direction with arrow keys (left,right,up,down). No error checking done. It's a basic setup that uses an array of StringBuilder objects to be able to do easy string modification ( strings are immutable). Would make sense to write a general DrawTextInFramebuffer(string text, int x, int y, framebuffer) though. Edit :
Cites Janez Potočnik · 2018-01 · Stack Overflow · on “drawing pixels to create movement effect in Qt”
I'm making a drag race game in QT. I want to draw lines like [this video] for the illusion of movement, but i can only draw it once with QImage, if I put it in the loop it won't even start. QImage cesta(1200, 800, QImage::Format_RGB32); for(int y=0; y<visina/2;y++) { for(int x=0; x<sirina;x++) { float perspective = (float)y / (visina /2.0); float middle = 0.5; float rwidth = 0.1 + perspective * 0.8; //0.6 float cwidth = rwidth * 0.15; rwidth *=0.5; int leftgrass = (middle - rwidth - cwidth) * sirina; int leftclip = (middle - rwidth) * sirina; int rightclip = (middle + rwidth) * sirina; int rightgrass = (middle + rwidth + cwidth) * sirina; int row = 800 / 2 +y; QRgb grasscolor = sinf(20.0 * powf(1
Cites Sweeny J. Finn · 2021-06 · Stack Overflow · on “Trouble Generating Pseudo 3D Road In PyGame - Iterating Through The Y & X Axis Runs Very Slow”
Summary: I'm trying to create a pseudo 3d race track in pygame by iterating over the y & x axis of the screen to colour the pixels individually. I can generate the track but the code runs very slow (0.5sec cycle) and I'm wondering if there is a better way to do this. Details: Javidx9 did a retro race car tutorial in C++ (see link below) that I am trying to recreate in pygame but the code runs extremely slow when I try to emulate his 3d road solution using pygame.gfxdraw.pixel. if x <= leftgrass: pygame.gfxdraw.pixel(gameDisplay, x, y, grass_color) The track covers the bottom half of the screen and consists of several sections (left grass, left track clip, track, right track clip, right grass