Time to add the bad guys! Along the way we’ll be doing a bit of audio editing, some image editing and some more neat tricks with inheritance. To finish, we’ll add some new cameras you can switch through while playing using the ‘tab’ key and also get the RADAR on the HUD working. First, the audio editing. In Issue 5 we provided an engine sound you could download for the game. Time to explain how we made it…
1. Some basic Audio Editing
Creating the engine sound from Issue 5 is nice and quick. We need an engine sound that can be looped continuously in our game. The engine sound, in game, is increased or decreased in volume depending on the player’s speed. To create it we used a piece of software called Audacity – The Free, Cross-Platform Sound Editor. As with all of our software suggestions it is free and will run on Linux, Windows and Mac:
Now, run Audacity and perform the following steps:
- In the top menu, click Generate and then Noise.
- On the pop up that appears, set the noise type to Brown and the duration to 000.005 (5 Seconds). Leave amplitude as it is. Click Ok.
- You now have a sound, try playing it! Bit tinny for an engine though. So hit Effect on the menu and then Echo. Leave the options as their defaults. Click Ok.
- A little better! Now, click Effect again and select Bass Boost. Click Ok to the default options.
- Save the file. Then click File -> Export. Select Microsoft WAV File Format and save the sound file. You’ll recall from Issue 5 it’s the WAV we’re after.
That’s it! Try playing the sound in Audacity. To hear it looping click Transport then Loop Play (or hit Shift-Space as a nice shortcut). We chose brown noise because, from the options in Audacity, it is the noise type which is most muffled and lowest pitched – exactly what we needed!
2. One Enemy Fast!
Perhaps the quickest way of creating an enemy, at this point, is to use the existing player model but change the texture (image) so it does not look the same. We may, in the future, decide the enemy needs a different model. We may introduce further enemies with further different models. For now, however, it is sufficient to take the player model and ‘make it look different’. If you’re objectionable to this approach consider what we’re doing to be a “place holder”. Changing the actual model is no more difficult than changing the models texture – assuming you have a second model to use.
For the Brave:
Pondering where the model originally came from? The process was as follows:
We found the model online for free here: Turbosquid Model Repository. The model was provided as an LWO (Lightwave Object) file. Now, Panda3D can already read LWO files but we went the extra mile of converting it to an EGG file for you back in Issue 2. Knowing you can get a model to the EGG format is often important – particularly if you plan on editing the model in Blender (see below).
We imported the LWO model into Blender, a free fully functional cross-platform 3D editing suite. You don’t need any models to start in Blender – you can create your own masterpiece from scratch! Visit the Blender Homepage.
It is at this stage you would edit your model if needed. Before finally exporting it as an EGG file by an exporter for Blender (see Converting from Blender in the official Panda3D documentation).
Blender is something for discussion in the future and Blender is not easy! Only the brave should attempt a model change at this stage. 🙂 If you’re sticking with us and the current model, here is what you need to do:
- Open up volume1/models/alliedflanker.jpg in GIMP (we introduced the GNU Image Manipulation Program in Issue 2).
- On the top menu, click Colors then Invert. Job done!
- You might also try the “Colorise” tool, also available from the Colors menu.
- If you are feeling adventurous, try changing the USA flag on the wings in GIMP.
- Save the modified image as volume1/models/enemyflanker.jpg.
The image below shows the original texture (allied) and our new enemy version: