Blending Online

Home

Blender Games

Vertigo [Incomplete]
The Shooting Gallery
Shadowdale
Space Assault
Transcendent Christmas Demo

CG Projects

Lamp
Rod
Asgard Ship
Another Ship
James Pond
Sword of Nibelungos
Sword of Odin
Human Head

University Projects

Library Model Walkthrough
Flash Game
VRML World

Tutorials

Building a Menu
Camera Collision
Adding Music Support
Screen Effects
Static Shadows
Using Text
Walk Cycles

Resources

Additional Font Sets
Menu Builder Template
Custom Cursor Template

Links

Random Stuff

MMORPG Characters

Building a Menu System - Part 1 - Integration [INCOMPLETE]


Aim of this tutorial:
To explain how to use the Menu Builder template to create a menu system for your own game. The template can be downloaded from the Resources section.

Required knowledge: Basics of the game engine, Basics of python, Understanding of the GameKeys module.

Result of using this template: You will have a set of global variables available to use in your game after setting up the menu. These can all be altered using the various screens and saved to a file.

Variables created

GameLogic.Keys[0-9] 10 GameKey codes to map
GameLogic.MouseSens Float: 0.1 to 1.0 incrementing by 0.1
GameLogic.MouseInvert Integer: 1 is enabled, 0 disabled
GameLogic.Settings[0-4] Integers: 5 values to map to ingame settings
GameLogic.SoundEnabled Integer: 1 is enabled, 0 disabled
GameLogic.SoundVolume Float: 0.1 to 1.0 incrementing by 0.1
GameLogic.MusicEnabled Integer: 1 is enabled, 0 disabled
GameLogic.MusicVolume Float: 0.1 to 1.0 incrementing by 0.1

Scene 1: Initialise

This scene should be the very first in your game. It's purpose is to load all the saved settings from the config.cfg file and initialise any global variables needed for the menu system.

What to change?

1. The Initialise script has an optional element to play music from the very beginning of your game. This requires a pygame installation to use however. Simply uncomment the code and enter the path of your music file to use it.
2. Further down this script you can set default settings. Bear in mind the keys require either the GameKeys module numbers (eg. 117, 102) or the equivilent gamekey codes (eg. GameKeys.WKEY, GameKeys.SPACEKEY).

When the initialise script has finished it will load the next scene, which leads to the Blender and Bullet intro scenes. If you don't wish to include these in your game, change the Next Scene actuator to the Menu scene.

Scene 2&3: Intro Blender & Intro Bullet

These scenes require no modifications, and can be skipped by clicking the mouse.

Scene 4: Menu

The main menu scene, consisting of 3 layers. The loading screen at the front, the menu behind that, and finally a background scene.

What to change?

1. The loading screen's texture should be changed first to fit in with your game. By taking a screenshot of your background scene and mapping that onto the loading plane, you can achieve some interesting fade in effects by manipulating the image. A tutorial on doing this will be coming soon!

2. To add your own background scene to the menu, select the loading screen object and change the scene of the Menu BG actuator.

3. The New Game button. All that needs to be changed on this button is to amend the scene of the Remove BG actuator to your background scene.

4. The Credits button.
Again amend the scene of the Remove Menu BG actuator to your menu's background scene. In the Add Menu BG C actuator you can add a separate background scene to use in the Credits screen.

Scene 5: Opt Keys

The first of the Options screens, here you can configure the 10 key slots.

What to change?

1. Rename the text fields on the left side of the window to reflect what you want each of your keys to do. The top key button will be GameLogic.Keys[0] and the bottom one will be GameLogic.Keys[9]. Remember this so you know where to map the variables to in the game.

2. If you don't require all 10 keys, move any unused ones outside of the window view (don't delete them as this will break one of the scripts).

Scene 6: Opt Mouse

The second of the Options screens, here you can configure the mouse settings. Nothing needs to be changed in this scene.

Scene 7: Opt Settings

The third of the Options screens, here you have a set of 5 settings which can be mapped to any function in your game.

What to change?

1.Rename the text fields on the left side of the window to reflect what each setting should do in your game. The top setting will be GameLogic.Settings[0] and the bottom one will be GameLogic.Settings[4]. Again remember these so you know where to map the variables to in the game.

2. If you don't need all of the settings delete the text from the Xs so they disappear (don't delete the text objects as this will break one of the scripts) and you can just delete the buttons. If you only want 2 options on a particular setting, you can just delete the 3rd button.

Scene 8: Opt Sound

The fourth of the Options screen, here you can configure the sound & music settings. Nothing needs to be changed in this scene.

Scene 9: Credits

Here you can list all the Credits for your game against a different background scene to the main menu.

Scene 10: Init Game

Once the New Game button is clicked this will be the next scene before your game starts. It runs a script named Init Game to initialise all the global variables required by the game. In this script you can enter any required values for your game.

Building a Menu System - Part 2 - Customisation


Hopefully you've now successfully integrated a menu system into your game. At this point you may want to make it look a little more unique and customised to your own game. For this reason I've provided several variations on the button and window designs. The menu is setup in such a way that's it's easy to alter the look of it with minimal effort.

In the Textures folder you'll find a variety of designs on the buttons and windows. Simply replace the current image in the UV editor with another one and every button or window across the whole menu will change.

The following textures can be replaced:

Interface_Window1.png (texture of the windows)
Interface_Button1.png (texture of the rectangular buttons)
Interface_Button2.png (texture of the circular buttons)
BlenderLogoSmall1.tga (small logo in the corner of each window)
Arial.tga (the font of the text)

Try also adjusting the layout of the main menu and various windows. You may find elements of the menu suit your game better in different positions.