Creating Realistic Environments for the Blender Game Engine

Modeling: Scenery Extras

Now we'll look at how to improve your game modeling. Let's take a look at the wire mesh of our ugly little island:

What appears to be a simple scene is not very simple from the engine's point-of-view! The island is made from a complex UV sphere, the monkey head has been “subsurfed,” and the trees and building columns are both made from cylinders at the default setting, 32. It's important to remember here that though Blender can be used to make games, its primary purpose is creating rendered imagery. This is why there are many Blender features which are incompatible with the game engine, and many more which though compatible should not be used.

Subsurf is an example of the latter. Though subsurf is now compatible with the GE, it should not be used on game models. The intention of game modeling is to create “low-poly” models which are as simple as possible. Subsurf works by turning every face of your model into many smaller faces, and is therefore an extremely counterproductive method when it comes to the game engine. When working in the game engine, your intention should be to keep your models as simple as possible: avoid using anything which makes your models more complicated.

Let's get started on our game models by improving the “temple.”

We'll fix the columns first. The columns, as you can see in this image, appear to be almost a solid color. When your game models look like this, it's a fair bet you've used too many polys. 32, the default setting for cylinders, is overkill for the game engine. 10 vertices should be enough, you can probably get away with only 7, and you should never need more than 15 or 20. We'll create a new column model and set it to 10 instead of 32.

As you can see, a column with 10 vertices still looks very round. It's not important to make everything in your game have a “perfect” shape. People expect game objects to have slightly jagged shapes, and the mind can easily fill out the model to its correct shape. The trick is to find the happy medium between too many vertices and not enough. 10 is just about right for this column. For a bigger column, 20 might be more appropriate. For very small objects, you may want to reduce the number to four or even three. Avoid 6- or 8-sided cylinders, though: the mind is familiar with these shapes and your player may have a hard time ignoring them.

Low-poly modeling also means removing anything that is not needed, which includes faces that can't be seen. This column has faces on either end which cannot be seen. Click the “face selection” button, select the hidden faces at both ends with the B-key select mode, press the Delete key, and click Faces.

 

Remember to check for these faces! They're very common, and they do tend to add up. Unimportant as they may seem, having large numbers of them can lead to a game slowdown. Consider: each column has 10 faces on each end, none of which are visible to the player. With all four of the building's columns, there are 80 extra faces! Always remember to check for and eliminate game engine waste.

Now let's take a look at the temple steps:

Sometimes we need to divide faces into smaller faces in order to create something. One way to create more faces is to use the Subdivide tool, but this tool divides every face into lots of smaller faces, creating a lot of unnecessary extra faces and adding to game engine waste. A much better option is to use the Knife tool.

The Knife tool's purpose is to add extra vertices to an edge. This will allow you to divide up your model's faces only as much as they need to be divided, and prevent game engine waste. To use the Knife tool, select the edges you wish to operate on (you may wish to use B select mode) and press Shift+K. The Knife menu will appear. Select Exact Line for now, and then draw a line through your edges and press Enter.

Our face is now cut in half, and ready to be extruded into steps! If we had used Subdivide, the face would have been divided into four sections, far more than we actually need. Now we can extrude the face and finish creating our staircase. The result will be a base for the temple with fewer than half the faces of the original. Don't forget to delete the underside of the temple's base: it will be underground, so there is no reason to save it.

The temple is pretty good now! Let's leave it alone and take a look at those obnoxious palm trees.

This is not a palm tree. This is a cartoon of a palm tree, and a very high-poly one at that. The trunk, like the columns on the building, is a 32-vertex cylinder. It is absurdly straight: the natural world simply does not have such straight lines. Our first order of business will be to improve this trunk. Add a 7-vertex tube and resize it until it's long, straight, and narrow. Scaling it small then enlarging it on the Z axis should work. (Make a habit of using tubes in place of cylinders when neither end will be visible. In this case, one end of the trunk will be below ground, and the other will be above players' heads. Neither will be seen, so you can use a tube in place of a cylinder and save yourself some polys.) Once your tube is ready, use the Knife tool to slice it up a few times, then give it a subtle bend. Scale it down a bit toward the upper end.

>>

This trunk is not only more realistic, it has fewer polys as well!

To create the leaves, add a plane and extrude once from each end.

Then select your ends one at a time, press W, and select Merge.

The result will be a plane with a triangular face attached at each end. Now use the Knife tool to divide the plane vertically down the middle.

Select the new vertices and move them up so that the leaf will curve in the middle:

This is our basic leaf model. You can tweak it a little if you like. It may not look very much like a palm leaf yet, but the texture will improve that. It should be noted that since leaves are close to being flat, it is perfectly acceptable, and recommended, to portray them with plane-based objects like this one. In the game engine, try to portray complexity through texture rather than model whenever possible. This palm leaf does not need to be very complex, because its true realism will be applied through its texture. We will be covering texture shortly, but I'll jump ahead just a moment to show you what the completed palm tree looks like.

Look how grotesque the original palm tree looks now that it's shown beside one that's so realistic! It's always worth going the extra few steps to make your game look good. Don't be afraid to invest the extra time - in all likelihood, your game will not only look better, but it may run faster as well.

The large Suzanne head I will simply delete. Always try to make your own models: they'll more closely resemble your own style, and they may even be more compatible with the game engine. There is no need for a giant stone monkey head here, though, so there is no reason to include it. If you are making a Blender-themed game, however, incorporating Suzanne is encouraged!