It’s week two on my one day a week game creation.
Last week (Click here) I started my work on my Pseudo 3d racing game engine.
I managed at the end of it to get a smooth running straight road.
This week I plan to first add curves (the hardest bit) and what else.. well time will tell.
So straight away it was back to the Lous Pseudo 3d page.
Whilst the maths for a curve is well more maths (this is going to need alot of optimisation!), doing so means first I need to introduce a concept I thought I could get away with not putting in place for a while. That is actual creation of a track using segments.
My eventual goal/idea for the game is to generate the courses based of a fixed seed, so sorta procedural style. For this I planned to create a number of segment styles & rules on how these can be interconnected dependent on the difficulty of the level then let the random number generator kick out of a level.
Segment types are for example :
1) Short straight
2) Short shallow curve to the leftt
3) S-bends
etc. etc.
There will be ALOT of these and alot of rules, but you get the picture.
I need to create some VERY basic segments now as I need to sequence things together for testing. Last week I just kept throwing another straight in, now I need some segment rendering & planning.
So first I must write some code that makes zero difference visually, then I can add curves.
+1.5hrs Ok, adding that wasn’t hard, but it pointless doing a picture as it looks EXACTLY the same.
So after a couple of hours work and a couple of hours of not working due to builders repairing things in the house I have curves and they look good and move nice and smooth.
Now time to get some hills in, these according to everything I have read are relatively easy. Currently Y is directly linked to Z (distance). All hills do is put some vertical offset on this. It is really quite simple but very convincing. Hopefully I can get this done before lunch so this afternoon I can add a nice background and a car to make things looks more pleasant.
So hills took ALOT longer than I thought it would, longer than curves!
I cursed myself by saying it was easy
At first the entire screen went up as I forgot to move the camera, then I fixed that but there was not hills at all!!!
If I turned the hills offset up to a mental value (so height of 10000 rather than 60) they displayed indicating a maths issue that took ages to track down, turned out after 3hrs of blindly looking I had
+ self.segmentLength
instead of
* self.segmentLength
Even though I checked the code many times I just kept reading that as correct despite my notes and maths saying the opposite !
I then had these horrible disconnects (see picture below) – now I like retro but that is to much !
This took a while to hunt down as well but it was obvious what part of the renderer it was in, once found I got this 🙂
Below is a video of this weeks stuff running.
It is not where I hoped to end up today, I was hoping for at least a car and possibly background graphics but the engine is coming along.