Sign in to follow this  

Using 2D sprites in a wolf3d style raycaster

This topic is 4862 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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 javascript, the C++ version will give you another perspective.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
http://www.icarusindie.com/DoItYourSelf/javascript3D/deobfwolk5k.php <--- full code

http://www.icarusindie.com/DoItYourSelf/javascript3D/lesson14.php <-- sprite specific tutorial

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 4862 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this