6 ms·
A first-person engine in 265 lines (2014)
- CryoLogic 8y agoDoes this actually count as 3D? I thought 2.5D was the term used for 2D assets used in a way to appear 3D. Pardon my lack of familiarity with game engines if I miss-understood this.
- onion2k 8y agoA "first person engine" could be ray-casting on a 2d map like the original Wolfenstein, or on a 2.5d map like the original Doom, or actual 3d like Quake and everything since. It's a broad term. The fact it isn't called a 3d engine, to me as an old person who played Doom on its release, makes "first person engine" a more appropriate. name
- chungy 8y ago2.5D is more of a retronym after the age of "full" 3D engines came to be. Before then, we'd call anything 3D that looked 3D, and the lines do certainly get blurred. Wolfenstein 3D for example is practically a 2D game, you could redisplay it as a top-down shooter reminiscent of early 1980s games (much like the early Wolfenstein games, actually), and not lose anything. There is no Z axis in consideration for any game logic. Doom, on the other hand, actually does have a Z axis, determining which floors can and cannot be reached, how they are displayed, whether projectiles hit enemies or not, and so forth. The (original) engine and map format don't allow any rooms-over-rooms though, so it is still considered 2.5D -- somewhere in between a 2D game and Quake.
- blihp 8y agoI remember many of the isometric drawn/pre-rendered games with a fixed PoV (i.e. Zaxxon etc) being described as 2.5D back in the day. We knew they weren't exactly 3D but then again, they weren't your typical 2D platformer/side-scroller either. Battlezone was considered a 3D game back in its day so the rendering technology wasn't really the dividing line. It was more a question of if the game environment being navigated was 3D and if it had a reasonably realistic spatial representation on the screen.
- Andrex 8y agoTo make things more confusing, 2.5D these days is also often used to describe (actually) 3D-rendered sidescrollers, like the New Super Mario Bros. games.
- Wowfunhappy 8y agoIndeed. The term 2.5D has been obscured to the point that it no longer carries any useful meaning. We should all stop using it. New Super Mario Bros is a 2D platformer with 3D graphics.
- bluedino 8y agoZaxxon was definitely 3D. You scrolled forward, could move side to side, and could also change height (and you had to, to avoid obstacles and shoot enemies)
- eps 8y agoThat's not even 2.5D. 2.5D started with Doom and it refers to games where you can move on Z axis, but can never be at the same XY point at more than one Z. That is you can't walk under or over some other path.
- bluedino 8y agoThe way sectors work in doom you can't have one floor above another (like a bridge), however, you can fan fall off a ledge.
- eps 8y agoSure. You can’t get under the ledge though. I don’t remember full details, but the gist of it was that Carmack optimized rendering algorithm around this specific restriction.
- 2038AD 8y agoFWIW Romero considers Doom to be 3D [0]. Although, that is with the choice of 2D or 3D. [0] https://twitter.com/romero/status/826494127055466497 https://twitter.com/romero/status/826494127055466497
- deleted 8y ago[deleted]
- earenndil 8y agoI thought 2.5D was used for 2-d rendered games that had depth, like zelda: a link to the past (very much a 2d game where you can jump down cliffs, but not climb up them).
- keypusher 8y agoPreviously: https://news.ycombinator.com/item?id=7842037 https://news.ycombinator.com/item?id=7842037
- bl4ckneon 8y agoShould there be a 2014 tag? Pretty cool article though!
- dang 8y agoAdded. Thanks!
- hrydgard 8y agoPedantic correction: Daggerfall didn't use a raycaster, it was a full polygon engine (although with sprite characters). Its predecessor Arena did appear to use one though.
- sclangdon 8y agoDuke Nukem 3D didn't use raycasting, either [0]. 0 - http://fabiensanglard.net/duke3d/build_engine_internals.php http://fabiensanglard.net/duke3d/build_engine_internals.php
- praptak 8y agoI'm not convinced the complexity is really independent from the size of the map. With large emptyish maps the rays can travel a long distance before they hit something. And tracking the ray is linear wrt its length.
- joshvm 8y agoComplexity is proportional to the size of the view distance (linearly? Or square if you do a field of view). The map size doesn't matter, assuming array lookup is instant.
- taneq 8y agoAgreed. It's linear in the average view distance per column, which has the map size as its upper bound. I guess you could make a case for the average view distance being independent of map size for a given map style.
- cannedslime 8y agoDrunk vision/walking: var i = 0, s; setInterval(function(){ i+=0.02; s = Math.sin(i) camera.focalLength = 0.8 + s * 0.2; player.rotate(s * 0.02 - 0.01); }, 16);
- billpg 8y agoIf only it could have been reduced by just nine lines.
- viralpoetry 8y agoWhat a good website, other articles are even more interesting to me. thanks
- taneq 8y agoAah, this brings back memories of people writing raycasting engines in QBasic. That language was really not suited to this kind of thing, but people made it work! :D
- mysterydip 8y agoI loved how much people made QBasic do that it wasn't suited for, part of what made the scene great :)
- krige 8y agoAlso compare this: https://lodev.org/cgtutor/raycasting.html https://lodev.org/cgtutor/raycasting.html It's a bit old but also explains a lot of the underlying logic. And it's not written in javascript so it may be more readable to some.
- userbinator 8y agoI believe this is the smallest application of the concept I've seen, using only 128 bytes of binary: https://news.ycombinator.com/item?id=16538367 https://news.ycombinator.com/item?id=16538367 For example, raycasts run in constant time, so you can load up a massive world and it will just work, without optimization, as quickly as a tiny world. If someone has some more time to try this out, the layer images of the 6502 processor here might make a good world to play around in: http://www.visual6502.org/images/6502/layers_index.html http://www.visual6502.org/images/6502/layers_index.html (that site appears down/intermittent currently, but archive.org has copies.)
- mrspeaker 8y agoThat article is great - though (after looking at the shadertoy version https://www.shadertoy.com/view/MdXXz2 https://www.shadertoy.com/view/MdXXz2) I didn't know that WebGL didn't have an XOR operation. Is that true? Does anyone know more about that?
- lbj 8y agoFantastic explanations & kudos for boiling this down to the bare essentials!
- atum47 8y agoI love this article since the first day I lay my eyes on it. The first time around I wasn't so much of good programmer to try and implement it myself, I now feel more confident, as soon as I get some time I'll get to it. I made a 3D version of a similar "game" some time ago using three.js, but it's not the same. I love those old graphics.