Your message has been sent.
This article has been saved to your account.
Go to my account
This article has been emailed to your Kindle.
Send this article
Blender is an open source, cross platform suite of tools for 3D creation, capable of modeling, rendering, and animating 3D environments.Blender Game Engine is the part of the Blender 3D editor used to create actual 3D video games. It’s the ideal entry level game development environment because you don’t even need to learn to program. Create a complete game using Bender’s innovative logic bricks.
In this article by Victor Kuller Bacone, author of Blender Game Engine: Beginner’s Guide, we'll:
- Learn how to create a library
- Involve enemies in the game
- Create a meeting point for the enemy and player
(For more resources related to this topic, see here.)
An example — save the whale!
The game can augment its levels of difficulty as we develop our world using different environments. We can always increase the capability of your character with new keyboard functions.
Obviously, this is an example. Feel free to change the game, remake it, create another completely different character, and provide a gameplay of another gaming genre. There are thousands of possibilities, and it's fine if you deviate from our idea. It is important that you clear your design before you start your game library. That's all.
How to create a library
If we start working with the Blender Game Engine (BGE), we must have a library of all of the objects we use in our game. For example, the basic character, or even the smallest details, such as the appearance of health levels of our enemies.
On the Internet, we can find plenty of 3D objects, which can be useful for our game. Let's make sure we use free models and read the instructions to run the model. Do not forget to mention the authorship of each object that you download.
Time for action — downloading models from the Internet
Let's go to one of the repositories for Blender, which can be found at http://www.opengameart.org/ and let's try to search for what is closest to our character.
Write sea in the Search box, and choose 3D Art for Art Type, as shown in the following screenshot:
We have some interesting options. We see a shark, seaweed, and some icebergs to select from.
Choose and click on the thumbnail with the name ICEBERGS IN 3D:
- At the bottom of the page, you will find the file.blend downloadable. Click on it to start the download. Remember to click on RMB before the download begins.
- Now, let's try web pages, which have libraries that offer 3D models in other formats. An example of a very extensive library is http://sketchup.google.com/3dwarehouse/.
- Write trawler in the Search box, and choose the one that you like. In our case, we decided to go for the Google 3D model with the title Trawler boat, 28':
- Click on the Download model button:
- Save the file on your hard disk, in a folder of your game.
What just happened?
We have searched the Internet for 3D models, which will allow us to start a library for our game objects in Blender. Whether they are .blend files (original blender format) or of a 3D-model format, you can import them and work with them.
Don't download models that you will not use. The libraries on the Internet grow every day, and we don't need to save all of the models that we like. Remember that before downloading the model and using it, we need to check if it has a free license.
If you are releasing your project under some other free and/or open source license, then there could be licensing conflicts depending on what license the art is released under. It is your responsibility to verify the compatibility of the art license with the license you are using.
Importing other files into Blender
Before the imported mesh can be used, some scene and mesh prepping in Blender is usually required. It basically cleans up the model imported in Blender.
Google SketchUp is another free, 3D software option. You can build models from scratch, and you can upload or download what you need, as you have seen. People all over the world share what they've made on the Google 3D Warehouse. It's our time to do the same.
Download the program from http://sketchup.comand install it. You can uninstall it later. Open the boat file in SketchUp, click on Save as, and export the 3D model using the COLLADA format.
The *.dae Collada format is a common, cross-platf orm file, which can be imported directly into Blender.
eBook Price: $23.99
Book Price: $39.99
Time for action — cleaning up the model in Blender
Open Blender and delete the cube using the X key and press the OK butt on in the pop-up menu. Go to File | Import | Collada (.dae) as seen in the following screenshot:
If you can't see the model in Blender, perform the following steps:
- Open up the View Properties panel from the 3D view, or press the N Key.
- Initially, the main parameter to be changed is in View | Clip End. The correct value is: 1000 (unit system) or 25,4 (metric) or 27,77 yd (imperial):
- Scale the object using the S key, and center the axis on it:
On the Object Tools panel, click on Origin | Origin to Geometry before scaling the object.
Save the ship as a blend file, pressing File | Save As. Then, press theSave As Blender file button.
We will now attempt to design our main character: the whale.
- Search for killer whale in a search box on the Web:
- Click on the image titled Animals - Killer Whale by mandun, and the browser will open a new page. Click on the Download button, as shown in the following screenshot:
- Open Blender and press the X key to delete the cube. Choose File | import | Collada (.dae), and select killerwhale.dae from your specific folder, if you previously exported it to the collada file. Repeat the steps we performed for the ship.
If you prefer other formats, Blender can read 3Ds and obj files too. To see all formats, choose File | User Preferences, press on the Addons tab, and select the Import/Export button on the left menu.
What just happened?
Getting 3D models with other types of extensions requires us to reset them and clean them so we can use them as Blend files.For this, we will import the model. We have reduced the model, focused its axis, and taken everything that is not relevant for our model.
Have a go hero — growing the library
When you have a good library, try to import all models to the 3D view, and move and anchor each object on the scene. You will get a first impression of what your game looks like without any moving objects.
Remember that it is not necessary to find the exact model you need. Maybe some models closely resemble the model that you need. Perhaps, with simple modifications, your character can be ready.
Involving enemies in the game
Let's start with our favorite game engine and put some objects on stage from our library. We can start by placing our whale, some icebergs here and there, and of course our main enemy: the fishing boat.
Time for action — appending the enemy
It is recommended that you create a folder called library, and create subfolders under it, as your library grows. For example, under the enemyfolder, you might want to create folders for animals, ships, food, and so on. If you have a good library with .blend files that has really neat objects used in it, then you can, from your current .blend file, link all of the objects into your current .blend file (level 01).
- Choose File | Append and select the ship file. Press Link Append File by right-clicking on the Library button. The results will look like the following:
- Work from the top, 3D view and select the enemy (ship). Scale it and move it as you like.
What just happened?
We have placed the player, objects, and enemy in the top view, to give us a better understanding of the position of each element in the level we are preparing.
We use the Append option to import objects from the library. It allows us greater error correction if we want to modify any object at any moment.
If you use the Linked option, you cannot edit the object since all you have is a link to it. You cannot add to it or change it, because its source is in another file that is not open. However, you can modify the source, which will reflect in the linked blend files. This works very well for objects we want to share, which are not unique throughout the game.
Have a go hero — reshaping the level
You already have a lot of information, which is required, to know what objects you need for each level of the game, and how you should apply them in your first level. In any case, we did not miss much emphasis on the measurements of each object, and as an example, our icebergs can be of many shapes and sizes. By changing its scale and rotation, you are bound to find plenty of possibilities with a single object. Remember that if you use the Link option, all of the original files in your folders libraries will be updated with iceberg-modifying sources. Learn your options and you will save a lot of time.
Try to move and reposition objects so that your player and the enemy can touch. However, you should reposition the objects again, if the battle overlaps the icebergs.
Creating a meeting point
We can try to move the ship around the whale, without ever having them collide with each other (for now). It is as if the enemy is waiting for the right time, and at the moment is only hovering near our player, waiting for one false move. So, let's create a loop of motion for our boat.
Time for action — making the enemy follow a path
Use a plane to build a navigation mesh, where the boat does seem to surround the whale.
- Choose Add | Mesh | Plane, and click on Top 3Dview editor. Press S to scale the plane:
- Press the Tab key to enter into the Edit mode, and subdivide the faces of the plane twice, as seen in the following screesnhot. Delete some faces around the icebergs, as our boat doesn't cross them:
- Press the Build navigation mesh button on the Scene tab in the Properties panel, as shown in the following image. The plane will be converted into a rainbow:
- Go to Logic Editor, and choose Always as the value for Sensors. Add And for Controllers, and Add for Actuators, as shown in the following image:
- Connect them and choose another Actuator called Steering. The Behavior for Steering must be Path following. Target Object will be whale, and select Navmesh for Navigation Me.
- If you want to see how the boat goes to the whale, select Visualize (a red line is seen when you press P to view in 3D):
Make sure our object ship is selected, before making these connections in the logic Bricks editor. If you have problems viewing the path, display the objects as a wire edge.
What just happened?
It is very easy to give behaviors to the objects. One must know that sensors, controllers, and actuators must be used for this purpose.
We know how our enemy, the boat, moves without needing to press the keys on our keyboard. The boat stops when the navigation mesh ends.
Have a go hero — more interactivity
If you have discovered how to fill the level of potential enemies, and know how they can move, try to make some changes to your player. For example, add one key for diving and passing under the boat or iceberg.
It depends on your imagination, and it will require a lot of attempts for this level of the game to be made more att ractive.
We learned that:
- The Internet is a great library of resources, but you do not always find what you're looking for. Several pages of models may give us some ideas to build our own object.
- If we have completed the library for our game objects, we are now ready to import it to the level that we are creating. We can begin to put more objects in our virtual world.
- With logic bricks, we can make the level of the game more interactive, encouraging only certain elements with the navigation mesh.
Resources for Article :
- Blender 2.49 Scripting [Article]
- OGRE 3D 1.7 Beginner's Guide [Article]
- Blender 3D Architecture, Buildings, and Scenery [Article]
eBook Price: $23.99
Book Price: $39.99
About the Author :
Victor Kuller Bacone is the pen name for a Blender enthusiast of six years. By profession, he is a video editor, but the explosion of current technologies has led him to learn 3D software, and he chose Blender out of them all.
In the short span of his career within the Blender community in Catalonia (Spain), Victor has promoted Blender events, master classes, and an online magazine under the name Blendercat (http://www.blendercat.org) for anyone who wants to learn 3D using free software. His great admiration for the animation and interactive side of Blender is combined with his passion for games, and more specifically, the ease with which one can create games using Blender. He holds a Masters degree in Computer Science, and teaches both young and unemployed adults.