Monday, June 27, 2011

46 – Crazy oak overload

I did not get to do any work during this extremely lazy weekend. And I am cut off from the single computer I have FRAPS on so I can't bring you the stone stockpiles video today. But I hope I can make it up with today's topic.

ATTENTION!

THIS IS VERY IMPORTANT!

READ BEFORE YOU CONTINUE. YOUR HEALTH MAY BE DEPENDENT ON THIS!

The following post contains a lot of oak. If you had any previous negative experiences ranging from mild nausea to seizures when confronted with bright flashing oaks or just oaks in general, please stop reading.

YOU HAVE BEEN WARNED.

I have rather complex trees. Even without their produce, they still have leaves that can fall of or change color. In the current system a tree has 28 unique tiles. But these tiles are fixed, and for a single "leaf fullness level" I have only four distinct tiles for the transition from fully green leaves to fully brown (or other colors). This means that at 3 distinct dates, the tile for the tree will be changed.

But what if I wanted more? Making these tree tiles can be fairly tiresome. Or expensive. Or both, depending on the volume of tile you need. So let us try procedurally generating the transition. We start with the green tree and end with the brown tree and the rest is randomly filled in. I have an algorithm which has a few parameters that can tweak the outcome. Here are two random transition with basic settings:



The two images may seem identical, but there are small differences in detail. Of course, since the algorithm is random, there is no guarantee concerning the number of tiles you get:



The problem is that the transition is too rough, with bright pixels just popping up randomly. Let's use some blending to increase the smoothness:



MOA SMOOTHNESS!!!


Even more smoothness:


For the final two pictures I am increasing the smoothness to maximum. Even thought it seem to finish once it reaches 255 tiles, this is intentional. With these parameters, the algorithm can produce hundreds of thousand of unique tiles before it finishes:



I like the last two, but there are some problems still visible. The biggest one is that the yellow tint starts to dominate the image too soon. Unfortunately, I can't take a "I want the transition to feel like this" thought and figure out the right parameters. A lot of trial and error is needed, maybe even a smarter algorithm.

So what do you think? How much is too much? Are the four unique transition tiles enough? Maybe use the algorithm to smoothen the transition to a reasonable frame number, like 16 ore 32? Or use the whole range from the final two images? Or make it so that each new game has a new set of randomly generated transition tiles? Maybe even with random colors?

Ahhh, procedurally generated content. So many possibilities! Maybe I should create a video with the transition animated to better show case it when I get back to my FRAPS.

4 comments:

  1. to be honest i don't see the huge added value in having a smoother transition. i suppose it's nice to have 16 or even 32, rather than just 4. but anything more than that seems a bit of an over-kill.
    just my perspective...

    ReplyDelete
  2. Won't this generate a HUGE amount of tiles if you're doing this for every tree, plant or whatever? Isn't there some way you can store a "colorless" tree/plant as a tile and use some graphics voodoo to change it into whatever color/season you want at runtime?

    ReplyDelete
  3. Oh... Forgot to say that i agree with simo, but how many tiles would you end up with all in all if you wanted the transitions to be really smooth? An animated comparison would also be nice :)

    ReplyDelete