Okay, so this week I’ve been doing lots of maths, and finally cracked how to calculate – using simultaneous equations – how to find the intersection of two parametric lines.
That has enabled me to figure out how to render at least vertical walls. My problem left is figuring out how to do texture mapped floors and ceilings.
I looked up “flats” for the DOOM iD-1 engine, but don’t fully understand it, plus it seems over-kill for what I am aiming for. The idea is to make a Wolf3D engine but with arbitrary walls(which poses no problem to me), and to have the same floor and ceiling throughout a level(map or stage, whatever) – similar to the fact that Wolf3D uses the colour grey to represent a floor or ceiling!
So I am going to make it as simple as I can get it – split the screen into two rectangles, one for the top half of the screen to represent the ceiling, and one for the floor.
Now, for perspective, I noticed in the C64 version of Space Harrier, the block rows(representing the game world floor) towards the horizon are thinner than the block rows coming towards the player: This is obvious as objects appear smaller in the distance, but larger close up. So that’s a task for the vertical side of rendering…
Not quite sure how to go about the actual mapping of the floor texture itself – short of going all out on a polygon rendering fucntion! I think what I can do, though is maybe plot lines and clip them to the rectangles. I would be creating a grid for the game world anyway, so the only thing I would have to map to the view is the points of each square tile of the floor, and can go for either a mirroring option for the ceiling(just flip the floor) or can go for an open sky option with wrap-around horizontal texturing.
I would prefer a textured floor though! ^_^
Anyway, first thing I need to do is create a maths engine in Java. Once I have finished that I’ll move on to a level creation tool for plotting lines, which I had done before in C++ but didn’t have the level of maths knowledge to make it usable(which I now have! Hurrah!). Really excited about this project as it’s been bugging me for almost a decade…
Some might wonder why I am going through the pain of writing a 3D engine in software, when an API can do all the donkey work for me. Well, I simply want to increase my maths and programming knowledge. Its the challenge, and the reward of knowing that I can create a “living” 3D world from scratch and without the aid of APIs(although they can do faster, more efficiently, and even better).
Still, I’m going to make a first test game that’s slightly more advanced than wolf3D and then maybe have a crack at a full polygon engine afterwards. I just needed to “talk” about this little project as it really means a lot to me. I think I have a weeks holiday in April(better check with them at work!), so that’s when I will bang out the first test demo and post it here.
(sorry for the long winded post!) ^_^