Flocker - a game prototype featuring flocking

Flocker is a game we’re currently prototyping. The idea so far is to fly a flock of birds through procedurally generated gates that close up little by little.

We will implement new things as we go along and get ideas how the game could/should be.

Video: http://www.youtube.com/watch?v=6adctJdEDaY

Very nice! I also really like the sky and volumetric clouds. :slight_smile:

indeed really nice. i’d love to get more information on the clouds too :slight_smile:

I made the clouds last nite while overdozing with coffee. It’s still a work in progress, but this it how it works so far:

The sky at the background is 6 images rendered with Terragen2 and textured in large box. Textures are 512x512 each facing up,down,left,right,front,back. Your typical skybox.

The volumetric clouds are made from 4 different 2d-textures. I handmade them in Photoshop (24-bit PNG with transparency). One of the textures is very round and smooth and some are more and more shattered/sharp to create some nice details. The smoother one is 32x32 and the one with details is 256x256. All the textures have slightly yellow/darker bottom and brighter top which creates the illusion of directional light you see there. In the middle of the texture there is near 1.0 alpha and it gets toward 0.0 at the edges. Here is number #3:

To create the actual clouds, these textures are distributed into the scene as camera-facing billboards with setBillboardPointWorld(). Single billboard is called CloudParticle, which inherits from NodePath. A single Cloud is also a NodePath which embodies n CloudParticles. First I tried to create random positions around the Cloud.position, but it looked a bit awkward. Then I decided to create few random key points (10 or so) around the Cloud.position and then create particles around these points. This way the cloud remained random, but it still has some cloudlike structure. I also made the particles near the center much bigger than the outliers.

When the gate in the world is generated, I create couple of Cloud objects around it. I keep track of the clouds lifetime and remove it from the scene (when it’s not in the camera view) so that we don’t get the scene boggled with huge amount of particles and the creation of new clouds around gates makes sense, because that is where the player is heading and illusion of “world full of clouds” is generated (somewhat). When a new Cloud is generated, I set it’s alpha to 0.0, and it raises up when the distance in relation to camera gets smaller. This way you don’t ever see new clouds popping up suddenly into the screen. I have disabled the depthBuffer when drawing the particles with setDepthWrite(False) to get the transparency working correctly.

awesome!

very cool !

Hey Keely,

I wonder how you distribute and select your 2d-textures into particle. Are there certain rules or function to determine which texture suitable for a particle. I try to implement your technique since it looks so expensive but surprisingly create realistic clouds.

Thanks

    keypoints = []
    for x in xrange(25):
      keypoints.append(Vec3(
        random.uniform(-scale*0.5, scale*0.5),
        random.uniform(-scale*0.5, scale*0.5),
        random.uniform(0.0, 0.0)
        )
      )
        
    for x in xrange(int(scale*0.1)):
      pos2 = random.choice(keypoints) + Vec3(
        random.uniform(-scale*0.1, scale*0.1),
        random.uniform(-scale*0.1, scale*0.1),
        random.uniform(-scale*0.1, scale*0.1))
      dis = pos2.length()
          
      particle = CloudParticle(
        pos2,
        max(scale * 1.0 - dis, scale*0.3),
        random.choice(textures),
        particleGeom
        )

This is the key part of the code that generates one cloud. Scale is the scale of the whole cloud. As you can see I just randomly select the texture. Something I also forgot to mention, is that all the keypoints seem to have the same Z value = 0.0.

It seems that I recalled the amount of keypoints incorrectly (which seems to be 25, not 10ish) and also the sizes of the textures seem to be 64x64, 256x256, 256x256 and 512x512.

I think the key thing for making billboarding look good in this case was finding the magic numbers and getting the textures right by trial and error + lot of luck.

These are the textures used. I hereby give out my copyrights for them and everyone can use them however they see fit:

http://www.kiili.org/flocker/cloud1.png
http://www.kiili.org/flocker/cloud2.png
http://www.kiili.org/flocker/cloud3.png
http://www.kiili.org/flocker/cloud4.png

It is really nice and I like the almost real effect of the clouds. I like the color combination of the the ring and the flying birds. I think you should also add a little character to the birds, like face or something. Rapid Prototyping