Procedural track generation
After tweaking the base kart controller (for straight line driving) I wasn't sure how to start on the more fun aspects (sliding, turbos, jumping, etc.), and thought it might be better to have a more representative track for this. As such, I've been working on procedural track generation, and it's far harder than I was anticipating!
My favourite Mario Kart track has always been Mario Raceway from Mario Kart 64. I like that it looks somewhat like a go karting track. I like there are some places that you can cut corners over grass/sand to save time. And I really like the Mario style bricks which inner-bound the track and are possible to be jumped over for major shortcuts!
Using this as a base, I've implemented the following (version 1, let's call it) track generation.
- create a branching wall structure, which acts as the guide for the track
- create a path which reasonably tightly follows the wall structure
- create a smooth race track along this path
1. Walls
The number of walls is controllable, but will probably ultimately be determined by the random seed. There is the possibility to favour longer sections or more curvy sections, but this hasn't been implemented yet. For now I am quite happy with the structures which get generated.
2. Path
For now the path tries to be equidistant from the wall at all times, and also tries to "cut corners" in any sections which are more V-shaped. However this doesn't cut off as much as I would like, and the equal distance which is maintained looks a bit boring. In any case I think this can be adapted in the future, and it is an okay start.
3. Track
I've used Path and CSGPolygon nodes to create the track. The results are not as nice as I would like though. There are many options for CSGPolygon and I've had a good attempt at tweaking them all. One major problem is joining the start and end of the track (it's not just simply a matter of setting path_joined=true). Aside from that, if the corners are too sharp the track will overlap itself, and I could find no way to texture the track in a realistic way (again corners being a major problem). I think this will do for now, as it gets me some reasonable tracks to test with the kart controller.
--
The environment is pretty boring. Some planned additions are the following:
- water
- sand
- walls which extend from the map boundary
- (possibly) varying heights
- trees
- street lamps
- advertising boards
- finishing line
Here is the current version in-game!
Retro Karting League
More posts
- Kart controllerApr 24, 2022
- Major systems, and first one to work onApr 05, 2022
- First postApr 01, 2022
Leave a comment
Log in with itch.io to leave a comment.