Wednesday, July 6, 2011

48 – Grass pokies

I am having guests right now, so do not expect July to be such a fruitful month as June was. And June was a great month! I had both the highest number of posts per month and the highest number of views. Maybe the two are correlated? Hmmm?

Anyway, I am not able to spend a lot of time on coding and testing, so I think I’ll cap it at 1-2 posts per week.

Procedurally generated grass levels

I am using my procedurally generated grass transitions in game now. For now, I’ll leave the levels of grass random, even if it not that realistic since an untouched landscape would have an abundance of grass:

It looks pretty good. I do not like the contrast, neither in the above image nor in others:

The algorithm is not that smart and cell edges are a little bit pronounced. This would not happen if the transition would be handmade or the algorithm could compensate for this:

But still, the entire transition is procedurally generated and cached, giving acceptable results:

This is a pretty big thing! I am caching the results of the generation and moved the actual generation process to a manual step in the editor so that I do not have to wait for the generation each time I start the game. But I could easily make it so that every time you start the game or even load a map, you get slightly different transitions. Think about it. Loading the same map over and over and getting slightly different visuals. Not very useful, but definitely a cute idea.

Real time grass growing

The grass now grows in real time. The way coverage percentage works should be explained. 0% means that there is not a single grass leaf on that portion of floor, and 100% means that the entire volume that could be occupied by that particular grass type is actually occupied, taking into account maximum leaf length and density. So it is not a straight leaf number or anything. 1% could mean that you have 10 very short leaves in the area, while 3% could mean that you still have 10 leaves, but the leafs are longer and 5% could mean that the previous 10 leaves are the same length, but 3 more medium leaves have grown since there. This is just a random example. But using this meaning, it makes sense that grass can increase 1% per day. This is the actual rate of grass increase. Grass grows all year long, but I’m thinking of slowing it down for autumn and even adding a slight decline when things get cold.

I won’t post a screenshot with grass growing. I’ll post a video at the end of this post that will also demo the next feature.

Grass cutting

A new floor related action has been added. Using this action, you can remove all grass from the selected area, lowering the grass percentage to zero. But the grass will continue to grow there. This is why in the feature list for 0.1 I labeled this action as cosmetic.

And speaking of feature list, I’ll have to update it soon. And I am getting very close to my 50th post (I have more than 50, but I am only counting the main ones) and I don’t have anything special planned for it. Maybe I can figure out something.

One thing that you will notice in the screenshots and the video is the lack of ramps. Ramps are very problematic. They have a ton of angles and combined with all the states generate thousands of tiles. Figuring out when and where to use each ramp is easy, but time consuming and tedious. Each time I touch ramps, floors, item system or any material that can be used in ramps I break the ramp system. These things are a pain in the butt. So I decided to temporarily remove them. Once the underlying systems have proven to be stable, I’ll reeneable ramps. Until then, good riddance. I hate to make my world more Minecrafty, but for a while there is no way around it:

In the video I am showing grass cutting, followed by grass growing for every soil type:


  1. woohooo! grass! (waiting for that video!)

    does grass have any additional feature? like feeding animals...
    why would anyone want to cut grass?- is it that you can't build on a square that has grass? or is it easier to walk through?
    and what about cutting the grass down to... lets say 1%? it's very difficult in reality to completely remove grass, and then still expect it to grow back.
    just my 2 cents for this morning.

    still, good progress!

  2. hey that game looks nice im gonna be waiting for a test or something

  3. The video is finally up!

    I sincerely apologize for the delay, but as said, I have guests and I can hardly sneak off to do video editing.

    The only reason I could do it now is that it is Sunday morning and I am the first one up.