• entries
    222
  • comments
    607
  • views
    587895

Oldschool 3D

Sign in to follow this  
benryves

1050 views

All this DOOM work had got me interested again in simple 3D engines, and so thoughts turned to my favourite Z80 platform, the TI-83 Plus.

There are a handful of 3D engines out there for it already; Matt3D is a vector-based wireframe engine put to good use in a roller-coaster builder/simulation game and a racing game (that even supports two-player over the link port). However, it's 8-bit and so worlds created with it tend to be very small or distorted thanks to low-resolution (I tried writing a Quake game with it years ago).

The best "wall" engines (displaying a 3D world rather than a 3D object) have been the raycasters. Gemini impresses me the most; it's a Wolfenstein-level engine with objects, sliding "half-block" doors and moving wall blocks, all neatly texture-mapped.

I'm going to try, therefore, to get a vector-based "wall" engine (there must be a proper term for it) up and running. Keeping the map to 2D simplifies the maths a lot; hopefully with a few tricks things should be fast enough! Also, I'll use 16-bit arithmetic throughout to enhance the quality and scale of the maps.



Like DOOM, I'm isolating the vertices from the wall definitions. This way, I can cut down on the number of rotations/transformations required. The maths required to rotate a point around the origin is fairly simple;

Xr = Xo x sin(a) + Yo x cos(a)
Yr = Xo x cos(a) - Yo x sin(a)


For the moment, I'll use a simple lookup-table for wall heights. Ultimately, I'd like to have variable height walls, but these will do for the moment:



The translated X is just 48+(Xr/Yr), as the screen is 96 pixels wide.

Throwing in a few extra lines for walls...



As you might be able to see, there is no clipping if any part of a wall falls outside the viewing range. Also, the walls are not occluding eachother, something you'd really want.
Sign in to follow this  


7 Comments


Recommended Comments

Thanks [smile]
CoBB's PindurTI emulator supports GIF screenshotting natively; just Tab to start/stop recording. I tend to tidy them up a bit in ImageReady afterwards (drop colour depth, trim them a bit).

Share this comment


Link to comment
Guest Anonymous Poster

Posted

Very nice Ben. Can't wait to see some progress in this. You're my hero!

Share this comment


Link to comment
Guest Anonymous Poster

Posted

that was me btw. kv83. I thought he would show that, if I fill in the UserName field.... guess I'm wrong.

Share this comment


Link to comment
wait, the formula to rotate a point is really very simple. now I know why all my rotation code was so slow, (I wasnt using lookuptables but even for that it was slow) I was doing sin(arcsin(x/sqrt(x²+y²))+degree)*sqrt(x²+y²)
which is 1. much more complicated. 2. calling sin and acrsin for every x and y coordinate while with your formula I only need to calculate sin and cos once per frame (which is so fast that I dont even want to use a lookuptable anymore)

the new project looks great :) do you want to be able to use textures (of course low res and unfiltered ;) )in the end, or is flatshading the best possible on the ti?

Share this comment


Link to comment
Guest Anonymous Poster

Posted

Thanks for the rotation tip! Could you please explain how to derive the vertical line components height values? Is there a good source for this that I should be reading? -don't say your blog.

,MR Knoweverythingnot

Share this comment


Link to comment

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