So, I had my fancy schmancy terrain. I could render the ground. Yay. Accomplishment of the century. So, the next task would be to put something on the ground. Ambitiousness!
I figured the best thing to start with would be a vegetation system. I’d need a cheap, plentiful food source for when I started putting creatures on the map, and plants were the obvious choise. In addition, they add detail and make the entire map more interesting than just a ground-plane. To render them, I decided to use billboards.
Billboards, in a computer-graphics sense, are one-dimensional shapes that always face the camera so you don’t [i]see[/i] that they’re only one-dimensional. They’re like other-dimensional monsters that always know where you are. They’re used all the time in games, but normally only to represent complex objects that are often some distance away from the camera (like trees), or are too numerous to represent more accurately (like grass). As of the time of writing this, Species is still using billboards for it’s vegetation. This may have to change, but at the moment it’s one of the lower-priority items on the development list: the sprites, tacky as they are, are functional.
It would have probably been best to configure the vegetation to render in tandem with the QuadTerrain system, but knowing I would have to continually update the vegetation based on how much energy any particular vegetation object had, and allow all the creatures on the map to interact with it, I realised that a QuadTree would be less than ideal. The QuadTree system relies on larger nodes being less detailed than smaller ones: for the creature interactions, if not the rendering itself, I would need the same amount of detail everywhere on the map. So I divided the terrain into a simple grid, with each grid-square being given a small number of tree objects to manipulate and render. Creatures more than 2 squares away from a vegetation square don’t process the trees in it at all, saving CPU.
One advantage of a grid is that it correlates exactly with real-world space. Rather than checking the grid square by square, or sinking down through parent nodes in a quad tree, I can simply divide the creatures position co-ordinates by a given value and plug the result into the array to tell me instantly which square they’re in.
Am I being too technical? I’m being too technical, aren’t I? Oh god, what if I’m swamping you with boring technical information? Here, have a picture instead!
Now, they’re not perfect. They blend in with the terrain, which I don’t actually want in this case since it should be easy for the player to spot and identify food-sources. And they’re unbelivably tacky-looking because I threw them together in Adobe Flash using a laptop touch-pad. And, of course, they’re billboards. They look okay from a distance, but get too close and the illusion stops being at all convincing.
But then again, hindsight is always 20-20, and even though there’s a lot of things I would/will/might change, the vegetation billboard grid works for now. And maybe that’s good enough. For now anyway.
Want to hear something worrying? I don’t think he was actually being sarcastic in that first sentence.