Jump to content
  • Advertisement
Sign in to follow this  
Entelechy

Using 2D sprites in a wolf3d style raycaster

This topic is 5113 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
Advertisement
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 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?

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!