What’s up viewers today’s devlog is all about how plants work in my upcoming game called life code if you’re a fan of grass like me you’ll definitely dig this episode i may have spent a little too much time on rendering grass these couple of weeks i am pleased with this the results and The world looks a bit something like this i do have grass growing i have some mushrooms and trees and if i can find them i also have some berry bushes hidden somewhere here the idea is that the plants they all grow and die based on the soil and the Weather conditions and in the future they will be affected by what the creatures do for example if a species of creatures eat all the mushrooms in this area the mushrooms will have a hard time growing back i want the game to feel alive like it’s always growing and Changing i also want it to have the potential for some really cool interdependencies to arise you know the stuff you only hear about in nature documentaries how one set of predators in some complex food chain way is essential for the survival of a rare mountain flower or even an entire forest But in order for this to be possible in my game i need to have some pretty solid plant grow mechanics stick around if you want to hear my plan For those new to the channel a quick recap the game is about creating animal species in a sandbox-like world while you try to maintain a working and balanced ecosystem by programming the animals living within i call the game life code do check out my previous devlog video if You want a more detailed explanation let’s get back talking about plants the world conditions are all randomly initialized this causes the plants to grow in places they favor and is what you see on the screen right now clicking anywhere on the ground will open up my first attempt at creating a ui If you have any ideas for a good ui design do share them in the comment section anyway here in this info box i can choose to see different world or plans conditions i can for example see values for specific locations by clicking around on the map Or i can see it as heat maps by clicking on this button here the world conditions are easy to understand here we have temperature humidity energy rate energy rate is the energy that gets replenished together the world conditions form what you could call biomes and different plants likes to grow in different biomes So if we check the grass tab here we can see that there’s a button here or a value here that’s called favorability clicking here you can see that grass likes to grow where it’s red and we can also see the mushrooms here we can see that the mushrooms likes To grow here the reason why nothing grows in this area even though the favorability of both grass and mushrooms quite high here is because the energy rate is very low the growth and the favorability might not always coincide the mushrooms could have been pushed aside in favor of a More aggressive plant or it might just have gotten extinct in some areas the plant pressure shows how strong the growing power is this is compared to other plants in the same area in order to decide how much of the available energy that each plant is promised the plant pressure is calculated based On the surrounding growth and adjusted with the plant’s favorability looking at this spot over here we can see mushrooms have pushed back the grass growth even though the grass favorability is very high here and here we see them growing side by side it’s not always intuitive why certain Plants grow better than others but it has to do with the combination of plant favorability plant pressure and the plant profile which all together give rise to a fascinating and adapting world my plan is to add many more types of plants and i will start with a nordic inspired flora But the idea is to have many kinds of habitats and environments each with its own challenges but man do i suck at making art i should just buy this stuff as assets and be done with it but there’s something cozy about having my own models growing in my own world i create Plus i want to have the freedom to be able to create whatever i like and have the same theme colors and styles for all moles in the game this video is a couple of weeks overdue and the reason for that is i had to figure out how to render so many objects And plants at the same time without my computer chipping for air let’s start talking about my new favorite hobby rendering brass grass in games is normally rendered using one of three techniques the easiest one is using a simple 2d texture of grass on the ground this is Generally seen in older games the second approach is something called billboarding this is probably the most common way and is a great compromise for detail and performance at first this is how i chose to do it but later decided that it would not fit my game as well as the last option in This list the idea is that you combine a few images of grass often in this cross pattern you see here however looking at the billboards from above makes it look quite awful and you can clearly see all the cross patterns this technique is very suitable for when you See the world at a low angle the third way of doing it is rendering each grass straw individually i felt this would be more in line with the art i want and i will be able to have a mix of flowers and other grass-like plants depending on the growing conditions in My first attempt in doing this i was only able to render about 000 blades of grass at 60 fps i used higher level apis of the game engine i used called bevy in order to get better performance though i had to stick down to lower level apis and after Some much appreciated help from the bevi community i managed to render about five hundred thousand plates of grass people might think that that’s good enough but i’ll tell you those are rookie numbers after spending more time that i should have done i managed to render 12 million blades of grass at 60 fps Do you know why grass is so dangerous because it takes up all your time no because it’s full of blades just to be sure people don’t think i’m an idiot i have no intention of actually rendering 12 million blades of grass in my game but i want you guys to just think about What’s really happening here and the throughput we’re getting from using the gpu each of the 12 million blades of grass is made up from three triangles and each triangle is made up from three vertices or corners i’ve written a small shader program which runs on the gpu that Calculates the world position for a given vertex this means that that function on the gpu runs in total 6 billion times a second just so we can see the grass grow and moving in the pin implementing this took no time at all it was a breeze did you see i just wrote The code and it worked right off the bat to say no problems zero bucks not even a single hiccup no no no no Easy peasy i’ve published all the rendering code on github link in the description below hopefully this can help some people using bevy and who also wants to render tons of objects moving on from here i’ll be working on the creature code playing the foundations for how creatures behave how they Interact with the environment and each other i hope you subscribe to the channel and i’ll see you later alligator Video Information
This video, titled ‘Biome generation Indie Devlog 2 – Living forest’, was uploaded by Life Code on 2022-09-05 18:49:51. It has garnered 3886 views and 189 likes. The duration of the video is 00:08:47 or 527 seconds.
Second devlog for the game I’m making called “Life Code”.
Link to Bevy rendering code: https://github.com/pinkponk/bevy_efficient_forest_rendering
Check out my previous video for more information about what the game is about.
Subscribe to my channel if you want to follow along my journey in creating this seemingly impossible game.
— #midlifecrisis #indiegame #rust #bevy #devlog #ecosystem #nature #biome #rendering #gpuinstancing #stylishedgrass —