Search Unity

Looking for advise how to create levels like in Mario Kart

Discussion in 'General Discussion' started by Peter77, Jan 1, 2020.

  1. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    Lately I'm thinking about the idea to create a Mario Kart'ish racing game for learning purposes. I've created various games in my career, but never worked on a racing game like Mario Kart Tour.

    However, I'm having a hard time to come up with ideas how to best create those racing tracks and the level around it in Unity (what tools to use, etc), therefore this post.


    Part #1
    What Unity built-in engine and editor features/packages do you think help to prototype such racing tracks?
    I'm not looking for 3rd party tools from the asset store. I did try EasyRoads3 a while ago, but like with most asset store tools, it caused various errors and I don't want to deal with these kind of issues anymore. Thus I'm looking for Unity built-in tools or I would create the tools myself.

    I would like to find a workflow that allows me to easily change the racing track, so I can iterate a lot on the gameplay (test-driving the track), during its early stages.

    I thought about using a waypoint system, like connecting lines or perhaps splines to create the track for example.

    Unity Technologies "Micro Kart Racer" project is using racing-track-tiles, but I'm not a fan of that, because it makes the track design rather stiff.

    Perhaps a combination of both approaches? Using racing-track-tiles, but being able to slightly deform their vertices through splines in order to bend them to make different curves?

    Maybe just paint the track using an Unity terrain?

    Do you know of other approaches how to create such racing tracks?

    Do you think the ProBuilder package can be of help here or do you know of more useful built-in tools?


    Part #2
    Let's consider I'm happy with the racing track prototype. Now I would like to build the actual level/art around it, replace the prototype graphics with actual art assets.

    What Unity built-in engine and editor features/packages do you think should be used to create a level like in Mario Kart Tour?

    For example, do you think using Unity Terrain for the ground would be helpful?
    Would you just export the racing track as a OBJ/FBX and build in entire level in Blender/3dsMax/Maya?

    I would like to keep as much level design work as possible inside Unity, because this allows everybody on the team to move things around in the level. This would become more difficult if the level needs to be changed in a 3d modeling application.


    Part #3
    How do you think the levels in Mario Kart Tour were built? For example, do you think the ground is perhaps an Unity Terrain with modeled 3d props on top, or do you think it's been modeled entirely?
     
    Last edited: Jan 1, 2020
    jasperbrooks79 likes this.
  2. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,776
    If you want lots of flexibility, I would imagine race track based on spline, which you can adjust at will. Like Bézier curve
    https://en.wikipedia.org/wiki/Bézier_curve
    Then of course need accordingly track width, which you can adjust along the path.
    Then project it somehow on the terrain.

    That is my concept, if I would approach it, with higher flexibility.

    Having spline and % position, at which you cars are along whole circuit, you can create much easier AI, which follow the route.

    But that of course not only option regarding AI. Now we have many more solutions, which work well as well.

    If I would project track on terrain, only thing I would worry, is terrain itself, which should be imported with obj/fbx.
    I would likely use ingame mesh generator, to generate track, which follows the terrain curve.

    But looking on particular Mario game example, I pretty sure, tracks are built by hand.
    You got gaps, you got ramps, you got obstacles and bonuses.
    You probably could automate to certain extend that. But so far nothing beats human design and perception of the fun and challenge. Otherwise, you would probably spend a lot time developing racing track tools.

    Are there any tools to accelerate such race tracks? Don't know to be honest.
    I would consider look here, just to get an idea, even not wanting using Asset Store.
    https://assetstore.unity.com/?q=race track&orderBy=0
     
    Last edited: Jan 1, 2020
    jasperbrooks79 and Peter77 like this.
  3. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    Thanks for your answer!

    I don't understand this. Do you mean you would model the terrain in another application and import it into Unity?

    Does it mean you would create the terrain first and afterwards put splines on the terrain that create a race track mesh along those splines?

    Considering I would like to iterate on the track itself first, I would imagine using the spline to modify the terrain could be useful too. Let's say you start with a flat terrain, then add the spline and the spline is used to lower/elevate and flatten the terrain under it. Then you don't have to spend time on the terrain first, if you really want to iterate on the track at this stage. This should reduce the actual terrain modeling where the track would be located quite a bit in my imagination.


    What do you mean "tracks are built by hand"? Like the entire track/level is modeled in lets say 3dsmax? Or objects on the track are placed by a human person?

    That's the reason why I would like to have the track creation/modification as painless as possible, to quickly iterate on on the track design to find what makes the most fun.

    My goal isn't to create an entire level automagically. I just want to find a good workflow that allows quick iterations on the track. Having ramps, obstacles, etc as separate objects that have to be placed by a person is a totally fine for me.

    Thanks again for your answer!
     
    jasperbrooks79 likes this.
  4. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,776
    Yep, like blender, 3D Max etc. Making basics terrain. Then build on top, by placing own assets.
    But that not necessary is required, to have terrain.

    Yep. Like import terrain mesh. Then draw somehow line, adjust for your liking etc.

    It is up to you, how complex you want to go with such editing mechanics.

    I would make some basics terrains, which you can adjust and add features.
    Terrains should be rather simple with features, so you got flexibility, to create wariaty of tracks on it.
    Cannon, river, lakes, cliffs, hills, hole etc.

    See here
    The cave with tunnels looks like is one modeled object. Eventually ground, and top are two separate objects.
    Bridges are separate objects, placed by hand.

    Dino legs are separate objects.

    Ramps are separate objects.
    Coins are separate.
    Same for gazers.

    Curves and turns are limited by rock props with some grass on the flat ground (sand-ish)


    Here entering the town, is flat ground, with tons of placed props as obstacles.
    There wasn't any generator involved here in my view. Is just designed by hand.

    See for example here

    Is level designer choice, to place ramps as they are. Allowing different routes.

    The other option for AI, is just placing virtual checkpoints, so AI knows which direction should go.
    Is crude and rather relatively trivial to implement. No need any special sophisticated techniques, for such game.
    But you can, if you like.
     
    Peter77 and jasperbrooks79 like this.
  5. RendrWyre

    RendrWyre

    Joined:
    Dec 18, 2019
    Posts:
    2
    1) What Unity built-in engine and editor features/packages do you think help to prototype such racing tracks?

    ProBuilder might be a good place to start if you're looking to just block out a basic track without the hassle of modelling in Blender/Maya and importing... or creating your own spline tool to modify terrain (assuming you don't want a 100% flat track).

    There is a free path creator by Sebastian Lague (
    ) and in the video he literally uses it to create a road. You could probably hack that to suit your needs. Just raise/lower the terrain based on the path point when it's placed. Or, if you don't use a terrain, use the tool to generate your racetrack and place the assets to fit the track.. rather than placing the track on already placed environment assets.

    Alternatively/additionally you could look into belzier curves for a better understanding if you want to make a more complex tool.

    2) Let's consider I'm happy with the racing track prototype. Now I would like to build the actual level/art around it, replace the prototype graphics with actual art assets. What Unity built-in engine and editor features/packages do you think should be used to create a level like in Mario Kart Tour?

    ProBuilder and Polybrush might be enough to do it... not sure but it might be worth a try. You can also export probuilder stuff outside of Unity to blender etc if you want to clean it up.

    3) For example, do you think using Unity Terrain for the ground would be helpful?

    In most cases yes. It's built with optimisation in mind and is easier to work with if you want to create landscapes etc or use tools to build a path and raise the terrain. But it doesn't look like you want to use a traditional terrain. For something like a racetrack you might want to go with just models because there is no requirement for large areas of open (traversable) terrain.

    4) Would you just export the racing track as a OBJ/FBX and build in entire level in Blender/3dsMax/Maya?

    Personally? I would build it in Blender and export chunks. It might be easier to build it all in Unity but ProBuilder/Polybrush isn't technically a replacement for traditional tools like Maya or Blender... more like an addition. You can block stuff out and if you like it... export it and clean it up/re-import it.

    5) I would like to keep as much level design work as possible inside Unity, because this allows everybody on the team to move things around in the level. This would become more difficult if the level needs to be changed in a 3d modeling application.

    Level design (in 99/9% of cases level design happens in Unity... afaik TellTale moddeled the entire scene in maya then exported it for one of their walking dead games but that's not common).

    You don't have to create the entire track in a single chunk. In fact, most people might argue that's going to cause longer dev times. If you made your track modular (build individual sections of road in blender/maya and export) your level designer(s) could use the different sections to build interesting tracks. (as a bonus a lot of the objects will be the same so if you use a texture atlas you can take advantage of Unity batching duplicate, but separate, objects that share the same material.)

    6) How do you think the levels in Mario Kart Tour were built? For example, do you think the ground is perhaps an Unity Terrain with modeled 3d props on top, or do you think it's been modeled entirely?

    Personally I don't see why they would need a terrain. Looks like they fake it with the skybox and use meshes for the environment.
     
    Last edited: Jan 1, 2020
    Peter77 and jasperbrooks79 like this.
  6. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,052
    Definitely. They didn't build the track in Unity. It was done externally. possibly some portion of it built over top of existing meshes like surfaces, colliders or other needs via custom tools. Mostly game levels are done in real 3d applications and brought into Unity either as a whole or in pieces.
     
    Peter77 and Antypodish like this.
  7. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
    I didn't read everything, so excuse me if I just repeat somebody else, but I think spline based path creator makes a lot of sense if only for prototyping tracks. Then, once you have settled on design that works for gameplay, you can make the actual models in 3d app.

    Alternatively you could work with modular chunks of racetrack. That could even be how final production art is built. But seems like a spline based approach woudl be great because of how easily you can make major or minor tweaks to say, the angle of a curved part of the track.
     
    Peter77 and jasperbrooks79 like this.
  8. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,052
    Having spline based versions of the tracks (or at least the surface) has a lot of advantages, like precise control over physics, collision, gravity and a host of meta game stuff like replays, ui place/display tracking, and nice granular rendering that could get expensive to completely store as meshes.

    For me, when determining what gets the most attention/resources in game/pipeline, I always focus on what gets the most screen time. Pretty much after the carts, the player is going to be looking at the track surface in the immediate area. But trick there is that the track is also the largest part of the game. You want it to be high enough resolution to a) look good, and to b) respond well to physics. Straight modeling could be fairly large at that resolution. There is a probably a sweet spot betweening mesh and clever modeling tricks to strike a balance. Kart games are typically high paced, frame and model jitters kill a game like that.
     
  9. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    Thanks so much for the answers!

    To summarize how the workflow could look like from what I got from your replies:

    Part #1 - Prototype
    To keep iterating on the track itself quick:
    • Use spline tools to create and modify the track.
    • Bring "gameplay elements" such as ramps, speed-boosts, etc in as separate assets/prefabs and place them in Unity.
    • Give ProBuilder a try to block-out the level around the track.
    • Test-drive track
    Iterate as much as you like.


    Part #2 - Beautification
    From here on, work on the track in Unity must stop, as it's going to be 3d modeled now.
    • Export prototype level from Unity, containing splines and block-outs, to a 3d modeling application as a point of reference.
    • The "landscape" would be authored in that 3d modeling application from then on, replacing the existing prototype content. This includes mostly bigger and static things, such as the ground, caves, cliffs/rocks, etc.
    • Smaller things like, hydrants, trees, fences, etc would be imported as separate models and placed inside Unity. This allows that non 3d artists can still tweak/optimize the level directly inside Unity.

    Another question that comes to mind:
    What Unity renderer would you use to re-create levels like in Mario Kart Tour for mobile devices?
    • Built-in renderer, Universal Render Pipeline?
    • Real-time shadows, baked lightmaps?
     
    Last edited: Jan 3, 2020
    angrypenguin likes this.
  10. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,570
    I think there's nothing useful, although I might be overlooking something.

    If I was hell bent on designing the track in editor, I'd probably write a spline based track mesh generator. That would eat a bit of time, but would make sense as mario kart does not necessarily follow laws of physics.

    The surrounding elements could be placed via kit bashing.

    Not a fan of it. You sorta need splines here, and I don't recall probuilder being good at that.


    Depending on gameplay type I would probably keep original spline in the game and use it for collision, but model the visuals.
     
    Peter77 likes this.
  11. jamespaterson

    jamespaterson

    Joined:
    Jun 19, 2018
    Posts:
    401
    Intetesting thread. Just my 2p, the physics and control of the karts will obviously be pretty critical to the feel of the game. This might then feed into certain parameters of the track like width, maximum curvature, length required etc. A simple oval track generated from a spline would be enough to test out a controller. Personally i might be inclined to rough this aspect out alongside track generation workflow. Good luck with the project!
     
    Peter77 likes this.
  12. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    What do you think would be the Top 3 most challenging tasks, where you would expect the most issues with, if you had to re-create Mario Kart for Mobile with Unity?

    If you created racing games in the past, what learnings did you make? I'm looking for things like: "We totally underestimated xyz. That turned out to be way more complicated, or took more time, than we initially thought".

    If you could also let me know the reason why you think xyz would be the most challenging, that would be really helpful.
     
    Last edited: Jan 3, 2020
  13. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,776
    All depends on complexity and your skill, in each relevant area.
    • If you always focus on optimization, this will be relatively easy.
    • If you for example have no artistic oriented mind, you will be struggling with making basics levels.
    • If you never touched AI, then this will be challenging.
    • If you never made networking game, this will be killer.
    And so on, you got the idea.
     
    Peter77 likes this.
  14. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    Yep, I do.

    I was thinking about someone who created racing games in the past, probably made learnings like "We totally underestimated xyz. That turned out to be way more complicated, or took more time, than we initially thought" moments.

    Let me edit my post above.
     
  15. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    When I was new to unity, programming and made a racing game, making menu in the old menu system took me longer (1 month) than ai (half a day) though. The other big thing was simply game architecture, I had hard time deciding who own/manage what at the beginning (couldn't test car without a race manager, since it spawn the tracks and the tracks spawn the car, bad idea everything is coupled).

    If you use spline you basically have the checkpoint system done for free almost, AI basically need to just follow the point, most Racing game have "lanes" that AI can eventually switch base on gameplay programming (the slow lane, the fast lane, teh risky lane) and mostly throttle speed based on role (leader, pack, trail) relative to the player's position and a defined level parameters (min and max speed generally).

    It really depend what's your affinity.

    I use mario kart too as a template, basically mario kart have roughly 4 "sceneries" per track (the sub theme), with eventually visual or gameplay transition between them, each sceneries tend to be focus on a type of gameplay too, and recently they even have their own music theme variations. The point is that planning the tracks in section might be useful. IMHO I feel like there is 3 tiers to track planning, the overall track shape (top down), the section is further tweaked (in player pov), with elevation slight turn, visibility, alt path, then fine tuning with "events", ie obstacles, short cut , items, ...

    I also notice there is "events" every 4 seconds, be it a coin to collect or a visual reveal, or a bump, so there is a rhythm in the tracks, ai seems to attack according to that rhythm too, I tend to see items coming my way in the same spots.
     
    Antypodish likes this.