-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|426|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
SoCoder -> Article Home -> Advanced Techniques


 
Jayenkai
Created : 17 October 2020
Edited : 18 October 2020
System : Windows
Language : Blitz

Looping Track Generation



Track Generator
You know what's a pain in the arse?
Generating a looping track, that loops properly, and doesn't break.
Always trying to get the start and end points to join up is SUCH an annoying thing to code.

Yesterday whilst playing Mario Kart Live, I (for some reason) found myself thinking about track generation. Can't imagine why..
And something popped into my head.

It's a little bit bland, in that it won't generate crossovers or anything, but..


 

Comments


Saturday, 17 October 2020, 08:53
Pakz
The track looks nice and rounded. Interesting how the blocks seem to be the base on which the final track is created from.

I installed b3d from itch and ran this code. The screen is flickering between black and the blocks and track line.
Saturday, 17 October 2020, 09:01
Jayenkai
OMG, skills forgotten..
I forgot to add the SetBuffer BackBuffer() to the top!!!
Saturday, 17 October 2020, 09:26
Pakz
The drive along the path part. Is that a wall tracing type thing?

I just had my own idea to create a path with a homing missile from points clockwise offset from the center But I really should concentrate on learning more how to do pixel art!
Saturday, 17 October 2020, 09:32
Jayenkai
Yeah, it simply finds the topmost pixel in the x-middle, then moves along one step at a time always searching for the next step, until it reaches the starting point..

.... hopefully it loops, or that bit's knackered!!!
Saturday, 17 October 2020, 11:43
Pakz
In that move along the path part. The d variable is set to -1 I do not understand this. It seems to not be used in the loop?

Is that part where it is set to -1 triggered when the position is out of bounds?
Saturday, 17 October 2020, 12:07
Jayenkai
Oh yeah! LOL. Normally I add an error/fail/break-from-loop if d=-1
Forgot that but.
I really did rush this!!!

The loop still breaks, mind. If d=-1 then nothing else will happen until TrackLong hits the limit, then it'll break from the loop.
Saturday, 17 October 2020, 12:49
Jayenkai
Updated with a couple of nice visual tweaks. You can now use left/right cursor to change the amount of smoothing!
Wednesday, 21 October 2020, 13:37
Jayenkai

View on YouTube
Currently working on a game using this functionality.
All players are currently AI, with the orange kart highlighted for clarity, whilst I try to get the AI playing like it oughta.