would be cool to use tunnels (also bridges) for fixing overlaps. could also have sections where a wall becomes breakable and you drive thru it, with stuff blocking the original path
I'm honestly not seeing any good tools for programming CSGs for subtracting overlapping meshes. That would probably another large project he would have to tackle.
@@MINIMAN10000 the simpler way is for some pieces, make a version with a hole, then if a piece can have a hole, the track gen can punch through there, and if not, it can’t
@@morgan0I feel like you just delete the piece that it cuts through and replace it with a tunnel, and the road above is visibly good enough for the few seconds it’s on screen, even though it’s actually just built into the tunnel mesh. It might not work perfectly with corners, but would be good enough from a distance to not kill the suspension of disbelief.
If there isnt a looping track and you never go backwards, you could avoid the overlap problem by literally only keeping road pieces that the car is on and the space ahead. Spatially aware players might realize they're moving through an impossible track but most people will never notice, especially with more stuff going on around the player
I made an extremely similar system in my dungeon crawler game, Lowest Labyrinth. There actually is a solution which you missed. Have your generator commit to memory the entire track whenever it finds an invalid path and disallow those states whenever it goes to place a new piece. Then just allow the generator to move back a single piece when it runs out of options. The result is a sort-of Monte Carlo random walk towards a valid final solution. Good luck with your game!
Yes. I conceptualized a similar solution. There is no reason to delay the creation of future road segments to the near future. He could feasibly precompute dozens of future road segments and check them long before the player would ever reach them. This would have an added benefit, as he mentioned in the video, gives him more time to spread the collision calculations, and time for other things like loading tiles.
One minor adjustment to this is limiting the scope of the part where you say "the entire track". We could probably get away with just memorizing the entire track since to roll back changes past the player's current position would be rather unideal anyway. And then, yes, precomputing so it isn't a problem to roll back changes when necessary. You could also implement a fairly simple check to guarantee good future options - At the end of the precomputed road, do a raycast off the end of the final road piece equal to the length of the road behind the player. And don't accept solutions where the raycast collides with any road pieces. I feel like that's a pretty good upper bound to guarantee non-entrapment.
sounds like a great solution! And once you have bigger pieces consisting of 10, 20, 100, 1000 road pieces - stick them together using the same approach
It's kind of delightful how this sort of creates a higher-dimensional space by accident, where it's possible to travel over somewhere a road used to be, but has since been deleted - And most players wouldn't even notice.
@@Poldovico Design the mesh so that it has no sides. You're only going to see it from the top when you drive on it. Then add the tunnel and sorrounding cliff when tunneling :)
@@Poldovico You could even plan for it in some cases by having generation "Recipes" like: 1. downward straight road with a high cliff (You won't see the top) on the left. 2. make "3 right turns" downwards. 4. time for a long tunnel section "Under the mountain" :) You can just end the tunnel section whenever randomly, or have a minimum number of tunnel sections.
Try a flow field with perlin noise to define 'forwards' (ie. The path of the road) as following the flow field vectors. As you scroll the 2D noise the road is generated and you can even drive backwards - no memory needed. Just the seed if you want to replicate it.
Those are some pretty powerful ideas, very interesting. They make sense for complete procedural road generation, but I don't see how it could be done when the road is made of preset sections.
@@jonathonhowe you can make enough pieces to fit all of the different angle matches roughly, there wouldnt be too many considering how you can transform and translate pieces
A very long time ago, I tried to do a similar thing for a procedural racetrack generator in Roblox, constrained to a grid. The tile "behind" the finish was tagged, then it would random-walk forward from the start iteratively until it either found the end point, or Snaked itself (where it would reset with a new seed). It was janky as Content Deleted, but _nominally_ it did create race tracks. Really lousy ones, but technically functional closed loops. Maybe someday I'll give the concept another go...
I made a similar(ish) little project in school where you steer a boat down an endless river avoiding rocks with some janky terrain generation. I wish I'd seen this video 7 years ago 😅
U could use a flood fill algorythm starting in the area at the end of the selected tile to see if that option would result in a finite or infinite area filled, then if finite, u know that this move would create an area that cannot be escaped in future but if infinite then that piece would be valid. Correct me if I am wrong, but I believe a flood fill algorythm is a very cheap calculation to computer and would result in the most accuracy and speed.
Yeah that could work for the stages that have tile pieces. I'm not sure how you'd make it work for the stages that have arbitrary piece shapes though 🤔
Love the game so far! Super fun I’ve got few things that would make me love it even more: -An “advanced” control method where instead of just a left right slider it could be a square allowing for forward and backward inputs - A time attack mode on set maps - Portrait mode support Either way great game, lots of fun
love this game, having a lot of fun playing it, as well as seeing all the work you keep putting into it when many other people would already call this a finished game and move on! I'm getting bored pretty quickly while playing though, so I'd really appreciate if you'd add a bit of variety to the maps, both in terms of scenery, and lighting. also I believe that having a day-night cycle could be interesting, and reward players who manage to keep driving for multiple minutes without crashing.
Thank you! I'm glad you're liking it. Yes I agree more variety is needed. It's been on my mind a lot. As for rewarding the player for longer runs, I'm worried that might incentivise afk strategies, but maybe we could reward distance 🤔.
@@jonathonhowe Yeah I was thinking you could award how many segments you go. I always have a tough time judging how 'good' a run is outside of the score. Because your score definitely varies, and it's not always 1:1 to distance.
I'd look into maze generation algorithms and space filling curves. Arbitrary shaped road pieces certainly complicate things but it should work with some adaptations.
Infinite road removing road directly behind. This would work, do some checks to see if the tile you're driving on is able to see the tile behind you. If any are able to just make sure to code in to keep the road tile until you are on the next and then it will remove the previous 2. This will help with infinite roads and immersion if you have super tight hairpins. Good luck developing.
Thank you! And yes, the road does actually get removed behind the car already, it's a little less sophisticated than what you've recommended, but gets the job done. Even with this, overlap is still fairly common so this system is still used.
@@jonathonhowe What engine are you working in? I knew it wouldn't be a full fix to the overlapping but it'd be a bit to explain it without working on a system I talked about myself. Either way it's looking good and if you figure out a way to not make overlaps I'd be interested in seeing a video on it, keep up the good work!
You can use multiple way tiles like parking lots, crossroads, stadiums, woods, sand places and other playgrounds to have overlaps but in a controlled way. Every road going to or from these has to be 4 tiles straight (so 8+1=9 with the crossed one itself) and has to differ from the other road by at least 30 degrees and max. 90. On the crossing tile can be hay bales or traffic cones blocking the other road. So many will now say: This does stop you from drifting because of the long straight. No. Not necessarily. On these straights can be generated cones, hay bales, cars or even tank barriers you have to drift around. This way the game itself becomes more diverse and less boring on the long run, helps with concentrating and has a natural feel to the level of difficulty. Also the cross tiles could mark the start or end of an rally and you drift avoid the (oldtimer?) participants or a town route to its mall on which is traffic in both ways. Another way around could be jumps which make the player feel like in Dukes of Hazzard, portals like in Stargate, tunnels or dimension passages like in Stranger Things season 4 or fog in which is no wrong drifting until there is a street again and the fog fades away like in Assassin's Creed 2.
Another way of improving this depth check could be to check if any section already exist to the left, right and ahead(with some max distance checked) simultaneously. There are edge cases, but the assumption is that if there exist road pieces in all cardinal directions, there's a good chance you're eventually gonna run into another existing road section. The theory is that it's computationally cheaper to raytrace 3 times than to iteratively check all possible combinations of placing any 5 road pieces. Weaknesses could arise from having 45 degree turns, or if you decide that you'll be adding underpasses.
in a grid based aproach i would place a tile and than check if there is a path to the beginning. that way you will never runn into a "corner" because the beginning will be deleated when placing the next tile :)
Give every segment an angle calulation. (The angle change from its beginning) Add or subtract from a game degree tracker. Never let the game degree tracker get close to 360. If number is 330 Than don’t exceed a positive angle change of 30 This would require identifying the angle for all segments, then having a math problem run in the background that selects appropriate segments. I don’t know squat about coding but I thought it’d be a fun solution.
Raycasting for the overlap detection? It would definitely be faster, but I would need to write a custom implementation as many of the pieces we're testing for overlap with are not actually in the world. I'd also need to cast many rays to cover the entire possible area that a piece may cover, rather than it's rough center line.
@@jonathonhowe At the end of the search, one can check if the general outcome is valid by casting rays in all different directions the track could continue. By using some sort of implementation of this method, you could reduce the depth searched by quite a bit. (You could for example search until a valid exit is found)
The "stepping" solution to track creation sounds similar to cooperative scheduling. You could move that calculation into a different, low priority thread, too - and pick up the result (the appended track) when you need it. The calculation wouldn't need to be interruptible then, and you wouldn't need to estimate the amount of steps per frame. It would introduce more threading/synchronization and changing a running system, though. Nice game visuals, video and explanations, btw!
select random piece, check if collides with another if yes select another random piece that is not the previous one repeat until done, remove roads behind you and have a "tunnel" piece that can go through other pieces if there are no options.
you could divide the world into chunks (my favourite), then choose an exit side that is not the side you came from, then generate a random path through the chunk.the fastest way to overlap chunks would be a 4x4 square of chunks where the 1st and 5th path would overlap. so as long as you only ever have at most 4 chunks you should be fine
If new piece overlaps with existing one - they form a loop. You can't place pieces inside that loop, or you'll run out of space for new pieces eventually. So just rule out all possible placements inside that loop. Plus, there are a lot of options on how to do it exactly. That would be, either, a decent optimization, or a complete algorithm by itself, depending on implementation.
If the road happens to go in it itself, idk if its possible but building verticality could be another solution but a complication. Like if the road goes into the already rendered road, if the map's settings matches it, the road could go over or under. Like on the forest, road could go over by a bridge, and on the container warehouses something similar or the road could lead to an underpassage.
Wouldn't this also be a valid solution here? Store every generated piece of road in a dictionary based on id(distance from starting position in tiles traveled) so that would be Dictionary Check which pieces need rendering. Should be simple, just render every piece until the next corner, since the corner blocks visual anyway, this could be achieved with a look up table for which piece blocks the view. Now just simply fetch the needed pieces from the dictionary if they are already generated and boom infinite right hand corner.
Definitely consider spreading those piece placement tests over several frames. I'm not sure if the mobile version already has these changes, when playing my phone definitely stutters every once in a while. Here's my thought, build a small database of the models by their relationship between it's start and end markers. Since you're not caring about the height for overlap I'd do x,y coordinates as a sort of key, I'd just use something like x
i made a game like this a while ago except you are part of a military convoy and go down a procedurally generated road in a valley and randomly get ambushed by guerrilla fighters
I'd like a map like Rally, with a little bit more friction on the dirt, and it changes elevation and has hairpins like Touge. Also, another map that procedurally generates a smooth spline instead of the grid pattern. It'd be more complex but way more satisfying to drift in. And also implement a modifier that makes the spline more straight when you begin to go faster, just so that you don't have to purposely slow down to a halt every few turns because you're going so darn fast.
Something to add, I've tried going backwards on touge (uphill) and I've noticed that the car doesn't accelerate as fast as going downhill (duh). I think that it's a little too slow so maybe try to fix that somehow :) If you were to add a map that goes downhill AND uphill, 'fixing' the uphill acceleration is probably necessary. Super excited to see the future of this game!
Since the eay is covered with trees and walls and stuff, and you cant really see whats behind and stuff, i would just unload the old map fragments and would not care about overlapping and shit. Since the visible area is limited.
Slight idea here. Instead despawning track and hoping you won't run into it, I notice there isn't many tunnels any your game. Maybe whenever the game backs itself into a corner, have a tunnel bit where you tunnel under the previous road. Keeps the emmersion, prevents illogical geometry, and could get the player away from cluttered areas to allow for more free generation.
I'm pretty sure using pathfinding algorithm with a good heuristic would be sufficient to solve you problem in Polynomial time. Depending on guarantees you have based on tile types there may be even simpler approaches. Removing already used tiles from the map is something you should do anyways, so your solution may be sufficient.
Ok hear me out, this might sound stupid but why not just delete the track right behind the player since he cant see it anyways, that way there won't be any overlapping
I suppose you could cull all old road pieces that are out of lone of sight with the player, and if they decide to turn around and go backwards, just start generating new pieces backwards as well.
Just save all roads, just like with snake. Any single move is valid if it does not move inwards into a section that has been walled off. That is extremely simple. You hardly even need a for loop for that.
For years I've wanted this system for a split screen fps. Combine this with the games ability to teleport players back toward each other and you have an infinite map.
you can also fix this by adding a condition, where if the road was ever rotated towards the left or right the next spawn with a rotation has to be the opposite of the last
Question, is your game moving the car in coordinates or the roads? You could make longer non euclidean roads to go even longer without moving the car if the roads generate and move under your car making the illusion of moving while unloading old parts of the road you cannot see. This will help remove floating point errors too as you are not technically moving!
Cool video. Unsolicited advice: having the front tires smoking in a drift doesn’t make sense because you’re steering into the turn and controlling your direction with the front wheels. If they’re also sliding enough to smoke as much as the rear tires, something has gone terribly wrong. Car guys may find that detail distracting or off-putting. The visuals are great and your explanation of your thought process was cool. Good luck with it.
Yo bro I’ve been playing your game for a while now and I love it it’s dope that you release videos about making it. I’m a music producer and I think it would be cool if I had the opportunity to make the soundtrack for your next level.
Very cute! Have you considered adding intersections that the player could choose between? Since it's a procedurally generated course, the only cost would be a limit on how ahead of time you could generate the track.
Since the road is going down hill, would would be able to set the limit to the amount of tiles needed to go beneath the previous laid road? Maybe not completely realistic
You could make all tiles going slightly downhill or uphill, so after a while no tiles would run through each other, and you can stop rendering tiles that are far from the car at the Y axis
Why not use a grid system and every time you generate a block you store the data its grid and the surrounding grids. When the system generates a new section, it checks to see if the closest grids are in the list of potentially close grids. If that's the case, then it checks actual shapes and paths. After 10 sections, de-load the oldest stored grid and proximities. Should save a lot of processing power just checking a very small array. Plus you could use grids to do cool things like special "intersection" sections like a tunnel or ramp.
What about angle? Angle roads slightly dow like a mountain... despawn everything thats above a certain height by continually going down you should not be able to crash into yourself
The simple solution is to start with à counter equal to 1, when you turn left it decrease and when you turne right it increase, wthen you say that the counter must be between 0 and 2, with tant you never go back. A nover solution is to map each chunk in a variable boolean array with each coordonate can be 0 or 1 and you say that you must never go on a coordonate that is already 1
I just tried the game on Android, and it's nice, but it's just too difficult. I gave up after 10 minutes. I think it should be more forgiving when you hit some obstacles. Also, as others have pointed out, very few players would notice if the track was actually impossible. After 2 turns, you forget were you came from, because you are so focused on the next turn. I tend to think that you solved this problem because it's an interesting programming problem, not because it makes your game better. I'm not blaming you, I have done that too. But I don't want to sound too negative, it's great that you explain what you have done and why, and I like the ideas. I will give Drifto another try tomorrow. :)
would be cool to use tunnels (also bridges) for fixing overlaps. could also have sections where a wall becomes breakable and you drive thru it, with stuff blocking the original path
I'm honestly not seeing any good tools for programming CSGs for subtracting overlapping meshes. That would probably another large project he would have to tackle.
@@MINIMAN10000 the simpler way is for some pieces, make a version with a hole, then if a piece can have a hole, the track gen can punch through there, and if not, it can’t
@@morgan0I feel like you just delete the piece that it cuts through and replace it with a tunnel, and the road above is visibly good enough for the few seconds it’s on screen, even though it’s actually just built into the tunnel mesh.
It might not work perfectly with corners, but would be good enough from a distance to not kill the suspension of disbelief.
Same thought, replace the overlapping tiles with a tunnel that's guaranteed to go past it
@MINIMAN10000 just make a separate mesh for the tunnel, and place the tunnel below the existing road. It is extremely simple.
If there isnt a looping track and you never go backwards, you could avoid the overlap problem by literally only keeping road pieces that the car is on and the space ahead. Spatially aware players might realize they're moving through an impossible track but most people will never notice, especially with more stuff going on around the player
*dumbasses won't realize
It's an infinite road, why bother at all? Despawn anything behind you and confidently make 6 left turn in a row.
This
This!
sounds lazy and immersion breaking.
@@CathrineMacNiel wooosh
@@kalechips22 not really.
Broke: self-overlapping roads
Woke: avoid self-overlap
Bespoke: allow self-overlapping roads and render it in a way that doesn't look stupid
I made an extremely similar system in my dungeon crawler game, Lowest Labyrinth. There actually is a solution which you missed. Have your generator commit to memory the entire track whenever it finds an invalid path and disallow those states whenever it goes to place a new piece. Then just allow the generator to move back a single piece when it runs out of options. The result is a sort-of Monte Carlo random walk towards a valid final solution.
Good luck with your game!
Yes. I conceptualized a similar solution. There is no reason to delay the creation of future road segments to the near future. He could feasibly precompute dozens of future road segments and check them long before the player would ever reach them. This would have an added benefit, as he mentioned in the video, gives him more time to spread the collision calculations, and time for other things like loading tiles.
One minor adjustment to this is limiting the scope of the part where you say "the entire track". We could probably get away with just memorizing the entire track since to roll back changes past the player's current position would be rather unideal anyway. And then, yes, precomputing so it isn't a problem to roll back changes when necessary.
You could also implement a fairly simple check to guarantee good future options - At the end of the precomputed road, do a raycast off the end of the final road piece equal to the length of the road behind the player. And don't accept solutions where the raycast collides with any road pieces. I feel like that's a pretty good upper bound to guarantee non-entrapment.
Sounds like iterated depth first factorial extinction.
@@Dan-gs3kg I like your funny words, magic man.
sounds like a great solution!
And once you have bigger pieces consisting of 10, 20, 100, 1000 road pieces - stick them together using the same approach
It's kind of delightful how this sort of creates a higher-dimensional space by accident, where it's possible to travel over somewhere a road used to be, but has since been deleted - And most players wouldn't even notice.
wait this is actually so cool i played this game for a while before finding these videos
Wow I’ve been addicted to this game the last few days and to see it in my recommended is crazy. Love the game man!
i just installed this game about 1 week ago and i have been playing it everyday and i love it
Adding tunnel pieces that go under previous tracks would make this problem a whole lot easier and add some variation.
How do you tunnel through an existing mesh?
@@Poldovico Design the mesh so that it has no sides. You're only going to see it from the top when you drive on it. Then add the tunnel and sorrounding cliff when tunneling :)
@@Poldovico You could even plan for it in some cases by having generation "Recipes" like: 1. downward straight road with a high cliff (You won't see the top) on the left. 2. make "3 right turns" downwards. 4. time for a long tunnel section "Under the mountain" :) You can just end the tunnel section whenever randomly, or have a minimum number of tunnel sections.
Great video , love to see the evolution of this game
Try a flow field with perlin noise to define 'forwards' (ie. The path of the road) as following the flow field vectors. As you scroll the 2D noise the road is generated and you can even drive backwards - no memory needed. Just the seed if you want to replicate it.
Those are some pretty powerful ideas, very interesting.
They make sense for complete procedural road generation, but I don't see how it could be done when the road is made of preset sections.
You round the forward vector so it matches the angles of your premade pieces
@@jonathonhowe you can make enough pieces to fit all of the different angle matches roughly, there wouldnt be too many considering how you can transform and translate pieces
A very long time ago, I tried to do a similar thing for a procedural racetrack generator in Roblox, constrained to a grid. The tile "behind" the finish was tagged, then it would random-walk forward from the start iteratively until it either found the end point, or Snaked itself (where it would reset with a new seed). It was janky as Content Deleted, but _nominally_ it did create race tracks. Really lousy ones, but technically functional closed loops. Maybe someday I'll give the concept another go...
I made a similar(ish) little project in school where you steer a boat down an endless river avoiding rocks with some janky terrain generation. I wish I'd seen this video 7 years ago 😅
I didn’t even know you made the game awesome work, however I never knew the road wasn’t infinite first
This video is the better campaign of marketing possible, i want a lot play this game, congratulations to dev, to game, to video, to explain
This game is awesome. So fun to play and the unlockables make me want to keep playing!
U could use a flood fill algorythm starting in the area at the end of the selected tile to see if that option would result in a finite or infinite area filled, then if finite, u know that this move would create an area that cannot be escaped in future but if infinite then that piece would be valid. Correct me if I am wrong, but I believe a flood fill algorythm is a very cheap calculation to computer and would result in the most accuracy and speed.
I believe this would work well. I don't have a ton of knowledge about flood fill algorithms but it seems as though this would be the best solution.
@@Kyanoxia always happy to help :)
Yeah that could work for the stages that have tile pieces.
I'm not sure how you'd make it work for the stages that have arbitrary piece shapes though 🤔
You don't even need a flood fill, you can just check the edge since you only care if the area is bounded.
@@jonathonhowe You could just coarsely voxelize them with a handful of collision checks against rectangular prism colliders arranged in a grid.
Damn I've been playing the game for a very long time now and never realised you had a TH-cam I'm glad I got recommended it.
I play this game daily on the train to and from work, and randomly got recommended this vid 😁 love the game bro
i recently found this game and decided to watch the devlog. it’s definitely one of my favourite games to kill time when i’m waiting. 5 stars
Great video, I appreciate that you make racing/driving game
hey mate i’ve been playing your game for months and it’s one of the best mobile games i’ve found. really glad youtube recommended me this, take care
Thank you! I really appreciate this. I hope you continue to enjoy it.
I just tested out your game and it's pretty fun ! thanks for it!
i got this game to pass time at school, so cool that ur a dev on it
Love the game so far! Super fun
I’ve got few things that would make me love it even more:
-An “advanced” control method where instead of just a left right slider it could be a square allowing for forward and backward inputs
- A time attack mode on set maps
- Portrait mode support
Either way great game, lots of fun
love this game, having a lot of fun playing it, as well as seeing all the work you keep putting into it when many other people would already call this a finished game and move on! I'm getting bored pretty quickly while playing though, so I'd really appreciate if you'd add a bit of variety to the maps, both in terms of scenery, and lighting. also I believe that having a day-night cycle could be interesting, and reward players who manage to keep driving for multiple minutes without crashing.
Thank you! I'm glad you're liking it.
Yes I agree more variety is needed. It's been on my mind a lot.
As for rewarding the player for longer runs, I'm worried that might incentivise afk strategies, but maybe we could reward distance 🤔.
@@jonathonhowe Yeah I was thinking you could award how many segments you go. I always have a tough time judging how 'good' a run is outside of the score. Because your score definitely varies, and it's not always 1:1 to distance.
I'd look into maze generation algorithms and space filling curves. Arbitrary shaped road pieces certainly complicate things but it should work with some adaptations.
Downloaded this ages ago and have been loving it as a good game I can rely on. Please don’t abandon it 😂
Sounds like a cool concept, downloading it to try now
Just tried your game and its fun and addicting!
You are gonna blow up soon, I'm calling it.
I sure hope so ❤️
Infinite road removing road directly behind. This would work, do some checks to see if the tile you're driving on is able to see the tile behind you. If any are able to just make sure to code in to keep the road tile until you are on the next and then it will remove the previous 2. This will help with infinite roads and immersion if you have super tight hairpins. Good luck developing.
Thank you!
And yes, the road does actually get removed behind the car already, it's a little less sophisticated than what you've recommended, but gets the job done.
Even with this, overlap is still fairly common so this system is still used.
@@jonathonhowe What engine are you working in? I knew it wouldn't be a full fix to the overlapping but it'd be a bit to explain it without working on a system I talked about myself. Either way it's looking good and if you figure out a way to not make overlaps I'd be interested in seeing a video on it, keep up the good work!
You can use multiple way tiles like parking lots, crossroads, stadiums, woods, sand places and other playgrounds to have overlaps but in a controlled way. Every road going to or from these has to be 4 tiles straight (so 8+1=9 with the crossed one itself) and has to differ from the other road by at least 30 degrees and max. 90. On the crossing tile can be hay bales or traffic cones blocking the other road. So many will now say: This does stop you from drifting because of the long straight. No. Not necessarily. On these straights can be generated cones, hay bales, cars or even tank barriers you have to drift around.
This way the game itself becomes more diverse and less boring on the long run, helps with concentrating and has a natural feel to the level of difficulty. Also the cross tiles could mark the start or end of an rally and you drift avoid the (oldtimer?) participants or a town route to its mall on which is traffic in both ways.
Another way around could be jumps which make the player feel like in Dukes of Hazzard, portals like in Stargate, tunnels or dimension passages like in Stranger Things season 4 or fog in which is no wrong drifting until there is a street again and the fog fades away like in Assassin's Creed 2.
Another way of improving this depth check could be to check if any section already exist to the left, right and ahead(with some max distance checked) simultaneously. There are edge cases, but the assumption is that if there exist road pieces in all cardinal directions, there's a good chance you're eventually gonna run into another existing road section.
The theory is that it's computationally cheaper to raytrace 3 times than to iteratively check all possible combinations of placing any 5 road pieces.
Weaknesses could arise from having 45 degree turns, or if you decide that you'll be adding underpasses.
The road knows where it is, because it knows where it isn't.
in a grid based aproach i would place a tile and than check if there is a path to the beginning.
that way you will never runn into a "corner" because the beginning will be deleated when placing the next tile :)
Give every segment an angle calulation. (The angle change from its beginning)
Add or subtract from a game degree tracker. Never let the game degree tracker get close to 360.
If number is 330
Than don’t exceed a positive angle change of 30
This would require identifying the angle for all segments, then having a math problem run in the background that selects appropriate segments.
I don’t know squat about coding but I thought it’d be a fun solution.
you can also simply cast a ray at the end in the direction the track is going. well edited!
Raycasting for the overlap detection? It would definitely be faster, but I would need to write a custom implementation as many of the pieces we're testing for overlap with are not actually in the world.
I'd also need to cast many rays to cover the entire possible area that a piece may cover, rather than it's rough center line.
@@jonathonhowe At the end of the search, one can check if the general outcome is valid by casting rays in all different directions the track could continue. By using some sort of implementation of this method, you could reduce the depth searched by quite a bit. (You could for example search until a valid exit is found)
I got this game before seeing any of these videos. I love the game
The "stepping" solution to track creation sounds similar to cooperative scheduling.
You could move that calculation into a different, low priority thread, too - and pick up the result (the appended track) when you need it. The calculation wouldn't need to be interruptible then, and you wouldn't need to estimate the amount of steps per frame. It would introduce more threading/synchronization and changing a running system, though.
Nice game visuals, video and explanations, btw!
Please add purchasable engines into the game (only for sound effects) it would just be cool to be drifting to the sound of a vr or 2jz or even Ls
This looks really cool!
OMG I DOWNLOADED THIS RECENTLY AND JUST SAW THIS IN MY RECOMMENDED LMAO, what a coincidence
select random piece, check if collides with another if yes select another random piece that is not the previous one repeat until done, remove roads behind you and have a "tunnel" piece that can go through other pieces if there are no options.
you could divide the world into chunks (my favourite), then choose an exit side that is not the side you came from, then generate a random path through the chunk.the fastest way to overlap chunks would be a 4x4 square of chunks where the 1st and 5th path would overlap. so as long as you only ever have at most 4 chunks you should be fine
🤔 I feel like this would be a good use for wave function collapse
If new piece overlaps with existing one - they form a loop. You can't place pieces inside that loop, or you'll run out of space for new pieces eventually. So just rule out all possible placements inside that loop. Plus, there are a lot of options on how to do it exactly. That would be, either, a decent optimization, or a complete algorithm by itself, depending on implementation.
I NEED this game!!!
Edit I installed it!!!
also, PLEASE make a pc version! I beg.
If the road happens to go in it itself, idk if its possible but building verticality could be another solution but a complication.
Like if the road goes into the already rendered road, if the map's settings matches it, the road could go over or under.
Like on the forest, road could go over by a bridge, and on the container warehouses something similar or the road could lead to an underpassage.
holy crap I played the shit out of this game a few months ago I unlocked everything I didn’t know it had a devlog that’s so cool
I know some of my friends play and love your game 👍
Embrace the non-euclideanity and just delete all the old tiles, you're never going to go back to them anyway right?
Wouldn't this also be a valid solution here?
Store every generated piece of road in a dictionary based on id(distance from starting position in tiles traveled) so that would be Dictionary
Check which pieces need rendering. Should be simple, just render every piece until the next corner, since the corner blocks visual anyway, this could be achieved with a look up table for which piece blocks the view.
Now just simply fetch the needed pieces from the dictionary if they are already generated and boom infinite right hand corner.
Great stuff!
I have this game! I didnt know you made it!
Wave Function Collapse would suit here perfectly i guess
(last time)...sure
this game seems really cool
Definitely consider spreading those piece placement tests over several frames. I'm not sure if the mobile version already has these changes, when playing my phone definitely stutters every once in a while.
Here's my thought, build a small database of the models by their relationship between it's start and end markers. Since you're not caring about the height for overlap I'd do x,y coordinates as a sort of key, I'd just use something like x
What about adding multiplayer mode? It would be fun to drift with people! But if you dont want to add it u can! Ur choice man
i made a game like this a while ago except you are part of a military convoy and go down a procedurally generated road in a valley and randomly get ambushed by guerrilla fighters
is the next video going to be "how i switched my project from unity to Unreal?"
Been playing this game for a month and just found this devlog 🤣🤣
I'd like a map like Rally, with a little bit more friction on the dirt, and it changes elevation and has hairpins like Touge.
Also, another map that procedurally generates a smooth spline instead of the grid pattern. It'd be more complex but way more satisfying to drift in. And also implement a modifier that makes the spline more straight when you begin to go faster, just so that you don't have to purposely slow down to a halt every few turns because you're going so darn fast.
Something to add, I've tried going backwards on touge (uphill) and I've noticed that the car doesn't accelerate as fast as going downhill (duh). I think that it's a little too slow so maybe try to fix that somehow :)
If you were to add a map that goes downhill AND uphill, 'fixing' the uphill acceleration is probably necessary. Super excited to see the future of this game!
Oh i was playing this game a lot in school,now i see it here
ive been playing this game for 3 months now I DIDNT KNOW THIS WAS A DEVLOG GAME
Good video I enjoyed it 👍
Since the eay is covered with trees and walls and stuff, and you cant really see whats behind and stuff, i would just unload the old map fragments and would not care about overlapping and shit. Since the visible area is limited.
Really interesting!
looks like a fun game
Slight idea here. Instead despawning track and hoping you won't run into it, I notice there isn't many tunnels any your game. Maybe whenever the game backs itself into a corner, have a tunnel bit where you tunnel under the previous road. Keeps the emmersion, prevents illogical geometry, and could get the player away from cluttered areas to allow for more free generation.
Now, you're not thinking with portals!
I'm pretty sure using pathfinding algorithm with a good heuristic would be sufficient to solve you problem in Polynomial time. Depending on guarantees you have based on tile types there may be even simpler approaches. Removing already used tiles from the map is something you should do anyways, so your solution may be sufficient.
Ok hear me out, this might sound stupid but why not just delete the track right behind the player since he cant see it anyways, that way there won't be any overlapping
great video
Solid game I loved it
I suppose you could cull all old road pieces that are out of lone of sight with the player, and if they decide to turn around and go backwards, just start generating new pieces backwards as well.
With the snake road you can actually use a finite checkerboard, and therefore guarantee you never hit the loaded road (and more turns more drifts)
A checkerboard, like a tile/grid based system?
If so then that would work for only a couple of the stages
Just save all roads, just like with snake. Any single move is valid if it does not move inwards into a section that has been walled off. That is extremely simple. You hardly even need a for loop for that.
2:40 is so wrong. Do you want some help? I can send you simple code that solves this issue 100% of the time.
For years I've wanted this system for a split screen fps.
Combine this with the games ability to teleport players back toward each other and you have an infinite map.
you can also fix this by adding a condition, where if the road was ever rotated towards the left or right the next spawn with a rotation has to be the opposite of the last
Question, is your game moving the car in coordinates or the roads? You could make longer non euclidean roads to go even longer without moving the car if the roads generate and move under your car making the illusion of moving while unloading old parts of the road you cannot see. This will help remove floating point errors too as you are not technically moving!
Hey man I love your game, I play it when I’m bored, can you make more maps please and more obstacles. Thxs
Thank you! Yes more maps and more variety in the current maps are definitely going to come soon!
Thanks bro, your game is the best
hardest mobile game i ever played
other than clash royale
Cool video. Unsolicited advice: having the front tires smoking in a drift doesn’t make sense because you’re steering into the turn and controlling your direction with the front wheels. If they’re also sliding enough to smoke as much as the rear tires, something has gone terribly wrong. Car guys may find that detail distracting or off-putting. The visuals are great and your explanation of your thought process was cool. Good luck with it.
Thumbnail makes it look like jelly drift
Well this is cool as hell.
Yo bro I’ve been playing your game for a while now and I love it it’s dope that you release videos about making it. I’m a music producer and I think it would be cool if I had the opportunity to make the soundtrack for your next level.
YOU MADE THE GAME?! I jus found it n started playing lmao
Very cute! Have you considered adding intersections that the player could choose between? Since it's a procedurally generated course, the only cost would be a limit on how ahead of time you could generate the track.
This is a great idea !
very epic
Have you looked into wave function collapse?
Since the road is going down hill, would would be able to set the limit to the amount of tiles needed to go beneath the previous laid road?
Maybe not completely realistic
You could make all tiles going slightly downhill or uphill, so after a while no tiles would run through each other, and you can stop rendering tiles that are far from the car at the Y axis
Why not use a grid system and every time you generate a block you store the data its grid and the surrounding grids. When the system generates a new section, it checks to see if the closest grids are in the list of potentially close grids. If that's the case, then it checks actual shapes and paths. After 10 sections, de-load the oldest stored grid and proximities.
Should save a lot of processing power just checking a very small array. Plus you could use grids to do cool things like special "intersection" sections like a tunnel or ramp.
What about angle? Angle roads slightly dow like a mountain... despawn everything thats above a certain height by continually going down you should not be able to crash into yourself
The simple solution is to start with à counter equal to 1, when you turn left it decrease and when you turne right it increase, wthen you say that the counter must be between 0 and 2, with tant you never go back. A nover solution is to map each chunk in a variable boolean array with each coordonate can be 0 or 1 and you say that you must never go on a coordonate that is already 1
Note : the system with 0,1, and 2 can olso work with degres
could try using overlap pieces in places where its stuck, like a bridge, intersection, etc
I just tried the game on Android, and it's nice, but it's just too difficult. I gave up after 10 minutes. I think it should be more forgiving when you hit some obstacles. Also, as others have pointed out, very few players would notice if the track was actually impossible. After 2 turns, you forget were you came from, because you are so focused on the next turn. I tend to think that you solved this problem because it's an interesting programming problem, not because it makes your game better. I'm not blaming you, I have done that too. But I don't want to sound too negative, it's great that you explain what you have done and why, and I like the ideas. I will give Drifto another try tomorrow. :)