Another cool feature was the friction map I implemented. The requirement was that the cars wheels would have to behave differently on oil, grass and the road, independently.
Every other team decided to go the bounding radius way, which bogged down their programs considerably. Since we had a continuous customizable track rather than a given track comprised of sections (a requirement we decided to boost also), we couldn’t use bounding radiuses, also bounding radiuses weren’t ideal considering the oil slicks sphere would be in a tracks bounding sphere.
I designed a system very similar to a height map in the sense that for a given resolution, we would have the friction values for every point in the world (using interpolation). Now to build this map, I would render the custom track and the oil slicks separately in the stencil buffer with given values, and then save that buffer into a 2D array with given min and max world coordinates in order to map table indices to world coordinate. This would let us query our friction data in O(1) time, let us create wacky and wonderful tracks at runtime in our editor, and have very high resolution friction data.
The image that follows with the green and red dots all over the map show the data in a very low resolution way for debug purposes.
I designed a system very similar to a height map in the sense that for a given resolution, we would have the friction values for every point in the world (using interpolation). Now to build this map, I would render the custom track and the oil slicks separately in the stencil buffer with given values, and then save that buffer into a 2D array with given min and max world coordinates in order to map table indices to world coordinate. This would let us query our friction data in O(1) time, let us create wacky and wonderful tracks at runtime in our editor, and have very high resolution friction data.
The image that follows with the green and red dots all over the map show the data in a very low resolution way for debug purposes.









