So today has been a slow start. It is 10.51 and so far I have got no further than last week.
After re-running my work last week the car was not looking correct, it was driving from the bum – it was all wrong.
So I had to dig out my old licence for 3ds MAX, update it all and do some new renders. It now thankfully looks great, but what a way to spend a few hours.

There is a problem at the moment that the parallax backgrounds do not wrap, well not a problem just not written it yet so now I have the car looking correct I am going to go fix that.

Lunch – parallax backgrounds are fixed, after lunch time to try and get some scenery in place


The thing about scenery (and collisions) is that this game is pseudo 3d. So whilst everything looks 3d it is infact a 2d game being projected in a 3d way with sprites etc. generated for that required look. So collisions etc. are actually worked out in a 2d fashion, which is both fast & easy.

As you can see from previous videos our road curves and has hills, but the real clue as to how it is done is those tell tale stripes. They not only give a sense of movement but each stripe is a segment in the road. In a proper 3d game you have fancy algorithms to determine what can be seen and what can not be seen, this is not only done to reduce the amount of drawing but to make things more realistic.
This game has a ‘finite distance we draw to in the distance (and later I will add fogging to remove the harshness) and you can not turn around – you always point forwards.
We use all these facts to make life alot easier, and we draw our road using what is know as a Reverse Painters Algorithm (Click here to read more) so we don’t waste our time drawing things that are not visible in the final render.
However for the scenery we need to do that as a Painters algorithm so things are overlapped correctly.
So firstly I looked at switching the entire thing to Painters algorithm, but after running some statistics we would waste ALOT of time drawing road that can not been seen.
I then went back to the reference of codeInComplete Javascript racer, first thing I did was “borrow” his scenery until I get the correct stuff done. Second thing I noted is that he hit the same issue and decided to do two loops, first draw the road using reverse painters algorithm, then draw the scenery using painters algorithm.
The final loop also has clipping for things that are partially visible.

So what I have to do next is insert drawing of scenery into the algorithm.
This is a two step process
1) Extend my class that stores details on each segment (currently road width, start height,end height & color) to say on both the left and right what scenery object we want e.g. tree, log etc.
2) Extend my drawing algorithm to draw these.

So without further rambling, time to get programming.

Well I managed to sorta get that working, it draws, everything scales as you move but I have not done the hiding/clipping yet as I ran out of time but it looks pretty good.


Until next week