Serious vegetation

Top  Previous  Next

According to the emails and the messages that I have got, many of you use my "Serious Grass" code from Aum50 in their games; therefore, after examining several grass related projects, I have decided to rewrite my code with these 3 goals in mind:

 

1) The vegetation must use a color map placement bitmap (needed for "real" levels);

2) The number of grass models must be big;

3) The frame rate must be kept big even on regular computers.

 

If you have ever played with any engine and a bunch of entities you know for sure that 2) and 3) don't mix up well together; however, you will notice that my code keeps the frame rate to a steady 40 - 60 fps on a regular (not fast!) computer at all times, even if the number of grass models exceeds 400 pieces!

 

How did I manage to do that? I have used a few simple tricks, the most important of them being faked multitasking, spreading the cpu load over 10 consecutive frames. This method has doubled the frame rate, allowing me to use more models. The good news is that even if you've got an ancient computer, you can increase the frame rate by setting a smaller number of bushes in Wed; play with skill1 and skill2 in action my_terrain and then press F11 while running the demo to see the total number of entities (most of them being the grass models).

 

aum58_vegetation1

 

You will be happy to hear that the vegetation code places two different, waving grass models, as well as randomly oriented and scaled trees on the terrain. Don't forget to examine the heavily commented script if you want to edit it or to learn from it. Special thanks go to Loopix for the vegetation models and to Nifty for the idea.