Programming Terrain Generation for my Farming Game

Поділитися
Вставка
  • Опубліковано 20 січ 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
  • Ігри

КОМЕНТАРІ • 378

  • @ocleidyreve6361
    @ocleidyreve6361 Рік тому +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 Рік тому +8

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

    • @ThinMatrix
      @ThinMatrix  Рік тому +133

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

    • @klaxoncow
      @klaxoncow Рік тому +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 Рік тому +29

      @@klaxoncow Thanks ChatGPT, really appreciated

    • @bartpelle3460
      @bartpelle3460 Рік тому +4

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

  • @DevelopAnEngine
    @DevelopAnEngine Рік тому +169

    The little boost I needed to open Visual and code

  • @1Chitus
    @1Chitus Рік тому +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!

  • @bobbelcher6742
    @bobbelcher6742 Рік тому +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  Рік тому +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 Рік тому +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  Рік тому +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 Рік тому +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 Рік тому +3

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

  • @bestformspielt
    @bestformspielt Рік тому +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.

  • @fbob987
    @fbob987 Рік тому +27

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

  • @Tom-Kowalczuk
    @Tom-Kowalczuk Рік тому +10

    Yay !
    Really liking the progress so far

  • @abdelbarimessaoud242
    @abdelbarimessaoud242 Рік тому

    this looks amazing! good work looking forward for this game

  • @nicknick-dev
    @nicknick-dev Рік тому

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

  • @indiedevdylan
    @indiedevdylan Рік тому +1

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

  • @hackticdev
    @hackticdev Рік тому +1

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

  • @mkrichey1
    @mkrichey1 Рік тому

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

  • @otoS97
    @otoS97 Рік тому

    Amazing work and progress!!

  • @JellyLancelot
    @JellyLancelot Рік тому

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

  • @jamesbaconreid
    @jamesbaconreid Рік тому

    Love the more technical styled video! Great work :)

  • @Juampi-lc8qw
    @Juampi-lc8qw Рік тому

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

  • @wcrb15
    @wcrb15 Рік тому +3

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

  • @HiAdrian
    @HiAdrian Рік тому

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

  • @LucasStraub
    @LucasStraub Рік тому

    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!

  • @tagis
    @tagis Рік тому +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  Рік тому +12

      Thank you so much ^^

    • @Bozebo
      @Bozebo Рік тому +2

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

  • @melihmete807
    @melihmete807 Рік тому +11

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

  • @dandymcgee
    @dandymcgee Рік тому +3

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

  • @danielridzon
    @danielridzon Рік тому +1

    Great devlog! I learned many useful stuff :]

  • @baksoBoy
    @baksoBoy Рік тому

    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!

  • @julianav.4031
    @julianav.4031 Рік тому +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.

  • @vaka984
    @vaka984 Рік тому +1

    Keep creating! It's wonderful. Good luck

  • @sicknickeroni
    @sicknickeroni Рік тому

    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.

  • @KuroSamaMG
    @KuroSamaMG Рік тому +1

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

  • @Breckdareck
    @Breckdareck Рік тому

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

  • @bsdooby
    @bsdooby Рік тому

    How cool is this! Very well implemented 👏

  • @mspeir
    @mspeir Рік тому

    I absolutely love the minimalist graphics! Well done!

  • @Whatthetrash
    @Whatthetrash Рік тому

    So cool! Great to see your progress. :)

  • @TyZo
    @TyZo Рік тому +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. 👍🏼

  • @AudioCorrupted
    @AudioCorrupted Рік тому +2

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

  • @skiesquiggles7319
    @skiesquiggles7319 Рік тому

    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 :)

  • @AndrewDavidJ
    @AndrewDavidJ Рік тому

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

  • @Vimlark
    @Vimlark Рік тому

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

  • @Joern290
    @Joern290 Рік тому

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

  • @TheLedgendaryMiner
    @TheLedgendaryMiner Рік тому

    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.

  • @darrinpearce9780
    @darrinpearce9780 Рік тому

    Looking fantastic, thanks.

  • @GabrielTopolog
    @GabrielTopolog Рік тому

    Excellent update!

  • @OffiGameWave
    @OffiGameWave Рік тому

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

  • @bejoscha
    @bejoscha Рік тому

    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.

  • @datdev
    @datdev Рік тому +1

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

  • @Rexmon
    @Rexmon Рік тому +4

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

  • @Skeffles
    @Skeffles Рік тому

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

  • @falcowinkler2429
    @falcowinkler2429 Рік тому

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

  • @dastaut
    @dastaut Рік тому

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

  • @tomkc516
    @tomkc516 Рік тому

    Looks amazing!

  • @Smithless
    @Smithless Рік тому

    Awesome vid! Can't wait to play

  • @_gamma.
    @_gamma. Рік тому

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

  • @FEG_Studio
    @FEG_Studio Рік тому

    This video is amazing as always. Thanks

  • @chadzulu4328
    @chadzulu4328 Рік тому

    It looks so good!

  • @simoncodrington
    @simoncodrington 9 місяців тому

    This one was great mate ❤

  • @JoyShooter
    @JoyShooter Рік тому

    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!

  • @meatbyte
    @meatbyte Рік тому +1

    great seeing you again 😊

  • @sasquatchbgames
    @sasquatchbgames Рік тому

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

  • @360McCarthy
    @360McCarthy Рік тому

    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

  • @DrOptix
    @DrOptix Рік тому

    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

  • @kipcrossing
    @kipcrossing Рік тому

    Love your work!

  • @marco6ocram
    @marco6ocram Рік тому

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

  • @polygnomial
    @polygnomial Рік тому

    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.

  • @DaneC020
    @DaneC020 Рік тому

    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!

  • @GamesBySaul
    @GamesBySaul Рік тому

    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.

  • @LoveMakeShareTV
    @LoveMakeShareTV Рік тому

    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.

  • @its_meeeet
    @its_meeeet Рік тому +1

    The art style looks really good ✨

  • @mrvastayan
    @mrvastayan Рік тому

    Fantastic stuff!

  • @nemanjamilojkovic1265
    @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! :)

  • @LifeOfMohammed
    @LifeOfMohammed Рік тому +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!

  • @helsontaveras7961
    @helsontaveras7961 Рік тому

    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!

  • @jamesderaja
    @jamesderaja Рік тому

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

  • @librasulus
    @librasulus Рік тому

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

  • @coolpuppykid1455
    @coolpuppykid1455 Рік тому

    i love this series

  • @JamesPetts
    @JamesPetts Рік тому

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

  • @NeilRoy
    @NeilRoy Рік тому

    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.

  • @realbrickbread
    @realbrickbread Рік тому +4

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

  • @schnorpel
    @schnorpel Рік тому

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

  • @muffiincodes
    @muffiincodes Рік тому

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

  • @jameskotze101
    @jameskotze101 Рік тому

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

  • @jbaidley
    @jbaidley Рік тому +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.

  • @adytm
    @adytm Рік тому

    Cant wait for release!

  • @anchs2501
    @anchs2501 Рік тому

    LETS GOO NEW THINMATRIX VIDEO!

  • @samuilxd
    @samuilxd Рік тому +3

    Nice video again

  • @benjattkk
    @benjattkk Рік тому +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!

  • @Netzoalsik
    @Netzoalsik Рік тому

    It's Looking good!

  • @cargyllion
    @cargyllion 10 місяців тому

    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.

  • @roktoka
    @roktoka Рік тому

    great video!

  • @ReflexShow
    @ReflexShow Рік тому +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 Рік тому +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 Рік тому

      @@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

  • @mrk_OS
    @mrk_OS Рік тому

    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.

  • @ThatGamePerson
    @ThatGamePerson Рік тому

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

  • @DecDuck
    @DecDuck Рік тому

    I think the path pimples are simply a wonderful idea!

  • @afewdragons
    @afewdragons Рік тому

    That terrain double grid stuff is a great idea.

  • @dragonminz602
    @dragonminz602 Рік тому

    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

  • @mad_murlocmedia2569
    @mad_murlocmedia2569 Рік тому +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

  • @horssentc
    @horssentc Рік тому

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

  • @Desarth00
    @Desarth00 Рік тому

    Nice. Thinking about pathways made me realize that there surely is going to be a playable character in the game. Can't wait for that :)

  • @Ell900
    @Ell900 Рік тому

    Very good work

  • @SpikeStudio
    @SpikeStudio Рік тому

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

  • @dennismakesgames
    @dennismakesgames Рік тому

    YES A new devlog :)

  • @dave815078
    @dave815078 Рік тому +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  Рік тому +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.