Hello.
Welcome to episode 6 of this game devlog.
My last exam for this semester was today - which means that I will be able to work more on
the game from now on, but also that I spent the majority of the week
studying for that exam.
Because of that, I figured that a change of scenery would be a good idea.
So today I won't be working on building construction.
Instead, I will add some new elements to the environment of the game.
First up - forests.
Until now, the trees were evenly spread across the map.
I now clump them together into dense clusters.
Sadly, some of the cool features are barely visible in this footage.
For example, the trees get slightly less dense near the edges.
In order to take these shots, I also added a mechanism to increase the view distance.
I can also use this to show you how the world looks from even higher-up.
In normal gameplay, you won't see this far, but the whole world is still simulated at
all times.
I sped this footage up significantly because the framerate was horribly low otherwise.
I want the floor in the forests to have a different color
compared to the surrounding meadows.
To do that, I started by allowing each cell of the ground to have a unique color.
This also makes the irregular pattern of the ground more obvious.
It was one of the first things I implemented during development of this game, over six
months ago.
At first, I wanted to simply go with a grid, but that looked too regular, so I now use
this pattern based on the delaunay triangulation.
At some point, I need to work on that again to make the cells slightly less spikey.
At the moment, the amount of grass growing in each cell is determined randomly, so next,
I need to detect whether a cell is in the forest.
I want to base that color on a simple lighing model that calculates the amount of sunlight
each cell receives.
At the moment, I only calculate the shadow for one direction, which is why there is a
brown strip on one side of the forest.
It's a bit difficult to see because the cells are quite large and irregular.
These virtual shadows are completely independent of the ones that are rendered for all objects
and are much faster to compute.
The last step is to calculate these directional shadows for many different directions and
then average the result.
This results in what you can see on screen now.
At the moment, the virtual sun moves 360 degrees around the trees, but in the future, I might
change that so that the sun is never in the north.
Lastly, I added some color variation to the grass
so that the individual cells are slightly visible.
I like the look, but perhaps I will turn down the intensity a bit in the future.
My next goal is to add some smaller vegetation on the floor.
I started by writing the generator for a single leaf.
Each leaf has a recess running the length of it.
Next, I made the leaf get thinner near the top.
I then arranged the leaves in a circle and stacked multiple of these circles on top of
each other, resulting in a simple plant.
Next, I did some tuning to the parameters to make the plant look more realistic.
The inner leaves now curve less to the outside than the leaves at the edge.
Finally, I randomized the parameters of the generator and randomly distributed the plants
in the world.
My last project are conifers.
I started with the existing tree and moved all the deciduous-tree specific parts of the
code into a new class.
Next, I added the basic code for the conifers and a very simple model.
At this point, lumberjacks would be able to fell the trees, they are removed to make space
for buildings and the player and NPCs collide with them.
I only need to work on the mesh generator because that obviously looks very simple at
the moment.
I started by splitting the cone into multiple rings.
I then made these rings star-shaped and spent a long time fine-tuning the slope of the cone
and the individual leaves.
This step took by far the longest, even though it might seem like little has changed.
The tree will now be able to adapt to different sizes and shapes much better.
Finally, I rotated every second ring slightly so that the stars overlap nicely.
So that's it for this week.
I hope you enjoyed this episode.
Thank you for watching and I'll see you next time!
Không có nhận xét nào:
Đăng nhận xét