3D like Wolfenstein

Recently, I saw this video on Youtube and tried to do some Wolfenstein-ish 3D graphics in Processing by implementing the math shown in the video. https://youtube.com/watch?v=eOCQfxRQ2pY

It took me a while, but I did it, finally. Here it is: https://dropbox.com/s/wxia0lzqv4tmxvi/wolf.zip?dl=0

It's just an experiment, so there is no texture mapping or collision detection, but I thought, it's worth sharing. It also may not work as expected when your leave the area.

Move with 'wasd'. Press 'v' to toggle top-down and 3D view. The top-down view shows where the lines for probing the environment hit something. wolf

Cheerz!

Comments

  • Impressive!

  • Looks good -- thanks for sharing!

    Quick questions (I haven't looked at your download code):

    1. did you do use a raycasting approach, like in your reference video?
    2. are you familiar with the QuesyCam library and the mazerunner demo, and/or did you try using it?
  • Thanks for the comments.

    Yes, I did it like in the video with a simple raycasting technique. I'm aware of QuesyCam, but for this I wanted to do it "the old way", for fun and as a challenge for myself.

  • edited March 2018

    I saw videos on youtube about making wolfenstein clones just a few days ago and was thinking of doing the same thing, looked up to see if it had been done in processing before and it hadn't..weird. Great job on it looks great, fun demo.

    I edited the code for better movement/key handling. I would highly recommend working with PVector in the future instead of defining x and y variables too. I was stubborn on this for a long time, but it's definitely worth it, lots of benefits.

    Also started to implement some collision detection. It kinda works for forward movement but I wasn't able to figure out your intersect system to get collision for reverse('s key') movement. I hooked your xhit1 and xhit2 variables to determine the distance from the wall if moving forward. If you can create a backwards ray and get that intersect and store it in hitRev it will work the same.

    With this collision when you hit a wall you come to an abrupt stop, because the player doesn't have a velocity vector. Reworking the player to use PVector for location and velocity would make things much easier going forward.

    https://pastebin.com/BiMRuK69 all of my changes were in wolf.pde, here's my copy

    edit: Worked on it more. Added mouse look in 3D mode as well as strafe, and full collision detection. Converted it to using PVectors almost anywhere it made sense, switched from degrees to radians, added 2d minimap. Refactored stuff for readability.

    https://pastebin.com/zgjc5RVf wolf.pde https://pastebin.com/3GiYz11D player.pde

    edit2: yet another version. More PVector implementation and refactoring. Lots of small features and bug fixes, optimized, runs at 1000fps with less than 10% cpu load for me.

    https://pastebin.com/zVpvtEQD wolf.pde https://pastebin.com/qcKrpBFu player.pde

Sign In or Register to comment.