Programming Terrain Generation for my Farming Game

Sdílet
Vložit
  • čas přidán 20. 01. 2023
  • Devlog video about "Homegrown", a casual farming game I'm creating using my own engine. This time I use the dual-grid approach to generate some nicer looking grass and path meshes!
    Oskar's talk about the dual-grid (starting at 5:08): • SGC21- Oskar Stålberg...
    Support the channel on Patreon and get access to the code for this game, the city-builder, and Equilinox:
    / thinmatrix
    My previous game "Equilinox":
    store.steampowered.com/app/85...
    You can follow the progress of the game on my social media:
    Twitter: / thinmatrix
    Instagram: / thinmatrix
    Facebook: / thinmatrix
    Trello: trello.com/b/W3zkIJTM/farm
    Email: thinmatrix@gmail.com
    Background music by Jamal Green:
    open.spotify.com/artist/50jTM...
    Outro music by Dannek Studio:
    / dannekstudio
    #devlog #Homegrown
  • Hry

Komentáře • 378

  • @ocleidyreve6361
    @ocleidyreve6361 Před rokem +490

    It would be nice to see a video about the game performance and the optimization of your development process. This video is amazing as always. Thanks

    • @ashenr1der
      @ashenr1der Před rokem +8

      I second this, though with the upload schedule he has, I assume it's probably too much extra work...

    • @ThinMatrix
      @ThinMatrix  Před rokem +133

      Nice idea, I'll try to do a video about that at some point!

    • @klaxoncow
      @klaxoncow Před rokem +10

      As Donald Knuth has it: "premature optimisation is the root of all evil".
      Mind you, I've met coders who misread that and use it as an excuse not to do any optimisation at all, when the keyword there is "premature". Not "don't do it at all", but "only do it when you need to, and towards the end".
      More specifically, I'd refine Knuth's advice and say that optimisation needs to be a "top down" process. Start at the highest level - the algorithm - and work your way down from there.
      This is just logic. There's no sense, say, spending ages scheduling individual CPU instructions to get a routine super-fast and then going one level up to optimise the algorithm... because it's quite possible that a better algorithm might not even need the routine you spent ages optimising, or at least it'll likely be radically altered.
      The underlying logic is that the high level is composed of the low level. Routines are made of instructions, classes are made of routines (and data), classes are put together to make a program, etc.. So there is a natural directionality there.
      And part of "premature optimisation is the root of all evil" is a recognition that you shouldn't be messing too much with the lower level before you've optimised the higher levels, as a change of algorithm could invalidate all your previous optimisation work and, you know, that's just a waste of everyone's time.
      The other reason to always do optimisation in a "top down" manner - from the highest to lowest levels - is that a high level optimisation (such as changing the algorithm - trivial example: changing from a linear search to a binary search, or changing from a binary search to a hashed search, or something like picking a better sorting algorithm) will net you the biggest wins.
      Sometimes a clever re-arrangement can negate the need to do something altogether - and to quote Knuth again, "the fastest code is the code that never runs". For example, you've got some data and you sort it then you search it. But, ah, if you can just insert the data in a sorted order in the first place - always store it in a sorted order from the off - then you don't have to run a sort before you search, as it's always kept sorted all along, then you can drop that requirement to sort before you search. More over, if it's always sorted, then you can run that binary search - O(log 2 n) - to find out where you need to insert new data, so even the on-the-fly sorting of data is sped up over a linear search.
      Anyway, yeah, the point in that example is that you need to approach it "top down" because changing the algorithm - from linear search to binary search - will net you the biggest optimisation wins early. Indeed, after doing that, you might find you have no need to optimise any further. That'll do. Good enough.
      But if you did this example "bottom up", then you'd be trying to improve the individual instructions of your linear search, choosing a better sorting algorithm. etc. - all of which would be immediately thrown out, when you change algorithm from linear search to binary search. You'd do all that work and then throw out everything you did. A waste of your time.
      And this is what I mean about there being a natural directionality to optimisation, and that it should always be applied in a "top down" manner. You'll get the biggest wins first, and avoid wasting your time, when you have to scrap that heavily-optimised routine that took you forever, as the new algorithm you're using doesn't even need it at all.
      You get the gist. Indeed, don't even worry about optimisation until you need to - as Knuth advises - because making premature optimisations will potentially just find you "undoing" all your hard work later on.
      You spent ages making that sort super-fast, but turns out that sorting as you go and doing a binary search will win you so much more (indeed, I find things like university courses spend a lot of time on sorting algorithms, when usually what you really should be doing is keeping everything pre-sorted - or hashed - in the first place, so there is no "sorting phase" at all).
      Start at the highest level and work your way down. If you even need to, as a change of algorithm might just fix your "slow code" problems there and then. But, yeah, bear in mind this natural "directionality" to optimisation. The high level is composed of the low level, so don't sweat the small details until you're damn sure that you've got the overall structure and algorithm - the "big picture" - down pat first. That's where your biggest wins will be - big enough, often, that you need not do anything more beyond that - and it avoids the problem of neurotically re-arranging the small details only to find you don't need that routine at all now, so all that time was wasted.
      Or, in short, as Knuth had it: "premature optimisation is the root of all evil".
      (And he's as harsh as to say "the root of all evil" just because it's too common a problem for coders to spend forever optimising some low level code, scrapping it, optimising the new low level code, scrapping it... and getting caught in a cycle of doing tons of hard work that, in fact, gets you absolutely nowhere. So he's stressing that you should always just aim to get things up and running first. Even if it's a bit slow and clunky. Worry about optimisation when you need to worry about optimisation. For 2D games or simple 3D like Homegrown, it's very likely that a modern CPU and GPU will easily eat your code for breakfast and never be seriously slowed down, even by the most unoptimal code ever. Getting code to shippable status is often a Herculean task unto itself, so don't add more work on top of that until you really have to. Get the game to work. Then worry about getting the game to work well. Yes, there are, unfortunately, some coders who put off optimisation forever and their code runs like shit - and, to be fair to them, that might just be because deadlines hit and it gets shipped "as is", and they were always intending to improve it later. But, still, do it that way, to avoid getting caught in the "perfectionist loop" where you're working hard forever, yet never ship anything. That's why it's phrased as "the root of all evil" by Knuth, as a bad case of "premature optimisation" can kill a project stone cold dead. Months of work, nothing really to show for it and that first unoptimised version ran just fine anyway.)

    • @ocleidyreve6361
      @ocleidyreve6361 Před rokem +29

      @@klaxoncow Thanks ChatGPT, really appreciated

    • @bartpelle3460
      @bartpelle3460 Před rokem +4

      @@klaxoncow Kevin, you're on an Adderall-ramble. Snap back to reality.

  • @DevelopAnEngine
    @DevelopAnEngine Před rokem +169

    The little boost I needed to open Visual and code

  • @bobbelcher6742
    @bobbelcher6742 Před rokem +135

    I love the look of those paths! The only thing I’m worried about is how the limited space might incentivize the player to replace all their green grass with brown dirt and grey paths. I might have the player constrained in other ways, such as with seeds, fertilizer, etc, to encourage them to decorate. Great work as always, your code is a work of art.

    • @ThinMatrix
      @ThinMatrix  Před rokem +58

      Thanks! And I've got various ideas for why paths might be needed or be beneficial in the garden, so adding pathways won't just be an aesthetic choice for the player :)

    • @bobbelcher6742
      @bobbelcher6742 Před rokem +22

      ​@@ThinMatrix I was more worried that if replacing grass with dirt and paths was incentivized the player would be pressured into creating a brutalist rather than natural looking garden. Thanks for considering feedback!

    • @ThinMatrix
      @ThinMatrix  Před rokem +27

      @@bobbelcher6742 Ah I see what you mean. Different path types (including grass) will have different pros and cons associated with them, and if I balance it correctly there should be times where the players will want to use one type and other times when they'll want to use a different type. I definitely agree with you, I don't want to gardens to end up looking to brutalist either!

    • @siaaah6931
      @siaaah6931 Před rokem +8

      Would be cool to require an amount of grass next to dirt to generate a passive low level fertilization effect on the plants.

    • @bejoscha
      @bejoscha Před rokem +3

      @@ThinMatrix Such as bees only visiting (and improving yield) when they have "natural" grass nearby, maybe?

  • @bestformspielt
    @bestformspielt Před rokem +136

    Can we take a moment to appreciate the transition from camera to screen capture at 10:50? Very well done! Your editing is superb! And the videos in general are awesome as well, of course.

  • @1Chitus
    @1Chitus Před rokem +7

    The terrain looks much nicer now, I didn't think it would make such a big difference to bevel it a bit but wow!

  • @tagis
    @tagis Před rokem +28

    I'm not a fan of farming games but I admire this series so much! The creativity that your vids beam with is unbelievable. That game is so beautiful, the effort that you put into your games... It's just, I don't know what to say. Keep up with it, you're making something remarkable.

    • @ThinMatrix
      @ThinMatrix  Před rokem +12

      Thank you so much ^^

    • @Bozebo
      @Bozebo Před rokem +2

      I have no interest in farming games, but when farming is in a game I love it xD

  • @fbob987
    @fbob987 Před rokem +27

    Lovin the chocolatey paths 😅 Also that mesh wireframe at 7:56 is super satisfying for some reason, nice job!

  • @indiedevdylan
    @indiedevdylan Před rokem +1

    I always love seeing the updates you make to your game! This game has so much potential, keep it up!

  • @Tom-Kowalczuk
    @Tom-Kowalczuk Před rokem +10

    Yay !
    Really liking the progress so far

  • @mkrichey1
    @mkrichey1 Před rokem

    Its great to see this project coming together, thanks as always for the interesting and well edited dev logs :)

  • @hackticdev
    @hackticdev Před rokem +1

    This looks really good, the art is really starting to come along! Excited to see where you go with it next.

  • @dandymcgee
    @dandymcgee Před rokem +3

    Looks amazing! Thanks for sharking Oskar's wonderful talk on dual grids. Very interesting talk.

  • @LucasStraub
    @LucasStraub Před rokem

    Man, you inpire me so much, your video videos always show a solid progress, code explanation and great editing, it is just too good! I love it!

  • @JellyLancelot
    @JellyLancelot Před rokem

    Awesome progress! Love the videos, the style is so calming and fun to watch whilst destracting me from doing some dev myself haha

  • @baksoBoy
    @baksoBoy Před rokem

    This entire series (or just this entire youtube channel in general, since I have also seen the town game development videos) is absolutely amazing! it has felt so incredibly relaxing and inspiring seeing both stuff regarding what you are developing, but also your lifestyle!
    By seeing all the things you do in your life other than game development I feel like it has truly motivated me to do more myself!

  • @wcrb15
    @wcrb15 Před rokem +3

    Man it's awesome how much that changed the terrain look. It fits in so much better. Great work

  • @sicknickeroni
    @sicknickeroni Před rokem

    I love it when you upload. It always gives me some extra motivation to open up Unity and Visual Studio and work on something of my own.

  • @julianav.4031
    @julianav.4031 Před rokem +2

    I really love to see the while process of developing a game. I've always been a fan of game developing and it's really fun to watch how it all works, a type of content that it's usually hard to find, especially from indie devs, at least during the development phase.
    than you so much for taking the time to make these videos.

  • @Vimlark
    @Vimlark Před rokem

    Looking great! Love that double grid system. Need to watch that talk, thanks for sharing it!

  • @melihmete807
    @melihmete807 Před rokem +11

    Superb as always. Some of us really expecting a video about that smooth camera system. 😊

  • @bejoscha
    @bejoscha Před rokem

    Great progress, great video - as I've come to expect from you. Really love how you show all steps: Idea, proposed algorithm, implementation, result (and resulting complications and their results.) It is not only fun, but it is really teaching how to do things. Not just teaching solutions. Looking forward to you next video.

  • @skiesquiggles7319
    @skiesquiggles7319 Před rokem

    So many clever ideas in this one! The two-grid system is one of those things where as soon as you explained it I wondered why I hadn't thought of it myself. It's always a pleasure to watch your videos :)

  • @AudioCorrupted
    @AudioCorrupted Před rokem +2

    you explained the grid system very well and the diagrams were great.

  • @falcowinkler2429
    @falcowinkler2429 Před rokem

    great video, the problem around smooth edges, the elegant solution and the explanation were so interesting!

  • @datdev
    @datdev Před rokem +1

    really nice devlog, I understand the tiling system, it makes it so much easier to calculate and render!

  • @mspeir
    @mspeir Před rokem

    I absolutely love the minimalist graphics! Well done!

  • @DrOptix
    @DrOptix Před rokem

    I follow your videos for quite some time and each time I am amazed by how you film and edit your videos, about the dedication of working with your won tech stack, but most of all I like you setup the real world part of you office. I like the plants, the view. From here is looks like a place that's inspiring and where you can go and find idea. My own workplace is quite boring. I have come cacti, but they don't seem enough to give that sensation of a mini garden. Your work is awesome! Keep up the good work

  • @Breckdareck
    @Breckdareck Před rokem

    Amazing, just amazing. You have excellent coding and video editing skills. Keep up the great work! Glad I came across your channel!

  • @TyZo
    @TyZo Před rokem +1

    Always a good day when we get a new Homegrown dev log! I hope you have been doing well IRL. Looking forward to the next one. 👍🏼

  • @HiAdrian
    @HiAdrian Před rokem

    Great to see you back with an update. Always brightens my day to see a new episode 🙂

  • @TheLedgendaryMiner
    @TheLedgendaryMiner Před rokem

    A long video, yes! You are so unique with your devlogs, I like how you display some of your life (except this week). Your cooking is great. I love these devlogs.

  • @LoveMakeShareTV
    @LoveMakeShareTV Před rokem

    This was such a great update. The thing I love about your devlogs is that you're not so focused on the minutiae of the engine - you're explaining your thought process and methodology but not getting bogged down in specifics. I don't know if that's a product of you using your own engine, and so it's not as useful to refer to specific processes as if you were using Unity or Godot or something, but it's pretty refreshing. There's a high level of thinking on display here and I feel like I could refer back to how you conceptualize these solutions to apply them to my own projects, irrespective of what engine I'm using. Not sure if that's a conscious choice, but it's a major strength of your videos.

  • @DaneC020
    @DaneC020 Před rokem

    Really nice system you got going! I think you did an excellent job implementing it and the results speak for themselves. Your games style is coming together very nicely!

  • @vaka984
    @vaka984 Před rokem +1

    Keep creating! It's wonderful. Good luck

  • @nicknick-dev
    @nicknick-dev Před rokem

    Great to see that you are building yet another awesome game! Keep it up.

  • @GamesBySaul
    @GamesBySaul Před rokem

    Very nice work on this, found it super interesting and insightful, I also think you explained the dual-grid system very well, I was a bit worried I wouldn't get it, but your diagrams really helped to explain it!
    And your new terrain looks fantastic! Really adds a lot to the aesthetic!
    Dumb idea, but it could be nice to have a thing that if you tap terrain it generates a little sound connected to the terrain type, i.e. clicking the stone path leads to a little stone noise, etc.

  • @Joern290
    @Joern290 Před rokem

    So clever with the new terrain system! 1:26
    And it looks beautiful, too! Well done!

  • @Rexmon
    @Rexmon Před rokem +4

    HOLY CRAP THAT LOOKS AWESOME NOW
    The amount that increases the feel of the game is insane

  • @jamesbaconreid
    @jamesbaconreid Před rokem

    Love the more technical styled video! Great work :)

  • @abdelbarimessaoud242
    @abdelbarimessaoud242 Před rokem

    this looks amazing! good work looking forward for this game

  • @polygnomial
    @polygnomial Před rokem

    It is looking so awesome. I had a smile when you added the dirt terrain type. As a developer myself, I know it is so much fun to add elements even though they might not be priority at the moment.

  • @KuroSamaMG
    @KuroSamaMG Před rokem +1

    This looks way better every update, keep it coming !!

  • @Skeffles
    @Skeffles Před rokem

    The terrain looks great and was super interesting to hear about the dual grid system!

  • @JoyShooter
    @JoyShooter Před rokem

    Your game reminds me of Viva Pinata, that title is really close to my heart and always reminds me of such good memories. I feel like you were able to convey the same warm feeling with your style! Love your channel, keep up the good work!

  • @AndrewDavidJ
    @AndrewDavidJ Před rokem

    Genuinely my favourite gamedev creator - Always looking forward to your videos!

  • @_gamma.
    @_gamma. Před rokem

    Terrain looks awesome!! I might have to check out that tiling method, it sounds nice

  • @helsontaveras7961
    @helsontaveras7961 Před rokem

    Your code looks so clean. Small files, great use of constants, methods are max 10-20 lines each. The product's looks match the code's!

  • @jbaidley
    @jbaidley Před rokem +2

    As you were planning it out at the start, I was thinking to myself "what is the name of that guy who has a better way of doing it" and then you're came right to it :) I think the contrast between the sharp corners of the path and the smooth corners of the grass adds visual interest to the game.

  • @Juampi-lc8qw
    @Juampi-lc8qw Před rokem

    Thx for the vlog! Can`t wait for the next one.

  • @otoS97
    @otoS97 Před rokem

    Amazing work and progress!!

  • @realbrickbread
    @realbrickbread Před rokem +4

    I LOVE your plant-filled workspace, as a plant fanatic myself

  • @nemanjamilojkovic1265

    When I saw your post, I've checked Oscars conf talk but had no clue what it means actually, after seeing your video it's all clear now! :)

  • @OffiGameWave
    @OffiGameWave Před rokem

    damn how much better the game looks now :) good job!

  • @danielridzon
    @danielridzon Před rokem +1

    Great devlog! I learned many useful stuff :]

  • @Whatthetrash
    @Whatthetrash Před rokem

    So cool! Great to see your progress. :)

  • @360McCarthy
    @360McCarthy Před rokem

    Awesome content as always looking forward to the next installment! Keep it up and would love to see an episode on your custom game engine architecture I have tried multiple times to build a java based engine backed by open gl would love to learn more about how you reuse features from past games / support custom game features

  • @mrk_OS
    @mrk_OS Před rokem

    What an elegant solution! One suggestion is that the path tiles should always have bricks on their edges, even when connecting with grass, it might look more connnected that way.

  • @bsdooby
    @bsdooby Před rokem

    How cool is this! Very well implemented 👏

  • @ReflexShow
    @ReflexShow Před rokem +2

    This dude is a genius I love how he planning and executing without any problems, years of experience pays off, keep it up!

    • @sky01james28
      @sky01james28 Před rokem +1

      Oh believe me, he’s making and fixing all sorts of bugs that he doesn’t show 😂 that’s the life of a developer

    • @ReflexShow
      @ReflexShow Před rokem

      @@sky01james28 Yeah totally but as you getting experienced you less and less using google especially when you building stuff like that which you need a good math to handle

  • @GabrielTopolog
    @GabrielTopolog Před rokem

    Excellent update!

  • @darrinpearce9780
    @darrinpearce9780 Před rokem

    Looking fantastic, thanks.

  • @meatbyte
    @meatbyte Před rokem +1

    great seeing you again 😊

  • @quantumintellect7261
    @quantumintellect7261 Před rokem +1

    Indenting the the stones on the dirt paths to instead have dips in the path might look more natural since the paths themselves are indented.

  • @dastaut
    @dastaut Před rokem

    Really interesting video.. Thank you for your insights and explaining everything so well. :)

  • @NeilRoy
    @NeilRoy Před rokem

    Very nice! I love the idea on how to do your tiles, that's a simple, elegant solution. Nice looking game, family friendly too which I like. God bless.

  • @JamesPetts
    @JamesPetts Před rokem

    Interesting! That double grid system is very efficient.
    I shall look forward to the gameplay testing and economic balancing phase.

  • @LifeOfMohammed
    @LifeOfMohammed Před rokem +1

    The progress is always, You should make some day in the life videos even if it isn't to do with programming, Been watching for years and love all ur content man! I still get excited for every upload you do!

  • @jamesderaja
    @jamesderaja Před rokem

    The game looks amazing. I can’t believe you made this all using your own engine

  • @kipcrossing
    @kipcrossing Před rokem

    Love your work!

  • @librasulus
    @librasulus Před rokem

    I really like your office. Your plants really make a difference.

  • @dave815078
    @dave815078 Před rokem +5

    The new terrain gen is looking really good! I think it would be cool if the dirt path borders were made up of wooden logs or beams. Maybe even the short upright stumps that you see as borders in some gardens. Possible would make more sense than bricks made out of dirt?

    • @ThinMatrix
      @ThinMatrix  Před rokem +2

      Thanks :) And yeah, that could be nice! I would like to add support for other possible border types, but I'll have to save that for the next time I work on the terrain.

  • @its_meeeet
    @its_meeeet Před rokem +1

    The art style looks really good ✨

  • @tomkc516
    @tomkc516 Před rokem

    Looks amazing!

  • @dragonminz602
    @dragonminz602 Před rokem

    Looks great. The path brings me to the idea, that there could grow wheeds between the tiles over time. Maybe they can be harvested and contain some rare seeds or stuff

  • @sasquatchbgames
    @sasquatchbgames Před rokem

    Man this has really gotten pretty on the last few updates. Can't wait to play it!

  • @benjattkk
    @benjattkk Před rokem +2

    Love it! Would be cool if the grass tiles generated some small grass on top to make them a bit more interesting, but still, everything looks so cute!

  • @FEG_Studio
    @FEG_Studio Před rokem

    This video is amazing as always. Thanks

  • @chadzulu4328
    @chadzulu4328 Před rokem

    It looks so good!

  • @Smithless
    @Smithless Před rokem

    Awesome vid! Can't wait to play

  • @simoncodrington
    @simoncodrington Před 9 měsíci

    This one was great mate ❤

  • @hopperpl
    @hopperpl Před rokem

    I know this terrain system as the main/sub grid system. it has a lot of advantages for height maps, shadow baking and LOD (level of detail) and for procedural terrain generation when your terrain gets so large that you only render parts of it.

  • @muffiincodes
    @muffiincodes Před rokem

    This wholesome coding content motivates me to make and play more games!

  • @ultralord2889
    @ultralord2889 Před rokem +4

    for the dirt path i think the bricks should be red/ house colored. and the small rocks maybe a bit darker. it would look a lot better.

  • @marco6ocram
    @marco6ocram Před rokem

    I love your work, you are a great inspiration :)

  • @mrvastayan
    @mrvastayan Před rokem

    Fantastic stuff!

  • @cargyllion
    @cargyllion Před 10 měsíci

    Jesus Christ, the dual-grid system was the exact solution I needed for my dungeon generator. You just reduced the amount of object files I needed to cache from 60+ to 4.

  • @schnorpel
    @schnorpel Před rokem

    In my opinion, the mix of sharp and round edges makes the game more diversified. Keep it!

  • @adytm
    @adytm Před rokem

    Cant wait for release!

  • @coolpuppykid1455
    @coolpuppykid1455 Před rokem

    i love this series

  • @horssentc
    @horssentc Před rokem

    I feel like the stones on the dirt path should be gray! Amazing video btw, thanks for sharing your process with us

  • @mad_murlocmedia2569
    @mad_murlocmedia2569 Před rokem +1

    Loving the content man, really incredible to see how far you've come with this project, as well as your video creation skills.
    If I might give a bit of feedback - At 8:15 you show the new geometry for the rounded top edge of the grass. Would this allow for the opportunity to "blend" between the tiles in the vertical space? By that I mean, you have the grass texture on the top and round of the edge, but soil on the side of the edge?
    I feel like this would go a long way to smoothing the transitions between tile types, along with the curves.
    Whatever you do, keep it up. Looking forward to seeing what's next

  • @samuilxd
    @samuilxd Před rokem +3

    Nice video again

  • @afewdragons
    @afewdragons Před rokem

    That terrain double grid stuff is a great idea.

  • @SpikeStudio
    @SpikeStudio Před rokem

    Wow, just those rounded grass borders made a huge improvement!

  • @ThatGamePerson
    @ThatGamePerson Před rokem

    I know you probably know this, but you are a real inspiration to the solo indies everywhere. Good job as always.

  • @akaigetsu
    @akaigetsu Před rokem

    the nice thing about the brick borders is that they don't have to be brick, giving it a wood texture would work just as fine as a wood/log border, it would also be more logical than the current sandstone border

  • @vast634
    @vast634 Před rokem

    The weighted normal trick also works wonders on all kinds of low poly assets. Adding a bevel in blender, shading smooth, and either using the weighted normal modifier or in Object Data Properties / Normals / Autosmooth.

  • @jameskotze101
    @jameskotze101 Před rokem

    Man, if I could like twice I would! Love your videos :)

  • @konijnebeer
    @konijnebeer Před rokem +3

    i realy like the polymer clay like look as someone who uses it often, hope there will be a option to add a finger print shader in the final game :D

  • @DecDuck
    @DecDuck Před rokem

    I think the path pimples are simply a wonderful idea!