More of a first person stabber, in fact.
Doom used binary space partitioning - a different beast. Blake Stone used raycasting, IIRC.
But this is niiiiiice!
I wish more people could code as simply and straightforward as this.
They're both raycasting - just throwing a light ray to see where it hits. But Wolfenstein does it with a simple grid layout. Doom uses BSP to divide the casting space up efficiently so you can get away from the grid.
See here for some details: http://bespin.org/~qz/pc-gpe/doom.txt
Wow, cool. I was half expecting each line to be 100 bajillion characters long, but that code is really clean, simple, and easy to read through and understand.
Yes, I am aspiring to this level. He's awesome.
Just out of curiosity, what do you prefer instead?
Oh geez, that's right. I used to know all that stuff.
I need to go dust off my Doom & Doom II mods.
I can't get the demo to have a decent framerate in Firefox... It only advances through the frames when my mouse is moving, and it's eating a vast amount of CPU.
"Stop using Firefox then," said every frustratingly myopic coder ever.
Turns out it works in chrome.
What I hate most about js is the overuse of inline functions... within inline functions, within inline functions.. That's just crazy. And if you miss 1 comma everything goes boom.
This code, however, is a wonderful example of clean code that can be done in JS. Not hacky, tricky stuff that some were expecting.
It's not per se elegant, but this is what I would call 'crystallizing' your code, which is refining it down to exactly and only what it needs to be. No extra variables or functions that you may need later, or might be cool at some point.
Every single thing here is used and nothing wasted, no extraneous junk to muck things up. And that's why they can keep it short, and explain how the whole thing works beautifully.
And now is the time that other coders will grab it and muck it all up
What is your definition of elegant? It's OK to pay something an unreserved compliment. That doesn't make you weak.
"Pleasingly ingenious and simple" is what I go by and this fits that definition pretty darn well.
I'm glad you put that aside, because that wasn't my intention. I just enjoy hearing about what people like to go along with what they don't like.
next page →