"welcome to the second episode of this procedural Kevin generation series"
@NStripleseven4 жыл бұрын
littlesnowflakepunk wait what
@littlesnowflakepunk8554 жыл бұрын
@@NStripleseven listen to the first two seconds of this video again
@NStripleseven4 жыл бұрын
littlesnowflakepunk oh
@littlesnowflakepunk8554 жыл бұрын
@@NStripleseven it even shows up in the autocaptions lmao
@haachamachama74 жыл бұрын
I can't unhear it...
@tacopacopotato66199 жыл бұрын
not only is the theory in your video really interesting but you also pace the execution of the ideas really well. easy to follow and at the same time not boring. good job
@fraxinellla9 жыл бұрын
Thanks a million for these vids! I had a loose grasp of this and pathfinding, but your videos fill in the gaps I didn't quite understand.
@null14874 жыл бұрын
I had a loose grasp on my-
@legohexman28583 жыл бұрын
@@null1487 huhuhuhuhhu
@eweeparker9 жыл бұрын
Precisely what I was looking for. This is the only way to truly handle the undertaking of cave/dungeon generation for small operations. I've read about even Bethesda handling things similarly. There is a great article you should search out about their methodology on level design.
@fuuryuuSKK5 жыл бұрын
>uses Ternary >"Strange Notation"
@krzysztofczoczynski4194 жыл бұрын
I mean, it's not the most readable thing in the universe for beginners, and if you're watching a tutorial about marching squares then you probably aren't hyper advanced
@null14874 жыл бұрын
A unity D
@Salmontres3 жыл бұрын
Thank you for making this! Pretty advanced topics but covered in a very nice way!
@Megaman2311228 жыл бұрын
I have been following this tutorial for my computer science project, thank you... be prepared to see the same person ask multiple questions XD
@CheeseChuckie9 жыл бұрын
I'm subscribed to you and I'm going through every video of yours, I hope videos like this from you never stop... You're quickly becoming my favourite youtuber! Keep it up man!
@Weckacore5 жыл бұрын
The best part of these videos is the focus on class architectures and sustainable coding practices (not to mention math, and cool results). Sebastian Lague, you make me wanna be a stronger programmer!
@burakerbora9 жыл бұрын
Dude thank you so much for this, it's being extremely helpful.
@Rubafix9899 жыл бұрын
Stop making awesome videos, please. I did not fully recover from you last series yet and still processing path-finding request everywhere I go. Now I can't Imagine how my apartment will look like if I start working on procedurally generated cave -.-.
@DavidPatMathis816 жыл бұрын
Yeash, that's a LOT of code between testing breaks. I would try putting in more gizmo tests and possibly break down the code into smaller functions, such as doing the nodes in the first part then the control nodes in the second. People who are starting out are going to struggle on this video. But the content is really good!
@KeenanWoodall9 жыл бұрын
OH MY GOD YEEESSSSSS! I have waited my whole life for this! Thank you, Sebastian, my lord and savior!
@hypegt68855 жыл бұрын
You need better priorities and life goals.
@INeatFreak5 жыл бұрын
Lol
@ezrahuffman Жыл бұрын
For anyone who migh be watching this and wondering why all the nodes come out as a straight line when trying this yourself, you probably have the wrong axis. In this video, the 'up' is the Z-axis. Traditionally (and in unity's 2D view) the Y-axis is 'up', you need to swap around the axis accordingly (only a few lines that need to be changed). Also, x is to the 'right' in both of these cases, but might not be for you. I was trying to follow along for one of my own videos and ran into this issue. Hope it helps someone. (I make videos too 😀; though they are worse)
@King_H Жыл бұрын
Hey, nice job figuring that out! Would you mind sharing exactly which parts you changed in order to get this to function properly? EDIT: Although I experienced the same problem of having a single line of cubes, I found my problem was my calculation done for the Vector3 pos was incorrect missing a step for the Z axis, simply wrote the wrong thing.
@ezrahuffman Жыл бұрын
@King H I changed the line for setting the position of the square. Right and up are okay because vector.right is +x and vector.up is +y. Also after watching the rest of this series it makes sense why he has chosen these axis. The walls are then orthogonal to this map meaning the 'vertical' axis is the y-axis. Anyways I think it was just swapping z and y in setting the square position. I have made changes to the code since then so I am not sure.
@nswell10749 жыл бұрын
Your tutorials are fine. Thank you for the tutorial.
@josephdouglass86078 жыл бұрын
OUTSTANDING!!! How is this dude not leading a country? Thx Sabastian! Thx Unity!
@braindeadjoe9 жыл бұрын
Awesome tutorial! Great work, I'm having fun with this
@TheJishanator9 жыл бұрын
Amazing tutorial, great speed to keep me on my toes!
@sevendubb6 жыл бұрын
I love the video, I hate trying to follow along in near-real-time when Visual Studio is popping me in and out of "insert" mode, auto-completing veritable novels-as-methods, etc. I haven't used many IDEs (really only Eclipse and this now), but the amount of hand-holding and "let me get that for you" (whilst shoving me out of the way) is beyond infuriating. Totally tangential, but I feel like the default settings for such hand-holding should be dialed back considerably, and let users figure out how to customize their QOL settings as they get familiar with the IDE. Between the wrestling with VS and alt-tab frenzy, I had to stop and re-watch a few things to MENTALLY follow along, but overall I like your pacing and diction.
@KimHarderFog9 жыл бұрын
Awesome tutorial, as always :) Did you create the first part in unity as well, the one where you show the 16 different combinations ?
@SebastianLague9 жыл бұрын
Thanks, and yes you're correct - the visualizations are made in Unity.
@KimHarderFog9 жыл бұрын
Sebastian Lague Cool. Would you be interested in sharing the source code for the first part ? I would like to know how you made the selection of numbers and corresponding actions happen.
@SebastianLague9 жыл бұрын
Kim Bo Rasmussen pastebin.com/isrE9Ht0
@KimHarderFog9 жыл бұрын
Sebastian Lague Thanks a ton !
@filipv4u9 жыл бұрын
Hey, thanks for the tutorial, it was very easy to follow and very well presented. I was wondering, why does every ControlNode have the above and right Node specifically? Could we pick 2 different nodes? Is that just so we populate the Nodes?
@BastienGIAFFERI9 жыл бұрын
Really good ! Waiting the next episodes ! :)
@reallyjolle4 жыл бұрын
this guy really likes classes
@SasukeUchiha7237 жыл бұрын
I dont see the squares generated on my scene. I did the code correctly. Help pls
@DerClaudius9 жыл бұрын
Good format, good pacing besides showing too many examples at the start. Cheers!
@shyxiaolong3 жыл бұрын
who can explain me. why we are add 0.5f at the initialising squareGrid pos = -map/2 + size + 0.5f. and i dont use 0.5f and nothing happing. i dont understand. i hear mentor. he said for centered node. but at the finish we have all worldMap represents at squareGrid +0.5f all cells. and why its neccesery?
@javiercestau61758 жыл бұрын
How long take you to learn all this???, i'm trying to do it by myself but it's get it me headache jajjaj btw you're awsome dude!
@DarkJ0hn4r7 жыл бұрын
Just goggle marching squares :v
@error.4185 жыл бұрын
@@DarkJ0hn4r They might be better off googling instead of goggling...
@SchalaArchives2023ish8 жыл бұрын
I'm guessing marching squares is a simpler form of marching cubes? If so, then would the binary flags be 8 (a full byte) instead of 4 (a nybble)? or would they be 16? (2 bytes)
@error.4185 жыл бұрын
yes, marching cubes is one dimension higher than marching squares, but same concept. you could make a marching tesseracts version if you wanted. there are people making 4D games (like the 4D Rubik's Cube and Miegakure). you need 16 values for marching squares control node configurations, so you should be able to derive the type from that information. you will always need 2 to the power of the number of control nodes. so for marching squares that's 2^4, for marching cubes that 2^8, for marching tesseracts that's 2^16, etc. you can technically also make a marching line segments algorithm if you want to go one dimension down from this video...
@Goombatastic9 жыл бұрын
So complex, Good work!
@INeatFreak5 жыл бұрын
17:55 aren't you supposed to add squareSize instead of ones?
@AberrantAberrant4 жыл бұрын
I've tried at this three separate times and I'm always lost when I get to this episode. 1 makes perfect sense but when you throw in all that stuff with "squareSize" I have no idea what any of that is for. I'm never gonna get random generation :/
@xDeltaF1x4 жыл бұрын
At what timestamp is the part that is confusing you?
@corypatten72238 жыл бұрын
I get the error NullReferenceException: Object reference not set to an instance of an object mapGenarator.GenerateMap () (at Assets/mapGenarator.cs:39) mapGenarator.Start () (at Assets/mapGenarator.cs:18) and I can't seem to find a fix any ideas?
@corypatten72238 жыл бұрын
Never mind I fiqured it out, forgot to drag the script onto the mapgen object
@peakzennit6 жыл бұрын
Is this series viable to follow for 2D cave generation? In order to do so, would I just skip episode 4? (Looks great by the way!)
@INeatFreak5 жыл бұрын
liked for the procedural Kevins
@ianparker50077 жыл бұрын
what are your thoughts on applying this to 3d such as a series of prisms? In other words, something that would incorporate the third axis. I think that would be a fun experiment. Perhaps that alongside inclined pathways to additional "floors" for lack of a better word.
@Neran2803 жыл бұрын
late answer, but this should be extendable to 3D. The correpsonding algorithm in 3D is called marching cubes.
@copypaste35265 жыл бұрын
phew... and here I thought I know c# a little. well... thanks for the lift
@SharpData9 жыл бұрын
Excellent tutorial, thank you!
@aquaforgegames62079 жыл бұрын
Hey! Love these. Always wanted to work with procedural levels, but could never figure it out! Do you know when your next episode will be out?
@SebastianLague9 жыл бұрын
Some time within the next 7 days :)
@aquaforgegames62079 жыл бұрын
Could you possibly tell me what the next step would be? Would you create some walls in Maya or a 3D modeling program and then set them for the number? If so, would you use a foreach statement or a switch?
@SebastianLague9 жыл бұрын
PanduhhGaming Decided to go ahead and record the episode today, it should be up here: kzbin.info/www/bejne/aJisqZtueL1mfs0 The approach you suggest of using 3d models is also good in certain situations (Daniel Snd used it brilliantly in our LD29 game Infection): kzbin.info/www/bejne/aoWUoZ18gLpnrsU
@PheonixDeath19 жыл бұрын
Always impressed even though i cant do this stuff.
@uex82497 жыл бұрын
I think the OnDrawGizmos() function could be more effective if removing the Repeated cube.
@Keeesemonster5 жыл бұрын
its just a debug method tho
@flippygat39 жыл бұрын
I am trying to do marching cubes like this but in a 3D environment. The problem is that if it is 3D the nodes could be active in more than one direction possibly making it too complicated to work. Anyone have thoughts about this?
@BeBeetleBird9 жыл бұрын
+flippygat3 watch all tutorials.... dont stop at this one..
@kittyn52222 жыл бұрын
Can you make ores in the rocks
@JohnDoe-rt2um4 жыл бұрын
3:39 if you want to see all the combination in order
@gregoryfenn14626 жыл бұрын
EDIT: solved below. It all seems to work for me but I get this seemingly harmless error message after playing the game, it reads "UnityException: Gizmo drawing functions can only be used in OnDrawGizmos and OnDrawGizmosSelected." Anyone know what's going on? I'm using the early 2018 version of Unity 5 btw. ##### SOLUTION: I was explicitly calling the drawing tool as thus: public void GenerateMesh (int[,] map, float squareSize) { squareGrid = new SquareGrid (map, squareSize); OnDrawGizmos (); } Deleting the 'OnDrawGizmos();' line solved it. I guess Unity 5 is designed to call OnDrawGizmos for free, like it does for Start Update or FixedUpdate.
@davidhaylock61868 жыл бұрын
Hey Seb, really great tutorials. Just have a question about the mesh generator. My coordinates seems to be flipped around the x axis, any thoughts? Cheers
@davidhaylock61868 жыл бұрын
+Sebastian Lague Sorry the configuration values are flipped
@Asimov165 жыл бұрын
Seeing as the mesh is made out of Rock then you should have AC DC also LOL
@thidios4 жыл бұрын
Do you live close to the sea or a very big lake? I can hear something similar to a very big body of water.
@thehuggz-i9k7 жыл бұрын
Would it be worthwhile to attempt to adapt this into marching cubes, or would it be better to cubes differently?
@odinoczka5 жыл бұрын
What about the Lament Configuration? *couldnt resist the joke*
@rucklerful9 жыл бұрын
could you explain more of waht the constructor: public ControlNode(Vector3 _pos, bool _active, float squareSize) : base(_pos) does. I dont get the part with the :base( _pos) . Why do you use such syntax?
@borisdas50919 жыл бұрын
Raw Spartano Not a pro here, but my take would be that it replaces the need to declare the _pos variable in the constructor and instead uses the base class' constructor for assigning that variable. So instead of public ControlNode(Vector3 _pos, bool _active, float squareSize) { active = _active; position = _pos;
@rucklerful9 жыл бұрын
boris asd thank for the answer, i used the debugger and it is as you said.
@borisdas50919 жыл бұрын
Raw Spartano You're welcome :)
@davidmonroy25098 жыл бұрын
What kind of subjects of field of knowledge are required to understand and create this and similar kinds of procedural generation(especially when it becomes more advanced)? I know obviously code... c#, but math? Linear Algebra? Statistics? (I'm just shooting in the dark here) Or is it just depth in the knowledge of c# and unity? And or perhaps just studying procedural code in general? I want to get into the depths of coding procedural generation for my projects and want to know what I should focus on studying. Thanks.
@redhood71058 жыл бұрын
Algebra, Geometry, Trigonometry
@redhood71058 жыл бұрын
Most of the concepts you have seen in these tutorials are math concepts translated into code and illustrated as graphics(Tiles, meshes, etc).
@davidmonroy25098 жыл бұрын
Thanks!
@redhood71058 жыл бұрын
Oh btw, concept of concepts is linear algebra. should have mentioned in the original reply
@さこうたいし9 жыл бұрын
works perfectly but it runs slow when I play it.
@ovrsurge46899 жыл бұрын
+さこうたいし I'm no expert but it might be the increase in vertices. Using the stats window I found out it's rendering 1.7 million triangles which doesn't sound optimized. No doubt that will get addressed or fixed when you move to making a mesh.
@purpleice23438 жыл бұрын
+Ovr Surge Obviously, I don't even know what gizmos are but they sound like something you would use only for testing.
@avischiffmann62207 жыл бұрын
In the end mine doesnt show
@gregoryfenn14626 жыл бұрын
you're going to have to give more info abut the error reports or what may be going wrong for us to help you
@changedev.1983 жыл бұрын
How can I make this work on 2D?
@linuxguy11996 жыл бұрын
Im it in Java without any external libraries, completely from scratch
@maxi03614 жыл бұрын
Do we still need to implement our own or does Unity 2019 has this feature?
@PixelThorn4 жыл бұрын
As far as I am aware neither unity or unreal has this feature already implemented
@danielsndgamevideos9 жыл бұрын
Genius :o
@SebastianLague9 жыл бұрын
Hey! Was just reading your dev log a few minutes ago - looks fun :D
@danielsndgamevideos9 жыл бұрын
Thanks ^^ Btw, we up for LD together again next month?
@SebastianLague9 жыл бұрын
Daniel Snd GameDev Yes! And I'm in luck this time - it falls on the last weekend of my holidays :)
@danielsndgamevideos9 жыл бұрын
Yay \o/
@DaminGamerMC4 жыл бұрын
Th coding train just mentioned you
@SasukeUchiha7237 жыл бұрын
how do you make those switches in unity?
@skeptikwatcher99109 жыл бұрын
Hey man! Love your tutorials and I was just wondering whether you will be going back to your A* path finding tutorial?
@SebastianLague9 жыл бұрын
Thanks! I will definitely do a couple more A* episodes in the future, just taking a break for a little while ;)
@skeptikwatcher99109 жыл бұрын
That's cool, I know the feeling :)
@Skythedragon8 жыл бұрын
thanks for this! hope it will work in 3d too!
@fallenecrolyc59929 жыл бұрын
For y'all who don't know what marching squares are, and is dying, go check this out~ kzbin.info/www/bejne/bKDZoGiYa9t_gaM
@CharIie835 жыл бұрын
why are you labelling vertices clockwise tho
@jes.5 жыл бұрын
Unity uses a clockwise winding order for front face
@CharIie835 жыл бұрын
@@jes. Silly of unity. The cross product of 2 connected sides will be positive, if the non connected points are in counter clockwise order on their respective plane. Its standard on openGL and I believe directX also. Maybe it doesnt matter, but why go against the norm
@Nonsense9139 жыл бұрын
Thanks man.
@StigDesign9 жыл бұрын
Great Work :D
@MuppetSmash9 жыл бұрын
whyyyyyyyyyy?? I just CAN'T find the problem D: NullReferenceException: Object reference not set to an instance of an object MeshGenerator.OnDrawGizmos () (at Assets/Scripts/MeshGenerator.cs:22)
@MuppetSmash9 жыл бұрын
***** Thanks man
@aaronf6804 жыл бұрын
Thanks, but why does it throw me an error
@burhanuddinabbas20067 жыл бұрын
why its just showing me one row of cubes
@seimoun6 жыл бұрын
same
@error.4185 жыл бұрын
you likely messed up your nested for loops
@PeterKristl6 жыл бұрын
Man, this video was about how you write some code, without explaining it...
@user-cd2sj7zl4k8 жыл бұрын
all that encapsulation tho
@error.4185 жыл бұрын
yeah, it makes it way easier to work with
@LineKernel8 жыл бұрын
@ kzbin.info/www/bejne/r4DKeqGZgNVjeKc you re assuming we ve got a even width and height ? i d remove +squareSize/2 and make a if(nodeCountX %2 == 0)pos+= new Vector3(squareSize/2,0,0); and same for Y would that be correct ?
@TechWithSabri7 жыл бұрын
hi my frnd can you show me haw i can display a lot of photos in visuel studio + Opencv+ OpenGl please i need you'r help thnx bro for u'r attention
@kennyPAGC8 жыл бұрын
the scene moves so slow with all these cubes :( and I'm using a smaller grid than yours: it's 70x40
@vitals83284 жыл бұрын
to fix this u might want to look into perlin noise it is alot more useful: A helpful line for this is if(Mathf.PerlinNoise(x * noiseScale, y * noiseScale) > randomFillAmount / 100) IK this was four years ago but ¯\_(ツ)_/¯
@beatsbybrandon9024 жыл бұрын
Is it me or does 0:28 Kinda look like a dragon or something
@KanalMcLP5 жыл бұрын
A Kevin-Generator lol
@TheMrSnipey7 жыл бұрын
This would be great ... if it worked. Mine renders 2 squares and that's it. I have gone through every line of code and it's the same as yours.
@kilroy9874 жыл бұрын
hooagh.
@kenners19939 жыл бұрын
may I suggest doing *0.5 and not /2, /2 is more intensive for the code
@JJJMMM19 жыл бұрын
Engineer Valkyrie I haven't compared bytecodes, but I'd bet that the compiler optimizes these and you wind up with the same code either way.
@kenners19939 жыл бұрын
JJJMMM1 Maybe, not 100% sure but I just know doing * is more efficient :P
@nathanielsaxe30496 жыл бұрын
In general yes, but in this case it's dividing by a power of 2 so the compiler is almost certainly reducing that to a bitshift
@error.4185 жыл бұрын
may I suggest not pre-optimizing?
@touristtam7 жыл бұрын
2 comments: 1) please split your code into separate files and function/methods. This is already starting to look like a bowl of spaghetti. 2) the time your audience is looking at you writing your code would be better spend at explaining it.
@botsam.4439 жыл бұрын
How did you learn all this?
@SebastianLague9 жыл бұрын
Well marching squares in particular I learned from reading the wikipedia page on it: en.wikipedia.org/wiki/Marching_squares
@yaboienglishguy15815 жыл бұрын
Make this a game
@vasyapupkin93386 жыл бұрын
20:46 Hahaha
@samsamm7779 жыл бұрын
on or orf
@yaboienglishguy15815 жыл бұрын
Make tis a game
@asahutchinsoniv95634 жыл бұрын
A tutorial? No, this is a watch me type a bunch of code and not explain why I'm doing what I'm doing. Oh and keep up because I move way too fast. Be better
@shadysandman48485 жыл бұрын
the line MeshGenerator meshGen = GetComponent(); meshGen.GenerateMesh(map, 1); returns a error where it says "Unreachable code detected", any solutions?