Live data from Hacker News

Build your own old-school 3D shooter in a weekend

github.com

31–40 of 105 posts

Re: Build your own old-school 3D shooter in a weekend

#32
post #24
post #12

Earlier quoted context omitted.

Uh, I had never heard about these games before. I always thought Id created the franchise. Thank you for that bit of videogame history.

I read "Id" as " i'd " and thought this was the the most bizarre sarcastic comment. Time for more coffee

[deleted]

Re: Build your own old-school 3D shooter in a weekend

#33
post #16

I think leaving the "old-school" out of the title doesn't do this justice. My first thought was, with modern engines, or even raw OpenGL that isn't that hard... I did it in a weekend for my "Advanced Computer Graphics" elective in college using OpenGL and that was 2008. But this is kind of cool... it's more of a tiny ray tracer and... well to borrow the title... old-school arcade game.

> it's more of a tiny ray tracer It's a ray caster, where the rays are sent out from the camera to intersect the map. With ray tracers, the rays are sent out from the light source, IIRC. Your point on OpenGL is valid, but that just removes all the learning from it. OpenGL does so much of the grunt work for you. This kind of old-school game engine is a great learning experience.

Oh apparently ray casting is considered a form of ray tracing: "Ray casting is the most basic of many computer graphics rendering algorithms that use the geometric algorithm of ray tracing." [1]

1: https://en.wikipedia.org/wiki/Ray_casting

Re: Build your own old-school 3D shooter in a weekend

#36

I think leaving the "old-school" out of the title doesn't do this justice. My first thought was, with modern engines, or even raw OpenGL that isn't that hard... I did it in a weekend for my "Advanced Computer Graphics" elective in college using OpenGL and that was 2008. But this is kind of cool... it's more of a tiny ray tracer and... well to borrow the title... old-school arcade game.

> in college using OpenGL and that was 2008

Wolf3D was 1992, 16 years before. SGI released OpenGL a few months later. IIRC, the first gfx cards were thousands of dollars. The first successful consumer gfx was 3DFX Voodoo2 in 1996. We take so much for granted nowadays.

Re: Build your own old-school 3D shooter in a weekend

#37
post #16

I think leaving the "old-school" out of the title doesn't do this justice. My first thought was, with modern engines, or even raw OpenGL that isn't that hard... I did it in a weekend for my "Advanced Computer Graphics" elective in college using OpenGL and that was 2008. But this is kind of cool... it's more of a tiny ray tracer and... well to borrow the title... old-school arcade game.

> it's more of a tiny ray tracer It's a ray caster, where the rays are sent out from the camera to intersect the map. With ray tracers, the rays are sent out from the light source, IIRC. Your point on OpenGL is valid, but that just removes all the learning from it. OpenGL does so much of the grunt work for you. This kind of old-school game engine is a great learning experience.

What you mean is forward ray tracing. But "ray tracing" usually refers to the variant sending rays from the camera as forward ray tracing is almost never used.

Ray casting on the other hand is basically ray tracing without any reflections or shadows, in other words each ray stops with the first collision.

Re: Build your own old-school 3D shooter in a weekend

#39

I'm way out of practice with C++. (It's been since like 2006.) Framebuffer clear function appears to allocate a new vector. Does std::vector automatically handle the memory releases? This is called every frame, so I wanted to check here to see if I'm crazy or not.

> Does std::vector automatically handle the memory releases? Yes. What is going on here is that "img" is being assigned. The "old vector" will have its destructor called, which will call the destructor of all of its elements by default. ------- I assume you're talking about this code: https://github.com/ssloy/tinyraycaster/blob/master/framebuff... void FrameBuffer::clear(const uint32_t color) { img = std::vector (w*h…

Instead of doing a memset, I'd recommend using std::fill (which will likely call memset or another fast implementation behind the scenes): it makes it clear what you are doing, and preempts questions of "is this legal to do" (which it is, but only for POD data types).

Re: Build your own old-school 3D shooter in a weekend

#40

Earlier quoted context omitted.

> Does std::vector automatically handle the memory releases? Yes. What is going on here is that "img" is being assigned. The "old vector" will have its destructor called, which will call the destructor of all of its elements by default. ------- I assume you're talking about this code: https://github.com/ssloy/tinyraycaster/blob/master/framebuff... void FrameBuffer::clear(const uint32_t color) { img = std::vector (w*h…

Instead of doing a memset, I'd recommend using std::fill (which will likely call memset or another fast implementation behind the scenes): it makes it clear what you are doing, and preempts questions of "is this legal to do" (which it is, but only for POD data types).

I'm far more inclined toward

  img.assign(w*h, color);
myself.
Post reply on HN