Jump to content




Wolf3d-style 3d engine (proof of concept)


56 replies to this topic

#41 jesusthekiller

  • Banned
  • 562 posts
  • LocationWrocław, Poland

Posted 17 June 2013 - 03:02 PM

I thought I'll share it, created 3D game using this engine couple days ago, so here it is:

http://www.computerc...__fromsearch__1

#42 GopherAtl

  • Members
  • 888 posts

Posted 17 June 2013 - 06:35 PM

View Postbillysback, on 17 June 2013 - 01:14 PM, said:

I thought this would be the most appropriate place to share this, as it is this.

Earlier Gopher said about entities scaling badly and stuff, so to test this theory I tried it out. So far I have done nothing but prove him correct, however whilst playing around with his code I added a few new features :P

Here's a pastebin:
http://pastebin.com/VHrMFTE7

what I added:
"bobbing" - you bobb when you move now... rather simple.
"vision" - adds vision distance to the game, can't see anything but a gray silhouette when out of vision radius
"mouse" - can control the game with the mouse (will explain later)
"sprint" - lets you move faster, toggled by middle mouse button or "e" key
"white_circle" - fits with ceilings_floors and vision kinda, I don't like it tbh
"ceilings_floors" - makes the floors lightGray and the ceilings black

NOTE: all of this can be toggled off at the top of the code with the "settings" table, just make things true/false

mouse controls:
clicking the left quarter of the screen with your left mouse button moves you left,
clicking the right quarter of the screen with your left mouse button moved you right,
clicking the top-middle quarter of the screen with your left mouse button moves you forwards,
clicking the bottom-middle quarter of the screen with your left mouse button moves you backwards,
clicking the right side of the screen with your right mouse button makes you look right,
clicking the left side of the screen with your right mouse button makes you look left,
clicking the middle mouse button will toggle sprint
NOTE: mouse_drag is enabled so move your mouse slightly side to side inside one of these zones to move properly

this isn't trying to steal Gopher's thunder or anything, it's just me sharing the results of what Gopher produced, btw Gopher, this is awesome :D

I might still try and work on getting entities to work but I dunno...
maybe adding switched and doors would be cooler, with the use-item key being F or clicking the middle of the screen.

(quoted billysback's whole post to save it from botp hell)

billysback + jesusthekiller: Excellent, I'm glad to see people working with this code :D Keep sharing anything you make!

#43 ElectricOverride

  • Members
  • 94 posts

Posted 01 July 2013 - 11:47 AM

View Postoeed, on 28 February 2013 - 10:10 PM, said:

Wow.
Can't believe how small it is too, only 176 lines!
Does anybody have the origional copy of this when it was only 176 lines? I want to see if I can make it even smaller!

#44 TableCraft0R

  • Members
  • 63 posts

Posted 24 July 2013 - 08:37 AM

Minecraft on minecraft?

#45 RatcheT2497

  • Members
  • 72 posts
  • LocationSlovakia

Posted 14 September 2013 - 01:53 PM

Wow. In the future, we will have Doom CC! And Wolfenstein CC! And CC-Quake! (I can't think of more names :/)

#46 neptune12100

  • Members
  • 13 posts

Posted 08 November 2013 - 10:43 PM

I tried to make a raycaster in python (with pygame). I failed miserably.

#47 Gumball

  • Members
  • 254 posts
  • LocationFairbanks, Alaska

Posted 22 May 2016 - 07:06 AM

I myself and trying to make a raycasting method, I have it able to draw currently, as in an array specifying a color, and distance, and it does simple math to calculate the lines to draw, but for the love of god making it GET a view is hard.

#48 Gumball

  • Members
  • 254 posts
  • LocationFairbanks, Alaska

Posted 24 May 2016 - 07:07 AM

Whilst this is EPIC, this is technically NOT 3D. It is a 2d plane mapped with perspective to give an illusion of 3D. Minecraft would be impossible to implement. Portal, thats iffy. Take example of how you cannot look up and down. Portal COULD work, but it wouldn't be able to work the best.



#49 SquidDev

    Frickin' laser beams

  • Members
  • 1,402 posts
  • LocationDoes anyone put something serious here?

Posted 24 May 2016 - 03:43 PM

View Postbluebird173, on 24 May 2016 - 07:07 AM, said:

Whilst this is EPIC, this is technically NOT 3D. It is a 2d plane mapped with perspective to give an illusion of 3D. Minecraft would be impossible to implement. Portal, thats iffy. Take example of how you cannot look up and down. Portal COULD work, but it wouldn't be able to work the best.

Technically all 3D on a computer is just a 2D plane mapped to give the illusion of 3D. It wouldn't be too hard to adapt this to look up and down either: just adding pitch as well as yaw. The real limiting factor with ComputerCraft 3D engines is performance. Lua is not a great number crunching language and so any implementation will be reasonably slow. This combined with the 20fps cap (due to the server tick rate) means you're never going to get a very responsive game.

#50 LDDestroier

  • Members
  • 1,089 posts
  • LocationACDC Town

Posted 24 July 2016 - 03:21 AM

Is there a variable that I can modify to give this an FOV of 360 degrees?

#51 Saldor010

  • Members
  • 467 posts
  • LocationThe United States

Posted 24 July 2016 - 03:33 AM

You guys do know this is an almost 3 year old thread, right? :mellow:

#52 LDDestroier

  • Members
  • 1,089 posts
  • LocationACDC Town

Posted 24 July 2016 - 05:25 AM

View PostJiloacom, on 24 July 2016 - 03:33 AM, said:

You guys do know this is an almost 3 year old thread, right? :mellow:

Guy (singular), and yes.

#53 Saldor010

  • Members
  • 467 posts
  • LocationThe United States

Posted 24 July 2016 - 01:51 PM

View PostEldidiStroyrr, on 24 July 2016 - 05:25 AM, said:

View PostJiloacom, on 24 July 2016 - 03:33 AM, said:

You guys do know this is an almost 3 year old thread, right? :mellow:

Guy (singular), and yes.

I was referring to BlueBird and SquidDev as well.

#54 LDDestroier

  • Members
  • 1,089 posts
  • LocationACDC Town

Posted 24 July 2016 - 05:34 PM

Oh, sorry. Didn't realize.

The reason I ask being that I'm trying to rig sine sure of VR four monitor thing, and 3D Maze uses stitch to wrap around all four.

Is FOV changing possible with this, and if it is, how?

#55 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 04 August 2016 - 03:38 AM

The viewing angle of each screen column is tracked by scan[x].angle, set during initialisation at line 151.

Increasing those angles leads to a wider FOV, decreasing them shrinks it.

#56 jakejakey

  • Members
  • 98 posts

Posted 11 November 2016 - 03:32 PM

View PostremiX, on 01 March 2013 - 04:47 AM, said:

WOw, this is amazing xD

Try add multiplayer support :o
This isn't a game, its a rendering engine, therefore multiplayer is impossible. Unless you want to have social rendering LOL

This post probably doesn't belong here, but is it possible to have more layers of rendering? I mean instead of a floor, then a layer of blocks, then a ceiling.

#57 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 12 November 2016 - 01:41 AM

This engine is built to handle 2D maps in a similar manner to Wolfenstein (although it doesn't support texturing) - it works under the concept that in any given column of the screen, you'll only ever be able to see part of one wall. By figuring out the distance between that part of the wall and the camera (by casting a ray from the camera along an angle corresponding to the current screen column), and rendering a vertical line of a proportional length more or less centered within that column on the screen, once you've processed all display columns you've got a 3D representation of the 2D area.

id's next engine (used by Doom) was a little closer to 3D, in that the height of the floor / ceiling could vary at each map location (though it was still only possible to have up to one gap between the two). This made it a good deal more complex, as finding the closest wall to the camera (eg created by a raised floor or lowered ceiling) did not ensure that you'd found the only wall that needed to be drawn within that display column.

Having multiple gaps per section of the map would ramp the workload even higher - each would add another couple of checks to be performed by each ray for each map location. Sure, anything's possible, but performance would definitely be suffering by that point.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users