How To Build Roads Procedurally In Unity with the Splines Package

  Рет қаралды 68,240

Game Dev Guide

Game Dev Guide

Күн бұрын

Пікірлер: 78
@realtimberstalker
@realtimberstalker Жыл бұрын
If you would like to make the curves for the intersection flush with the sides of the road, you can find out where the lines intersect, and set that as the point for the Bézier curve, which will give you a smooth transition.
@CaseyHofland
@CaseyHofland Жыл бұрын
I love how you start with doing your research, how you use existing API's, how you solve problems in a "leave everything untouched" manner: I'm still screaming to developers we should all be doing this, and it's nice to watch someone use these tools so effectively and cleanly. Subbed!
@lukasfletcher4732
@lukasfletcher4732 11 ай бұрын
A bit late but could you clarify for me what you mean by "leave everything untouched"?
@aceman0000099
@aceman0000099 10 күн бұрын
​@@lukasfletcher4732 I think he means, e.g. when he created an extension to the unity class rather than try and alter it and break the consistency.
@spidermankey1398
@spidermankey1398 Жыл бұрын
Ah! Another most learning video by this absolutely astonishing guy. Love this channel!
@v0ltdev
@v0ltdev Жыл бұрын
Oh my god you saved me, you have no idea how much i tried to figure out how can you do roads with this spline package
@v0ltdev
@v0ltdev Жыл бұрын
Ok, I tried following this tutorial but I'm having a rly hard time doing it because there is a lot of stuff you don't show, for example the functions from the overlay class or create new variables or parameters to functions and not even show or mention them, create structs but not showing where they are placed, etc.. I was finally excited to see how to make roads with this package cuz there is no other tutorials on how to do it, but you're making it hard by not showing everything.
@JoseALugoR
@JoseALugoR Жыл бұрын
Yes the same happened to me, even though he explains the concepts amazingly he pursposefully is not clear on some things of the code that you have to try to figure out for yourself or pay for his patreon and download the code... love his content but this video made me waste time trying to figure out the code.
@v0ltdev
@v0ltdev Жыл бұрын
@@JoseALugoR i managed to figure it out and do the roads without the intersections, if you want i can send you the script
@JoseALugoR
@JoseALugoR Жыл бұрын
@@v0ltdev thanks but I worked through it and got the intersections to work, don't need it now 👍🏻
@v0ltdev
@v0ltdev Жыл бұрын
@@JoseALugoR oh, then if you dont mind could you share how you made the intersections work?
@itsosmx
@itsosmx Жыл бұрын
I know it's been a while, but can you send the code?@@v0ltdev
@matheussantos250
@matheussantos250 Жыл бұрын
I was literally researching to do this two days ago. Thanks for the amazing as always
@GameDevGuide
@GameDevGuide Жыл бұрын
Glad to be of assistance!
@zORg_alex
@zORg_alex Жыл бұрын
And here am I, who spent a year making my own easy to use spline package. I felt I needed to fill that gap in Assetstore. Although there were some spline packages already, they all were Monobehavour based. I wanted a spline as a serialized object with it's own editor built into property drawer. But now we have this. But I think I still have more features in my BezierZ.
@stickguy9109
@stickguy9109 Жыл бұрын
I wish we had something similar to blender's curve tool with modifiers and everything.
@zORg_alex
@zORg_alex Жыл бұрын
@@stickguy9109 well modifiers I did not. But I've started some mesh generation tools. Like bending existing mesh along a path, or generating mesh from profile or another curve as profile. But my curve has interpolation built into it. So I might do it as a separate class so it would be more versatile.
@feathorix8778
@feathorix8778 Жыл бұрын
Oh, I feel you. Okay, I didn't write a whole asset from scratch, but I picked up the SplineMesh asset like 10 months ago and rewrote it heavily so that it uses Burst and jobs because I needed quite good performance for the mesh generation. Then I had a look at Unity's asset and recognized that it would be too much work for me to switch the spline asset 🥴😆.
@enescagrbayraktutan6329
@enescagrbayraktutan6329 Жыл бұрын
Awesome video tutorial! It would be amazing if you make traffic system for this procedurally generated roads in next videos! Keep up the good work!
@nxt_tim
@nxt_tim Жыл бұрын
This came at the perfect time 😊 Been wondering on how to approach this because of an upcoming game jam.
@asr59
@asr59 3 ай бұрын
Very interesting video! I've been working on a road system in Houdini for a game and nice to see other peers have gone through the same issues and solutions :D
@JustDezz
@JustDezz Жыл бұрын
This assembly definition hack is so much simpler than reflection mess. Thank you!
@Samuel-bd1ms
@Samuel-bd1ms Жыл бұрын
Wow. You just blew my mind with that Unity asmdef hack.... I'm going to use this in every project.
@GamerChunkZ
@GamerChunkZ Жыл бұрын
Wow. Looking more into these kind of terrain and road generation tool videos.
@shadow_xts
@shadow_xts Жыл бұрын
Thank you, I wasn’t aware of the Splines package. I had written splines myself to procedurally generate meshes and the least I can say, visualization wasn’t great. I now need roads that exist in 3D space and have colliders to it, so I’ll adapt this to procedurally create the colliding meshes. Thank you so much!
@grahamreid876
@grahamreid876 Жыл бұрын
This was so helpful! I never even thought to use splines like this 🔥
@nocturne6320
@nocturne6320 Жыл бұрын
I cannot imagine how complex the system must be in Cities Skylines
@TNTCProject
@TNTCProject Жыл бұрын
Terrific! As someone who is fascinated with pcg, I absolutely loved watching this. Good job :)
@domkalan
@domkalan Жыл бұрын
Amazing video, I’m currently doing my own research on this topic for a city building prototype I am working on. I have come to the conclusion that splines are the best method, and then looping through the spline points would be the best for pathfinding which splines are the best route to take.
@adamodimattia
@adamodimattia Ай бұрын
I don't think it is a "hacky" solution. The "internal" specifier is only there to ensure that no one will make use of internal api accidentally. There are also other ways around it, but these make use of relfection. The assembly reference is in fact quite a nice way for doing it.
@tokyowarfare6729
@tokyowarfare6729 4 ай бұрын
Considering the queality of unity deliveries in lates years. The spline tool looks oddly well built and fully featured.
@Briglair
@Briglair Жыл бұрын
Absolutely amazing! Concise and to the point. Thank you
@dreamisover9813
@dreamisover9813 Жыл бұрын
Great to see a new upload! Some of the other videos from your channel have been my favourite in terms of Unity content/tutorials
@matthiasallner4610
@matthiasallner4610 11 ай бұрын
Really cool video as always. I am working on a similar system, but bigger and even more procedural with houdini and if your brave enough to start with houdini i can tell you the sweep node is your friend! With it i generate one or multiple crosssection(s) of a road and "sweep" them along road splines and the result is a 3D modular RoadMesh that can be brought by HDA into any engine.
@skope2055
@skope2055 3 ай бұрын
Great content! Helped me a lot!)
@Sylfa
@Sylfa Жыл бұрын
6:12 - I do believe you flipped left and right in this section. Not that it matters much for the video, and I doubt there's any tools in youtube for fixing something like that without replacing the video entirely which would be way overkill.
@fx.minecraftgamer2370
@fx.minecraftgamer2370 Жыл бұрын
You are a true hero, this video helps a lot!
@GameDevGuide
@GameDevGuide Жыл бұрын
Glad it helped!
@nay2d2
@nay2d2 10 ай бұрын
cant get the gizmos part working, since I don't know what you did differently or didn't show that makes it work, really confused.
@krum3155
@krum3155 Жыл бұрын
Why not use a bezier curve for the curves of the intersections aswell? Like having the points be the corner points and the tangent the directions of the roads.
@fokeyjo
@fokeyjo Жыл бұрын
This was a really great video, well worked out. I was looking into this for a project. I hadn't got that far (and I probably would've run away at the point it got to UV mapping 😆), but I thought it might be slightly simpler for working out the intersection mesh points by having the original spline lines joining at the intersections, because then you have the perfect centre point for the junction. All the road termination points would be known from that centre (each road ending just has a distance back along its spline, and I think you can calculate it as another poster points out) and you'd even know if they were concave/convex from the angle between them being over 90. I'm assuming the spline near the junction is pretty straight (I was doing this with straight lines coming into junctions).
@user-cz4kb5uq9e
@user-cz4kb5uq9e Ай бұрын
Technically in Houdini you'd do the same thing but using VEX instead of C#. There are, of course, some tools that allow to generate a spline base road without writing a code, but as soon as you go into all this junction stuff it's just much more efficient to generate it by code. So basically it is like replace C# code with the HUGE paid plugin to be able to do the same but in a different programming language 🤣.
@sekunriruisen506
@sekunriruisen506 11 ай бұрын
Do you have this code anywhere? Patreon or something? Cause I did my best to keep up with your video and could definitely not reproduce what you created. It's the first time following your videos that I couldn't come up with your outcome, it just felt like a lot was missing as I went through it and the Mesh just will not render for me.
@GameDevGuide
@GameDevGuide 11 ай бұрын
Yep the project is available on Patreon 🙂
@RollingHeat
@RollingHeat 10 ай бұрын
Great tutorial and 10/10 topic. Like'd and sub'd.
@tomtomkowski7653
@tomtomkowski7653 Жыл бұрын
This is the biggest nightmare of Unity. Something that should be given out of the box (and it is in other engines) you have to reinvent yourself like a wheel and then fight with the engine to make it work. Or of course, you can always buy a working asset from the store, how typical for Unity's new business model. Great video! Is not about you is about Unity.
@DatBoi-jc8jf
@DatBoi-jc8jf 9 ай бұрын
There's a free one called mb road system, it is somewhat limited but it can do 3d (like a cork screw for example) and allows you to use custom meshes, also it has navigation it does not use unity's splines because it's older than that, but it is pretty similar. I've used it for some school projects
@birahe1810
@birahe1810 Жыл бұрын
It would be great if you could show about Cutscenes too!
@joeltumelty
@joeltumelty 8 ай бұрын
I've followed the video through to 9:45 and am stuck on implementing the JunctionBuilderOverlay class. Struggling with what needs to go in the CreatePanel and selection methods?
@raikenleo1902
@raikenleo1902 2 ай бұрын
how do you open the spline in the code editor?
@IPv6Freely
@IPv6Freely 11 ай бұрын
Do you have a video that goes more into depth on the tree generation? That looks like it could be super useful for generating a lot of trees, especially now that Vegetation Studio Pro is no longer available.
@vivekpattnayak8443
@vivekpattnayak8443 Жыл бұрын
Can someone guide that what SampleSpineWidth fuunction is?? and what does the t parametre does
@GameDevGuide
@GameDevGuide Жыл бұрын
That was just a wrapper function for sampling the point on the spline. T is just the time variable between 0 and 1 (like with a lerp function) zero being the start of the spline, one being the end of the spline.
@vivekpattnayak8443
@vivekpattnayak8443 Жыл бұрын
@@GameDevGuide Thanks very much I figured about t sorry for further trouble do you mind how does this wrapper function works
@sphelelelubanyana1750
@sphelelelubanyana1750 7 ай бұрын
Nice
@majort9703
@majort9703 Жыл бұрын
Amazing! but paywalled files :(
@RaviGovender
@RaviGovender 5 ай бұрын
Hi there, this is great, thanks so much for the video! I have a question, and my knowledge of unity is very limited but Im thinking of developing an AR racing car game that uses splines to auto generate a mesh/race track in any indoor space. How I imagine this is the user scans their living room using their camera and the splines respond to the various pieces of furniture to create the race track. From what I get here in your video, the splines still need to be built and cannot just procedurally sort of 'spawn'? Am I correct in this assertion? Also do you think this would be possible for me to do like you without using houdini? Thank you!
@RasmusMolck
@RasmusMolck Жыл бұрын
Hey nice video, I have a question: Is it possible to place knots with the spline draw tool without having 3d colliders in scene? I find it very enoying in my 2d game that I can't place the knots with the draw tool without first setting up some 3d geometry.
@nowherefool5869
@nowherefool5869 Жыл бұрын
do you have a tutorial how to wrap this spline roads onto a spherical planetary surface? also, can you edit the splines during the game's run time?
@TheMata2111
@TheMata2111 10 ай бұрын
Can someone help me just figure out how to do the first part of the project. I just need a flat mesh that i can draw using splines. no intersections needed
@luisportilla4109
@luisportilla4109 11 ай бұрын
where did the sphere come from in the spline sampler script
@vladalx8820
@vladalx8820 Жыл бұрын
Hi, what font and theme do you use on visual studio? Thanks!
@ROK_220
@ROK_220 Жыл бұрын
Hi, can you help me? how to make a collision mask? that is, when an object enters a collision, it cuts itself out of this collision (sorry, I don't know English well, I use a translator)
@itsosmx
@itsosmx Жыл бұрын
I really appreciate your work, but the problem with me is that you are shown the code in a very hard way to understand, and for me, I couldn't connect everything together, all we need just try to show us while you are writing or the full code editor screen, thank you for your hard work.
@micflynn1
@micflynn1 Жыл бұрын
Sorry but will this work with Unity 2019? I do VRCHAT and am starting to build worlds
@sneffetsd
@sneffetsd Жыл бұрын
knowing about road design help, gamers have a misconception that roads are organic or spline based. Actually, road have only 3 types of geometry, lines, circular curves and spirals. you can have two lines with one curve connecting or two lines with two spirals and one curve.
@jamesc2327
@jamesc2327 10 ай бұрын
so, where can we get this tool you built?
@eneseren8332
@eneseren8332 5 ай бұрын
Is these splines only 2D or it works on 3D?
@andrewpullins8817
@andrewpullins8817 Ай бұрын
Splines are both 2D and 3D.
@Pa3BeDka_Gaming
@Pa3BeDka_Gaming 3 ай бұрын
Please tell me how to make transport follow its lane, but at the same time the road will not be drawn as in Cities: Skylines, but will be added as an object in the form of a 1x0.25x1 cube grid system. I've tried almost everything, I don't know what the method is and I won't stop.
@RobertMaximVerdes
@RobertMaximVerdes 11 ай бұрын
Assembly reference hack is how Neo managed to make the jump. Now I know
@AlekseyLoykuts
@AlekseyLoykuts Жыл бұрын
We need collab with Freya on this 😅
@FurkanKalli
@FurkanKalli Жыл бұрын
I don't understand why Unity's own spline solution is worse than other spline packages. 😟 For example, there is the Dreamteck spline package available in the Asset Store, but Unity's own solution is far behind this package.
@parhamrezaee6996
@parhamrezaee6996 Жыл бұрын
google wants play billing 5 or newer, can you please make a torurial for that also how to update unity with google billing library 5 or newer? Its the problem of so many people and no one talked about it yet
@GameDevGuide
@GameDevGuide Жыл бұрын
I don't do mobile development so I don't cover it, sorry.
11 Things You (Probably) Didn't Know You Could Do In Unity
13:49
Game Dev Guide
Рет қаралды 152 М.
Making a Traffic Simulator game: 3 months of progress!
15:32
Nikita Lisitsa
Рет қаралды 5 М.
Please Help Barry Choose His Real Son
00:23
Garri Creative
Рет қаралды 23 МЛН
PEDRO PEDRO INSIDEOUT
00:10
MOOMOO STUDIO [무무 스튜디오]
Рет қаралды 16 МЛН
The Ultimate Guide for Physics in Game Development!
1:04:41
Will Hess
Рет қаралды 121 М.
Splines are Awesome!!!
11:13
Code Monkey
Рет қаралды 149 М.
Procedural Generation of a City in Unity
7:24
TJ
Рет қаралды 53 М.
How Games Have Worked for 30 Years to Do Less Work
23:40
SimonDev
Рет қаралды 1,3 МЛН
Building a Traffic System in Unity
17:55
Game Dev Guide
Рет қаралды 217 М.
Giving Personality to Procedural Animations using Math
15:30
t3ssel8r
Рет қаралды 2,5 МЛН
Speed Up Compile Times in Unity with Assembly Definitions
9:54
Game Dev Guide
Рет қаралды 89 М.
Please Help Barry Choose His Real Son
00:23
Garri Creative
Рет қаралды 23 МЛН