Jump to content
IGNORED

Raycasting demo


Recommended Posts

Looks good. It seems to have an occasional visual glitch in jzintv but I can try it out on PAL later.

 

Will it eventually become a game or is it just going to remain a tech demo?

 

It would be nice if someone could make a game out of it, but at this point I'm just trying to stretch the capability enough to see if it's even possible. Due to the Inty's limitations, there are some real drawbacks to using raycasting:

  • The rendered image has to be monochrome without using sprites.
  • Having sprites be partially obscured by walls is problematic
  • The image uses 60 GRAM cards
  • Rendering is slow

I have some thoughts on these issues, but I doubt I have the time to fully implement them:

  • If you limit the viewing distance so that walls are never less than 1 card high, you could have the ceiling and floor be different colors
  • You could have sprites be partially obscured by assigning each sprite its own GRAM card and blanking out columns in the card (though I don't know how quickly this could be computed)
  • If you can detect where cards are either completely full or empty, you don't need a separate GRAM card for that block. It would mean allocating GRAM cards from a pool as needed, but it might speed up rendering and allow for a larger image (and free up cards for sprites). A larger image would also make the first point easier, though (increasing the minimum wall height).

At this point, though, the real performance killer is the multiplication routine, so none of this might be possible if a faster way can't be found. I'm taking another look at the table-based approach to see if some optimizations are possible. Unfortunately, I have another project that is suffering and I'm going to have to get back to it soon.

Edited by JohnPCAE
  • Like 1
Link to comment
Share on other sites

Have you thought about using the coloured squares mode? You'd get almost full screen at the cost of looking more chunky.

 

Not only that, but what about limiting the vantage angles? What if instead of an all around panoramic view, you present only a set of visible angles. Also, standardizing or limiting the playing field or wall layouts in some way may allow you to pre-compute the graphics of certain wall configurations at various angles.

 

-dZ.

Link to comment
Share on other sites

For a comparison there is MOOD on the C64 :-

 

http://www.youtube.com/watch?feature=player_detailpage&v=X3Oqz5WjDPI

http://www.youtube.com/watch?feature=player_detailpage&v=cceA9ZMtxaM

 

The other good things about coloured squares mode are that you aren't limited to VBLANK time to update the screen data and that you'll quarter the amount of data that you need to update per frame. Both of which will give you a FPS boost.

Link to comment
Share on other sites

Colored squares is probably the way to go. Maybe I'll take a stab at that next. In the meantime, here is a version with possibly the ultimate in unrolling the multiplication routine. Performance is definitely a little better, enough that rendering might be the bottleneck now.

raycast.zip

  • Like 1
Link to comment
Share on other sites

I finally got around to testing this on PAL hardware. In GRAM cards mode there are visual glitches in the top left bitmap as the walls are drawn and the same occasional screen stutter that you see in jzintv. Coloured squares mode works exactly the same as it does in jzintv.

Link to comment
Share on other sites

I'm sorry, is it supposed to be in Color Square mode? I see it as before, in regular GRAM tiles.

 

Never mind. I forgot to hit the action button. DOH!

 

Looking good!

 

-dZ.

Edited by DZ-Jay
Link to comment
Share on other sites

I found a way to make a couple of improvements to the raycasting algorithm:

 

- If a ray intersects a wall, don't test orthogonal walls beyond the distance to the wall that was found

- If you use the keypad to limit the view distance, don't test for walls beyond that distance

 

The first change improves the framerate in all cases and the second one only if you limit the viewing distance. However, the default distance when starting up is 32 units, which covers the entire maze. Even a modest setting like 6 units gives a huge improvement in frame rate.

raycast.zip

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

I got some more speed by skipping a couple multiply operations when they're not needed: if you're moving in a straight line I can reuse the same dx,dy values, and if you're turning in place they're zero. I also squeezed a little speed out of RenderCS(). A cart with multiply/divide support would definitely help, though...

 

(if anyone is contemplating a coprocessor cart, my wish list would be the following:)

 

- 16/32 fixed-point math support (everything that an 8087 can do)

- IEEE 754 32-bit math support(everything that an 8087 can do)

- 2x2, 3x3, 4x4 matrix support for fixed and floating-point math

- Advanced bit shift and rotate support

- Special support for shifting GRAM cards in 2 directions

 

I can dream... :D

raycast.zip

  • Like 1
Link to comment
Share on other sites

I found a bug in my multiplication routine and fixed it (multiplying by 0xDD was actually multiplying by 0xDB).

 

I also performed some analysis on some of the potential forms for some of the sub-multiplications and managed to find faster alternatives for quite a few (the higher-end ones, e.g. 0xC0 and up). I've included comments in the source showing the analyses, for anyone who is curious.

raycast.zip

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...