Maximum PC

HOW TO… CREATE YOUR OWN 3D GAMES

Build 3D multi-platform games for free with Unity

- –ROBIN DE JONGH

DEVELOPING GAMES ISN’T EASY. At least that’s the general perception. And it’s true if you’re talking about creating a game from scratch in a general-purpose programmin­g language. But these days, it doesn’t have to be anything like that hard. There are tools available that happen to cost absolutely nothing, and which make the whole process of creating a game a pleasure, rather than a chore. Almost a game in itself. Unity, as an example, offers the kind of graphical interface that you’d more commonly find in a simple-to-use 3D modeling tool, with cameras, light sources, and models. You can have something impressive up and running in a matter of minutes, as we’re going to show you here.

1 GAME ON

Unity Personal Edition is free from http://unity3d.com. Once you’ve installed it, open Unity and hit “New Project.” Name your project “IslandRun,” and in the same screen click the “Asset Packages” button. Tick the boxes for “Cameras,” “Characters,” “Environmen­t,” and “Vehicles” packages, and click “Done,” then “Create Project.” Your game assets library will take a while to load and the progress bar will show how far you have to go.

Once in the Unity Editor, you’ll see a screen similar to any 3D modeling package. On the top, you have the main scene into which you’ll place your 3D or 2D objects. You could create these yourself, using tools such as Gimp and Blender and import them, but in this tutorial we’ll be using pre-made assets from the Libraries you just loaded. Think of the Scene view as a film set on which you assemble the components prior to a take.

2 SETTING THE SCENE

If you click the tab above the scene view, labeled “Game,” the window will change to the game view. Continuing the analogy of a film set, the game view shows you only what the audience will see. Click the “Scene” tab before continuing. Next to these windows, on the left, is a list of everything that’s currently in the scene. Think of this as your stagehand’s list. If you click the camera in the list, it will highlight the camera in your scene.

Typing “cam” into the search field at the top will isolate anything on the list with those letters in it, making it an extremely useful way to find things in your scene if it gets crowded. On the far-right of the screen is the Inspector [ Image A], which will show details of the Camera you selected. Delete the letter from the search box and then select “Directiona­l Light” in your Hierarchy list. You will see that the details change to those more specific to your lighting.

3 WATERWORLD

There’s nothing to see at the moment, so let’s get on with some world building. One of the simplest but most effective things to do it to is to start with water—it provides visual interest and some natural edges.

Below the scene window is a project list, containing all the game assets you’ve loaded into the project. Select “Standard Assets > Environmen­t > Water > Water > Prefabs,” then drag the “WaterProDa­ytime” item into your Hierarchy list. It will now appear in your scene. Above-left of the scene window, you have five buttons. Select the fourth one in. Click the little box at the center of the “Water” prefab, hold down the left mouse button and move up. This scales the water up. Do this a few times [ Image B].

4 WAVE MACHINE

The Water prefab you’ve inserted in your scene is a flat disc with a Material already applied to it. (For more about materials, see “How Materials Work,” opposite). Click the “Play” button at the top-center of your

screen and see what else it has to offer. Did you notice when you hit “Play” that Unity executes a script that animates the bumpiness of the waves? So, what we have so far is a camera view that remains static, pointed at the horizon of a scene that has one light in it, a skybox that simulates diffused light from the sky, and a flat plane with water material applied. Finally, a script attached to the water makes the waves animate over time. Go to “File > Save Scene,” and type “IslandRun_ Scene” and hit “Save.”

5 CREATING THE ISLAND TERRAIN

Unity comes with terrain-editing tools that we’ll now use to create an island. Go to “Game Object > 3d Object > Terrain.” In the Inspector, enter “X -250,” “Y -5,” and “Z -250.” This places the terrain at the center of the Water, since the terrain defaults to a 500-wide square. The “-5” in the Y axis allows the water to be above the terrain.

At this stage, increase the water, too, so that it stretches out further than the terrain. Select it and enter “X 1000” and “Z 1000.” We’ll now raise various parts of the terrain to create an island. With the “Terrain” selected, click the “Raise/Lower Terrain” button. Select one of the rough brushes and increase its size to “100” and Opacity to “50.” Paint onto the Terrain the general shape of your Island.

Next, reduce the brush size and opacity, then repeat to add in medium detail. Finally, use the “Smooth Height” feature if you have a terrain that’s too bumpy. Use the scroll button to zoom in and out and the middle mouse button to pan around the view. Click the “Paint Texture” button and select “Edit Textures” and “Add Texture.”

To apply and paint textures to your island, click “Select” on the left-hand square labeled “Albedo (RGB).” Scroll down to find “SandAlbedo” and double-click. Select “Add.” You’ll notice that sand has been applied to your whole Terrain. Now add another Texture in the same way, selecting any of the “Cliff” or “Rocky” textures. Now, select it and use brushes in the same way as before to paint over the top of the sandy terrain wherever you want rock to poke through [ Image C].

 ??  ??
 ??  ??
 ??  ??

Newspapers in English

Newspapers from United States