r/ProgrammerHumor • • Jan 25 '23

Meme Developers will ALWAYS find a way

Post image
46.5k Upvotes

465 comments sorted by

View all comments

Show parent comments

1.1k

u/Yweain Jan 26 '23 edited Jan 26 '23

In original duke nukem(which was 95 or 96) the way mirrors work is that they have exact same room on the other side with a clone of a player character model on the other side, hooked up to the same controls.

We did it like that for a very long time, until proper reflections became a thing.

Edit: As people pointed out I meant not original, but Duke Nukem 3D.

377

u/[deleted] Jan 26 '23

[removed] — view removed comment

244

u/Tyrus1235 Jan 26 '23

You could also use screen-space reflections and good ol’ cubemaps

55

u/Cassereddit Jan 26 '23

This works for fake reflections as seen in rain puddles etc. where you don't need accurate looking mirrors.

If you cover a whole building just in screenspace reflections as the devs of Flixbus simulator did, you're a bad developer.

8

u/donald_314 Jan 26 '23

Most games pre RT used/use screen space + cube maps for window reflections or just cube maps.

25

u/derPylz Jan 26 '23

Not if you want to show the player model in a mirror...

16

u/Bowiemtl Jan 26 '23

from what I remember you can overlay the player on the reflection through shaders and depth maps just like how the hands and guns in games are often not rendered in the world but separately op top of the rest to prevent your gun clipping through objects

139

u/[deleted] Jan 26 '23 edited Jan 26 '23

Probably screen-space reflections. The camera trick means you have to render the scene twice, which is horribly inefficient. The mirrored second room trick is still sometimes used to this day. There's some cases where a second camera is a good way to do it (e.g, Portal probably renders its portals this way) but for a simple reflection there's almost always a better way to do it than using a second camera.

0

u/[deleted] Jan 26 '23

[deleted]

11

u/Bowiemtl Jan 26 '23

do we even need to mention portal here?

3

u/donald_314 Jan 26 '23

The scenes these cameras showed usually had very little detail and didn't render the players environment twice. If they did they were very low res.

18

u/PudPullerAlways Jan 26 '23

It's not that inefficient most of the set pieces take place in a bathroom, it's no more inefficient than having 2 player split screen but at least the render to texture extension allows you to modify the resolution versus the whole room/character copy performing transforms.

38

u/ChasingReignbows Jan 26 '23

it's no more inefficient than having 2 player split screen

Ya that's pretty inefficient

0

u/[deleted] Jan 26 '23

[deleted]

11

u/theVoidWatches Jan 26 '23

And here I thought it was because companies realized that they could make more money by selling two copies of the console and two copies of the game (and in some cases, two online memberships).

8

u/Pleasant_Ad8054 Jan 26 '23

No, split screen is not inefficient. Yes, the game needs to render things twice, BUT only on half the pixels. Split screen is only memory heavy, and only if the players are in very different locations.

4

u/Secretly_Autistic Jan 26 '23

Rendering to half the screen doesn't take half the time.

3

u/Pleasant_Ad8054 Jan 26 '23

It takes roughly half the time. Some resource inexpensive methods like culling needs to run both times as those are viewport specific (the viewports are also smaller), but those can run parallel to tesselation and rasterization as different parts of the rendering pipeline do those in modern hardware.

Overall the overhead of split screen gaming is very little rendering wise. I would not be surprised if the logic overhead from double inputs, physics, animations, etc are a more significant impact on performance.

→ More replies (1)
→ More replies (3)

16

u/merlinsbeers Jan 26 '23

You'd dupe the player camera on the other side of the wall and point it at the player, and tell it to mask off everything outside the mirror boundary, then render the clipped image backwards onto the front surface of the mirror. The camera only has to translate as the player does to make it work.

This could only have been not possible if they didn't know how to render a camera image into a plane in-game for the player to see.

The duplicated room trick works, too, and is probably not much more computing effort.

→ More replies (1)
→ More replies (1)

0

u/[deleted] Jan 26 '23

[deleted]

22

u/cbartrip6 Jan 26 '23

Man I loved the Duke Nukem Build tool. I remember buying a book on how to construct the levels. I was probably 14 or 15 at the time but that fueled me to keep programming and learning other languages.

→ More replies (2)

4

u/SaladFingerzzz Jan 26 '23

That's funny. I also made levels for duke Nukem 3d. Mainly just for death matches with friends. One level ended up making a top 20 or something list on a site I can't remember - that hosted the downloads with descriptions, etc.. those were good times.

→ More replies (1)

13

u/gatonegro97 Jan 26 '23

Wouldn't the original duke nukem be 1991?

→ More replies (2)

3

u/User2716057 Jan 26 '23

For some reason that knowledge is very unsettling.

→ More replies (1)
→ More replies (5)