Page 1 of 1

(early WIP) Random Roads

PostPosted: 30 Nov 2019, 10:07
by tempAnon093
-----

See update for download link

-----

I recently discovered this pre-made City on BlendSwap (https://www.blendswap.com/blend/23834) and wanted to make a quick track from it. I saw this as an opportunity to test an idea that I have had: a track that randomly changes path each run.

(The textures are broken because the pre-made .blend uses Materials and I haven't learned how to bake materials automatically so it will be a while before this is fixed...)

Here is a video: invidio.us / youtube

This video shows how some of the intersections are scripted to create a semi-random route through the city. This helps make the races more dynamic.

Of course there are major downsides for this much fun:
- AI bots are dumb, so they probably won't be able to finish a dynamic track like this. Maybe I could have the slowest route always open and they use that? Still wouldn't be great.
- speedrunners owned lol I just discovered that custom Add-Ons build, if this map were ever included then the scripting.as file could be modified to use a preset override route.
- probably won't work on online multiplayer for the foreseeable future, unless I use a less random variable such as player count. In version 1.1, Benau has exposed the syncronised random seed to scripting, allowing me to make sure all players have the same random track!

city1.png


The code is a variation of this:

{l Code}: {l Select All Code}
/* Generate random numbers to decide which route to enable */
int random = Utils::randomInt(1, 3);

/* Use these to force a route as enabled (true) or disabled (false) */
bool override_enabled = false;
bool override_1 = false;
bool override_2 = false;

/* This SuperTuxKart map makes each route object call one of these
 *  functions to check whether enable that object or not.
 *
 * If either 'this route is randomly chosen' or 'we override this route',
 *  then return 'true', telling SuperTuxKart to enable this route.
 */

bool route_1_active(Track::TrackObject@ obj){
    if (override_enabled) {
        return override_1;
    } else {
        return (random == 1);
    }
}

bool route_2_active(Track::TrackObject@ obj){
    if (override_enabled) {
        return override_2;
    } else {
        return (random == 2);
    }
}

Re: (early WIP) Random Roads

PostPosted: 30 Nov 2019, 11:14
by benau
We can expose the random seed number in scripting for you, and it's already synchronised in network.

Re: (early WIP) Random Roads

PostPosted: 30 Nov 2019, 13:44
by tempAnon093
benau {l Wrote}:We can expose the random seed number in scripting for you, and it's already synchronised in network.

That would be perfect! Thanks :)

Re: (early WIP) Random Roads

PostPosted: 30 Nov 2019, 19:59
by eltomito
Is it possible to turn selected AI drive paths on and off with a script during the race? That would make it drivable for the AIs.

Re: (early WIP) Random Roads

PostPosted: 21 Dec 2019, 10:27
by benau
https://github.com/supertuxkart/stk-cod ... 7d8ebc5107

You can use uint getItemManagerRandomSeed() in 1.1-rc1 stk now

Re: (early WIP) Random Roads

PostPosted: 21 Dec 2019, 10:44
by tempAnon093
I've done a bit more work on the track. The textures are still horribly broken, but that's not too important ;)

Download .zip here

pic0.jpg


The AI are understandably confused in most races (doubly so because I've only defined a couple of long alternate routes instead of many short ones) but they can complete two of the possible courses without issue.

Here is an example of two separate races:
In this first one, we finish this left turn with a long right turn.

pic2.jpg

But in this race, we are forced to make a surprise U-turn!

pic1.jpg


So even though it is very incomplete, it's still fun to drive.

pic3.jpg


Here is a map. A route is chosen at random from the orange roads. The white roads are future possibilities, but would take a lot more effort to include.

city-map-key.jpg


benau {l Wrote}:https://github.com/supertuxkart/stk-code/commit/b29a42719cd32bcf3af4725aa2b3f97d8ebc5107

You can use uint getItemManagerRandomSeed() in 1.1-rc1 stk now


Perfect timing, thanks a lot!

Re: (early WIP) Random Roads

PostPosted: 24 Dec 2019, 15:38
by kimden
Really nice track! With random seed exposed, it's already playable online. Though sometimes the path becomes too short in my opinion.

Re: (early WIP) Random Roads

PostPosted: 24 Dec 2019, 23:09
by tempAnon093
Thank you, I'm glad you like it! I agree that sometimes the path is too short, the shortest races can have 15 second laps. In later versions, I could try and open route 'c' and make sure that the shortcut routes (such as 'y') are only used if the rest of the path isn't short.

Re: (early WIP) Random Roads

PostPosted: 25 Dec 2019, 05:47
by benau
lol your track looks like racing track in Macau

Re: (early WIP) Random Roads

PostPosted: 25 Dec 2019, 07:20
by Worldblender
I haven't tried this track out yet, but make sure that you publish the Blender source file at some point, and another for the final version.

Re: (early WIP) Random Roads

PostPosted: 25 Dec 2019, 08:04
by tempAnon093
benau {l Wrote}:lol your track looks like racing track in Macau

Haha, yeah. I tried to make it look kinda like some real street circuits.

Worldblender {l Wrote}:I haven't tried this track out yet, but make sure that you publish the Blender source file at some point, and another for the final version.

I'll upload it in a couple of days, I just want to make a couple of small changes first. :)

Re: (early WIP) Random Roads

PostPosted: 25 Dec 2019, 09:25
by eltomito
Hi! I tried your track and it looks really good! A couple of comments:

1) The graphics are too complex! I get less fps on your track than on Black Forest. Could some of the building models be simplified or completely removed?

2) The road is kinda dull. Could it go up and down a little? Or even a lot? Could you put more bananas? Could it get narrower at some points?

Great work, though!

Re: (early WIP) Random Roads

PostPosted: 25 Dec 2019, 12:15
by tempAnon093
eltomito {l Wrote}:1) The graphics are too complex! I get less fps on your track than on Black Forest. Could some of the building models be simplified or completely removed?

Yes, I can do that. I forgot how high the poly count is (it's far, far over the STK recommended limit), I can remove objects and simplify some of them.

eltomito {l Wrote}:2) The road is kinda dull. Could it go up and down a little? Or even a lot? Could you put more bananas? Could it get narrower at some points?

It is a bit dull. This was more of a test/experiment than anything so there is lots of room for improvement!

The city was built from a pre-made Blender project (that is the reason for the current poor FPS, because the creator was caring about quality more than performance). Because it is pre-made, it may not be easy for me to edit it into going up and down but it could be possible. I can certainly add more bananas, obstacles [edit: note to self to add street cones and blockers like on Classic Tollway] and narrow points (it already does become narrow a few times) without much effort.

Thanks for the feedback!

Re: (early WIP) Random Roads

PostPosted: 29 Apr 2020, 07:52
by tempAnon093
I finally learned how to bake textures properly and use gloss maps, so I can start to fix the horrible texture issues!
I initially tried baking the entire buildings into big textures but the quality was very bad on low graphics settings. Now I need to spend more time baking individual textures but the result should be much higher quality and more playable.

Re: (early WIP) Random Roads

PostPosted: 22 Jul 2020, 15:03
by forum
Hello!

This is really a cool project! :cool: Where can we Download the latest test version?

Are there other dynamic tracks or is this the only one?

Re: (early WIP) Random Roads

PostPosted: 27 Jul 2020, 04:46
by tempAnon093
forum {l Wrote}:This is really a cool project! :cool: Where can we Download the latest test version?

Thanks!
I haven't released anything outside of this thread. I did get a bit demotivated while converting all the buildings' graphics from materials to textures so that they would work in STK and then forgot about it after other projects took priority, so I'll do a bit of work on this track tomorrow and release a test version!
I don't know of any other dynamic tracks yet, unless the Bowling one counts (in add-ons).

Re: (early WIP) Random Roads

PostPosted: 27 Jul 2020, 21:43
by GeekPenguinBR
Hello, tempAnom093!

My first impression when looking at the track was "Hmmm ..." several sharp turns, It must be extremely difficult to drive fast on this track ". Then I loaded the track and found the track very narrow at first sight. Then, my expectation of difficult handling returned, but both times I was mistaken. The track is very easy to drive and I did not find any difficulty in making the turns and overtaking.

The only observation I make is that the repetition of the advertisement on the guardrail is making it a little (for me) difficult to visualize and making the visuals a bit boring at this point, but the rest is ok. Maybe the textures of the buildings could vary a little, but if it stays as it is, it can be considered cool.

Congratulations! Good job.

Re: (early WIP) Random Roads

PostPosted: 28 Jul 2020, 06:53
by tempAnon093
GeekPenguinBR {l Wrote}:[...] but both times I was mistaken. The track is very easy to drive and I did not find any difficulty in making the turns and overtaking.

That's good! I was worried about all the sharp 90° turns as well but I tried to pick routes that had wide roads and were easy to turn on, then added extra room on certain corners like the sharp one at the end. I can't take all the credit though, the city model was taken from BlendSwap (CC-BY).

GeekPenguinBR {l Wrote}:The only observation I make is that the repetition of the advertisement on the guardrail is making it a little (for me) difficult to visualize and making the visuals a bit boring at this point, but the rest is ok. Maybe the textures of the buildings could vary a little, but if it stays as it is, it can be considered cool.

Congratulations! Good job.

Thanks :)
I can add more advertisements on the guardrail after I fix up the buildings (the buildings are meant to have better textures, I just have to bake them in as the original used materials).

forum {l Wrote}:This is really a cool project! :cool: Where can we Download the latest test version?

Here is a newer test version with less triangles (so it will load better).

https://files.catbox.moe/bc1j7b.zip

Changes that I can remember:
- Improved the graphics on some buildings and stopped some being visible. There is a lot more work to do!
- In theory, it should work online now (untested, not in add-ons)
- I added a couple of movable cones and blocks at the last second to make it less boring
- Removed about 250,000 triangles without care, so it will load faster but some details like road markings have broken textures (but you won't notice unless you stop and look at it)

Note: It will look very bad on graphics level less than 3

Re: (early WIP) Random Roads

PostPosted: 28 Jul 2020, 06:55
by Worldblender
Oh, what about the Blender source files? I haven't seen a version of it appear yet.

Re: (early WIP) Random Roads

PostPosted: 28 Jul 2020, 08:18
by tempAnon093
Worldblender {l Wrote}:Oh, what about the Blender source files? I haven't seen a version of it appear yet.

Here are a few of the versions (the last is when I removed 250k tris so I don't recommend using it).
https://files.catbox.moe/l7j7y7.7z
The reason I didn't give source is because a lot of this is still broken, however you are free to use it.