Using 2D sprites in a wolf3d style raycaster

Started by
4 comments, last by Entelechy 19 years, 8 months ago
Hey, I've been working on a simple raycaster (that I eventually hope to make some sort of cell phone game out of) that's pretty optimized (no floating point and tables and good loop structure) but I can't figure out how to put in 2d sprites. Everything on the internet says that you create a z-buffer for the distances of the wall slices, project the sprite onto the viewing plane in terms of x, and just scale it. The problem is I have no idea how to project it. I figure it has something to do with starfield warp style scaling but beyond that I have no idea. Any help would be appreciated!
--------------Frank - http://hostultra.com/~entelechy
Advertisement
How Wolf5K Render's Sprites

It's done using the z-buffer. The trick is properly calculating your z-value for the vertical strip when you render the walls which are completely rendered before you bother rendering any of the sprites.

The full working code

That link goes directly to the page with the completely deobfuscated www.wolf5k.com code so you can see exactly how it all fits together.

There's a rumor that a C++ translation is in the works... So if you don't fully understand the &#106avascript, the C++ version will give you another perspective.
http://www.icarusindie.com/DoItYourSelf/&#106avascript3D/deobfwolk5k.php <--- full code<br><br>http://www.icarusindie.com/DoItYourSelf/&#106avascript3D/lesson14.php <-- sprite specific tutorial
Quote:Original post by Entelechy
(that I eventually hope to make some sort of cell phone game out of)


Do you mean that it'll be a game about cellphones, or that you'll be able to play it on your phone?
Roger that, lets run like hell!
Quote:Original post by Interesting Dave
Quote:Original post by Entelechy
(that I eventually hope to make some sort of cell phone game out of)


Do you mean that it'll be a game about cellphones, or that you'll be able to play it on your phone?


I'm assuming you'll be able to run it on your cellphone [grin]
I've never been able to do this - and set up a thread on this before. Never got anywhere with it [sad]
Good luck!

[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]

Wow. I found wolf5k a while ago, but I never was able to find the deobfuscated code. Thanks, I did some JS programming a while ago and I read his homepage about the xbm's so I htink I'll get it.
--------------Frank - http://hostultra.com/~entelechy

This topic is closed to new replies.

Advertisement