written by owen on 2023-Aug-07.
Today in the midst of doing the laundry I thought I should be able to remove the draw_line() calls that I use to highlight the current section of track. Then replace them with a single draw call made up of lines in model space. And it works! #lowpoly #gamedev #thread
Basically the track is a spline inside a giant cube that you drive along. The spline is first created in world space then the cube is generated around it. I convert all points into model space vectors centered on zero +-1. I keep both values in a array. Image
Physics is in world space while most of the rendering is done in model space. The track is a single linestrip that goes up the left, zipzag down the middle and up the right side. I always render the whole track from a display list because its just easier than culling it.
The highlighted parts of the track near the player are culled and only the side lines are rendered. Texture decals and signs fill in the details only in the sections nearest the player.
The advantage of this bright ontop of dark lowpoly track is that you can see the entire track no matter how far away you are from it. Very long draw distance without needing to be constantly culling - just draw it all. Let the GPU figure it out. Image
Somethings are rendered in "world space" and others in "model space" because its just easier for my limited math brain to work with. The track, decal textures, and highlighted section are model space so that I can group each into a single draw call with a single texture.
A thing to note is that I originally started coding the prototype in world space because its just easier for me to work with real numbers. I moved to the model space when I fully understood what I wanted from the pipeline. dont jump the shark by doing early optimizations! Image
It only took 3 years to get to this point of understanding, lol. The #gamedev race is not for the swift but those who enjoy incremental gains. Always be improving.
Retro colour theme
High lighted section versus regular
Debugging the texture quads
Some in game debug info
Long draw distance
The highlighted railings only
No decals, no track mesh
Full decals and decorations