Sie sind auf Seite 1von 26

ISSUE 9 2006

DEVVING IN

SOUTH
DURBAN

A F R I C A’ S
FIRST
GAME MAKER
COMMUNITIES

GAME
DEVELOPMENT
8 GOLDEN RULES OF
GAME DEVELOPMENT
MAGAZINE

REVIEWS : THE CLEANER. FEATURE : DURBAN


DEVLAN. TECH: DATA STRUCTURES 3
THE GAME DEV. POWERHOUSE Cover: “The Cleaner” by Darthlupi
CONTENTS
REGULARS
03 - ED’S NOTE

04 - DIGITAL STOMPIES

FEATURE
05 - FUN AND GAMING IN DURBAN

REVIEW
08 - THE CLEANER

DESIGN
10 - 8 GOLDEN RULES

12 - FRAMESWORKS: GAME STATES

16 - BLENDER TUTORIALS: PART 5

TECH
19 - DATA STRUCTURES: PART 3

MOBILE
22 - GAME DEVELOPMENT IN JAVA:
MULTI-PLATFORMER

TAILPIECE
25 - GAME MAKER COMMUNITIES

21 11 16
33

02 DEV MAG ISSUE 8 2006


ED’S NOTE
THE STAFF

N
o lies -- this has been quite a month. There’s a big bad boil-up near the end
of every year, with this annum being no exception. During the production DRIVER’S SEAT
of this issue, work commitments took from us one of our dear designers, Stuart “GoNzO” Botma
several of our writing staff and six packets of greatly cherished peanuts (which, the
witty may suggest, are used to pay these staff in the first place).
PASSENGER’S SIDE
Thankfully, the scantness of this issue is going to be cancelled out by the size of Rodain “ Nandrew ” Joubert
our two-month special, due for release in late January and promising over 50 pages
of game development goodness. Why late January? Well, like everyone else, Dev.
Mag enjoys a holiday now and again, and our brief sabbatical from the field will FURNISHERS
hopefully do good in refreshing us for another year of writing. So, be sure to stick Brandon “CyberNinja” Rajkumar
around, and don’t worry -- we won’t be dropping off the face of the earth. Not for Paul “Higushi” Myburgh
longer than a month, anyway.

From the looks of things, Durban is rapidly heating up as a secondary base for ENGINEERS
local Game.Dev activities, moving from its successful D# Hotlabs onto its very Simon “Tr00jg” de la Rouviere
own DevLAN held in November. Two prestigious Game.Dev figures were there to Ricky “Insomniac” Abell
give talks and host workshops over the course of two days, much to the delight of William “cairnswm” Cairns
local devvers. Read more about this rewarding experience in this month’s featured Bernard “BurnAbis” Boshoff
article. Danny “dislekcia” Day
Andre “Fengol” Odendaal
Adios, enjoy the holiday, and we’ll catch you early next year! Heinrich “Himmler” Rall
Matt “Flint” Benic
Deputy Editor Luke “Coolhand” Lamothe
Rodain “Nandrew” Joubert “Skinklizzard”

WEB ACCESS
Claudio “Ch1ppit” de Sa
Robbie “Squid” Fraser

WEBSITE
www.devmag.org.za

To join, make suggestions or


just tell us we’re great, contact:
devmag@gmail.com

This magazine is a project of


the South African Game.Dev
community. Visit us at
www.gamedotdev.co.za

All images used are Copyright


and belong to their respective
owners. If you try claim other-
wise, aliens will eat your brain.
Don’t say we didn’t warn you ...

03 DEV MAG ISSUE 8 2006


DIGITAL STOMPIES

Podcasts on mobile technology

http://www.khronos.org/podcasts/

The Khronos Group has recently started on a


series of Mobile Media Developer Podcasts.
3D fun with Panda The group, which describe themselves
as “the developers behind the industry
http://panda3d.org/ standards for 3D, 2D, video and audio for
mobile devices” focus on explaining the
Panda3D version 1.3 has just been new technologies in their podcasts. Two
released, adding lots of goodies to the podcasts have been released so far, dealing
growing 3D engine. Panda3D is a C++ with OpenKODE and OpenSL ES.
library with Python bindings, meaning
that it is callable from either of the
two languages. It focuses on rapid New Torque release
game development with a short (and
assumedly painless) learning curve, http://www.garagegames.com/blogs/33542/11746
and has already succeeded in making
many 3D projects extremely quickly. Take a look here for a detailed outline of the new Torque Game Builder
Panda3D was originally used by Disney release, version 1.1.3. The windows version of the release has already been
to create their MMO Toontown, and was made, and includes a new documentation framework, a new text object, align-
ment tools and, of course, a major list of bugfixes which are sure to make
NEWS

first released as free software in 2002.


a lot more users happy. If you don’t know about the Torque Game Builder
already and would like to find out what it’s about (or benefit from a 30-day
free trial), take a look at http://www.garagegames.com/products/torque/tgb/
New dev-oriented community site
for more info.
http://www.greatgamesexperiment.com/

The Great Games Experiment is a


community aimed at both gamers and
game developers, trying to get the two
groups to network and gain exposure to
one another. Given an online “space”,
game developers or groups can profile
themselves, meet other people in the
industry and generally have a new plat-
form on which to promote themselves.
This website was developed by Garage
Games (www.garagegames.com) and
is currently in an invitation-based beta Some XNA eye candy ...
state. Newcomers are, however, allowed
to request a beta invite and sign up for http://channel9.msdn.com/Showpost.aspx?postid=257928
the newsletter. http://channel9.msdn.com/Showpost.aspx?postid=261254

The Channel 9 forums recently


blessed XNA enthusiasts with
a two-part video series on XNA
called “Looking at XNA”. The
first part of the series is an
in-depth interview with Boyd
Multerer about the tool, includ-
ing the idea behind XNA and the
Studio IDE which it uses. The
second part gets XNA in action
on a 1080p display, showing off
its immense power, and also
consists of a bit of chit-chat
with Frank Savage, one of the
people who worked on the old
Wing Commander titles.

04 DEV.MAG ISSUE 8 2006


Dozens of game developers.

Two Game.Dev gurus.

One Durban DevLAN.

FEATURE
FUN AND GAMING IN

DURBAN

05 DEV.MAG ISSUE 8 2006


O
n the tenth and eleventh brought up to speed on the local challenge was to come up with
of November, Durban situation: to grow the industry in an idea and design a board or

saw its first DevLAN/Game. this country, games are needed card game so as to emphasize
Dev workshop. Held in the – good quality games mostly, but the importance of good design

local branch of I.T. Intellect, it games nonetheless. Not ideas, and planning. To help them all
received a score of budding as the lack of local publishers out with this strenuous challenge

and enthusiastic developers means that local companies are he even gave a small talk on
who gathered to listen, watch hard-pressed to sell game ideas. game design to nudge them in
FEATURE

and most of all absorb valu- This little speech put a purpose the right direction.

able and insightful ideas from in these avid developers’ hearts


two of South Africa’s leading – they were going to save SA’s Day two, Saturday, started bright

game development gurus, game development industry by and early at nine o’clock. This
Danny Day and Miktar Dracon. making the best, most ultra awe- was when the real fun began.
some game ever. But, rather than After a quick introduction to the
The weekend kicked off on let them all run off, cause havoc basics of Game Maker 6.1, a
Friday evening with an introduc- and ultimately get nowhere, very powerful little game creation

tory presentation by Danny Danny moved on to the process tool, along with a demonstration

on game development in SA. of sound game design by giving of just how much could be done
The avid listeners were quickly the attendees a challenge. This with it, the developers were once

06 DEV.MAG ISSUE 8 2006


again challenged, but this time a chocolate bar that he couldn’t interesting ideas were used for

by Miktar. The challenge was finish. Being the kind soul that he Johns life: for waking up, one

simple, or so it seemed: one is, he generously gave his half group decided to have the player

had to write a game about a day eaten chocolate to a ravenous (or throw John off of his bed and

in the life of fictional character so it seemed) growing boy who try and hit an X on the floor with

John. How hard could that be? needed the energy, on one condi- him, while another game had the

Well, it turned out to be tougher tion (yes, he puts conditions on player firing neurons into Johns

than the developers thought, not giving away food) – the chocolate synapses to wake him up. For

FEATURE
because of a lack of inspiring was not to be sold on eBay (it’s work, John was anything from a

and awesome ideas but rather going for free but shipping to bling thief to a policeman to the

the lack of experience working anywhere will cost R250). only thing between this world

with Game Maker. However, and the rabid invading teddies.

with Miktar taking the reins and Having replenished their energy,
setting up a projector to do a it was back to work for the devel- All in all, the weekend was a

few tutorials in the one lab and opers. Interestingly, Miktar’s great success with fun being

Danny the same in the other, this tutorial digressed from the life of had by all, in the process of

problem was overcome. John to a tutorial on how to make learning how to make a game…

a classic top-down shooter: blue That’s the power of the level 90

Lunch break. Ahhh, that dot against a horde of yellow arch devvers Danny and Miktar,

wonderful point when you stand dots. In his defence though, not turning normal innocent humans

up, rub your eyes to try and only was John allowed to dream, into rampaging devlings, but hey

remove the purple spots of retina but the chain reaction caused – who doesn’t want to be a dev-

burn and take a break from by the power pickup was totally ling with the chance of one day

strenuous coding to get food. and completely awesome. Think becoming a great arch devver?

The developers dispersed: some power bullet hits enemy releasing SKINKLIZZARD

got themselves Steers burgers, 10 others all in random directions


others pies, chips and gravy, which hit other enemies and so
and in Miktar’s case a coke and on and on. Many diverse and

07 DEV.MAG ISSUE 8 2006


The Cleaner
Despite its somewhat bland name, The Cleaner is a prime example of what can be achieved by talented
developers with the right tools. It oozes quality and has a length to rival, and perhaps even surpass,
some commercial games. And the best part about it? You can get it for free!

T
he Cleaner sees the behind him as he flies through fights becomes part of the
player adopting the role the air. challenge.
of a mage whose goal is to The game’s storyline advances
REVIEW

rid the ‘multiverse’ of an evil by use of numerous cutscenes, As the player progresses
race that seeks to obliterate which set the scene for the through the game, battling
the friendly race of magic player. The back-story quickly enemies and solving puzzles,
wielders. Players will travel fades into obscurity, though, he or she is rewarded with
throughout multiple unique and the focus is quickly estab- experience points which are
worlds, all presented in an lished on the action. And action in turn used to purchase new
incredibly impressive and there is! The game constantly offensive and defensive spells
stylish manner. Every detail throws challenging situations or upgrades. These spells
is there, right down to the at the player, and everything are varied enough so as to
way the player’s cape flows from the terrain to the boss provide strategic uses for all

08 DEV.MAG ISSUE 8 2006


of them. In addition to your eyes and the sounds effects sold as a commercial title.
magical arsenal, the player can become harsh and annoy- The Cleaner is probably one
also has the ability to fling ing. Despite these minor short- of the best games ever to be
objects at enemies using comings, it is the exquisite created using Game Maker,
telekinetic abilities. style in which the whole game and is a true showcase of the
is assembled that truly makes framework’s potential.
The game also includes it shine. CH1PPIT
totally unique artwork, musi-

cal score and sound effects. It is a true boon to gamers that Developer: Darthlupi

REVIEW
the game’s creator, Darthlupi, Website: http://darthlupi.com/
The music works well to set
Genre: Action
the often tense atmosphere, decided to release this game
Year: 2006
and doesn’t become repeti- for free, since it could be easily

tive. However, the graphics


might be a little hard on the

09 DEV.MAG ISSUE 8 2006


8 GOLDEN
RULES

Applying Shneiderman’s 8
Golden Rules to Game Design

I
n the world of IT, there is a Strive for consistency players to do things quickly and
whole branch dedicated to a on-the-fly, all while giving them

topic called Human Computer When a player plays a game they an advantage. Things like mouse
Interaction (HCI). The term get used to and comfortable with the gestures make surfing the Internet
DESIGN

HCI is fairly self-explanatory: controls and gameplay mechanics so much more of a joy and it can

it’s basically the study of how as time progresses. While it’s good have the same positive effect on
people interact with comput- to create a sense of advancement a game.

ers and how well the interface by adding things as the player

between the user and computer progresses, don’t go overboard. Offer informative feedback
is designed. Another good way Sometimes, in the process of
to phrase it is simply ‘user- making a game, you test it so often Players need to know what’s going
friendliness’. that it becomes too easy for you on in the game; things like ammo

and you are tempted to make things and health are important to a player

In the field of HCI, a man by the harder. As you design the learning as it influences their decisions.
name of Ben Shneiderman cre- curve and progression of difficulty, Make sure your system provides

ated 8 rules to be applied when always bear the inexperienced all the statistics a player needs
designing the user interface. While player in mind. in a clear and concise manner.

they seem relatively simple to A common, useful method is to

most of us when applied to creat- Enable frequent users to use display things in the corner of the

ing business software, they can shortcuts screen. Recently, some developers
also be applied to game design have decided to remove the on-
with great effect. Let’s take a look As a player invests time in a game, screen display to improve realism.

at the rules and how they can they improve and seek ways to While it’s great to be different, an

improve our games. achieve things quickly with less alternate, effective solution which

effort. Strategy games often offer still depicts vital stats must be put

keyboard shortcuts that allow in place.

10 DEV.MAG ISSUE 8 2006


8 GOLDEN
RULES

Let the user know when they Permit easy reversal of actions ago, not without prior warning
have completed a task or some kind of reminder. While
Everyone makes mistakes, and you may have spent many hours
Ever wasted time in a game whether the player has accidentally coding and know the game inside
searching for something when pushed the wrong tile in a puzzle out, the player doesn’t have the
you’ve already found it? It’s not game or has missed the second- same experience as you.
fun and can ruin the experience. to-last golden star while jumping
Make sure things are clearly around in a time trial, offering some- I hope that these points have
designed so as to let the player thing as simple a quick-restart option given you some ideas and things
know if they have been successful is a useful anti-frustration measure. to keep in mind the next time you

DESIGN
or have failed. This gives the player a break and design a game. Try to remember
allows them to try again. that, while designing, the player’s
Offer simple error handling experience is of utmost importance.
Provide a sense of user control These points can help improve the
Offer a struggling player help experience, and a good experience
when it seems he or she has Gaming is an interactive form of results in a happy gamer.
moved astray. Sometimes a entertainment, so players like to feel INSOMNIAC
player attempts a mission, but like they are controlling the action.
doesn’t see the first vital check- While cut scenes are necessary to
point and runs off in the wrong advance the plot, try and keep them
direction. Some subtle guidance at a minimum. You could even be
can give them much needed help. really innovative and give the player
For example, if the player has some form of control in a cut scene.
spent more than a certain amount

of time running around aimlessly, Reduce short-term memory load


give them an arrow leading them
to the correct destination or intro- Humans have a limited short-term
duce a ‘side-kick’ character who memory, so don’t over burden them
can point them in the right direc- with things to remember while
tion. It seems so simple but can playing. Not many people are going
prevent the player from becoming to remember some little detail like
frustrated and giving up. the security code they used 2 hours

11 DEV.MAG ISSUE 8 2006


FRAMEWORKS
State Management
While a game is running, it will pass through a number of global states. These states dictate what the player is
currently seeing and experiencing within the game. It is important to manage game state and understand the flows

between the different game states to ensure that the player always has control over their in-game experience.

S
tate Management refers to A separate Class can be created to for things like highscores or to save

many different aspects within manage the game state. A class can be games etc.

a game. The weapon selected by a created for each game state and the

player in an FPS is an example of main game loop will only execute the Game Maker uses rooms to represent

state management while the screen relevant methods of the active state. game state. Each room is effectively
the player is currently seeing is also With inheritance and polymorphism, the a class that manages the player’s cur-
DESIGN

an example of state management, implementation of a class-based state rent in-game experience. As the game

often referred to as the Game State. system is very easy. A base class can state changes and the player moves

This article will examine various be created that contains virtual meth- into a new room, the old room no

methods of managing Game State ods for the standard functions such longer affects the player or the screen
within a Game’s State Management as Rendering, Update and Input. As in any way and the new room now
framework. new states get added to the game the becomes the item controlling the game

base class is extended to manage the experience. Game Maker ensures that

Game State can be managed as new requirements. When relevant the the Input, Update and Rendering func-

part of the standard game loop. This Game State is marked as active and is tionality for each room is completely

is often used when a single input immediately used within the game. A independent of each other room.
method is being managed or when class based state management system

the number of state is kept very will typically ensure that each state is Whichever way State Manage-
small. To enable State Management atomic and knows nothing about any ment is implemented within a game,

within the Game Loop a global state other state in the game. This therefore certain aspects must be included in

variable can be set and evaluated sometimes requires other mechanisms the design. If these aspects are not

each execution of the game loop. to pass messages between states included as part of the design they will

Based on the currently active state impact the later game implementa-

the relevant rendering and game tion quite heavily. If these aspects

update procedures can be called, are included as part of the original

or even on a very small game the rel- State Management design, the effort
evant rendering and updates can be required to extend them for each game

done within the Game Loop itself. state is minimal.

Basic Game States

12 DEV.MAG ISSUE 8 2006


Each state needs to be able to One state that is often forgotten or in the game is easy and reusable.
render the required graphics to the ignored is the Pause state. The pause A Class based state management
screen. Each state therefore needs state is a special state in that it either system allows the design of generic
its own render method. If state represents a static screen or it keeps state structures such as a Movie play
management is managed within the screen of the previous state and class, a Company intro screen, a
the game loop the rendering of the waits until the pause state ends. When Please register screen that, with very
graphics may be a custom procedure the pause state ends the game should little rework, can be used over and
called based on the current state. resume with the previous state active over again in many different games.
A class-based state management and as if no pause had happened. A game loop-based system is easier
system will implement different to code and allows the creation of
rendering processes for each state detailed game templates but suffers
within its class. from not having enough flexibility to

adjust older games to newer ideas.


The management of input for each Based on events and actions within the
state can sometimes be more game states must change. Game Loop State Management is a key concept
complex than the rendering as the state transitions are easy as the cur- needed when creating games. With
program typically receives the input rent state parameter only needs to be a good flexible state management
messages and needs to pass them updated with the new state to allow the system, the options available to the
to the relevant state management game state to change. A class based game developer expand and make
system. The class based state state management system has more new functionality easier to add. A well

DESIGN
management can implement a complex mechanisms needed to imple- designed state management system
custom method within the class to ment state transition. Either each pass can decrease the amount of work
manage the input handling, while the through the game loop must check for required for a new game significantly
game loop based state management the end of the current state and then as the look and feel of the game is
system may define independent initiate the new state, or an event must already predefined. By spending some
functions to manage the input or be raised by the state that is caught by time understanding the ins and outs
in simpler games may do all input the main game code which controls the of state management each and every
management within a single method. transition to a new state. game the game developer creates will
Input management can also be be easier, quicker and more complex
implemented using events that the In many cases state management than the previous game.
various state management systems can be extended to allow states to CAIRNSWM
subscribe to. have initialization and

finalization functions.

As the player interacts with the These functions can

game the current game state needs include things such as

to react to the player. Each state game start-up processes,

therefore needs to implement its screen fade ins and outs

own update method that allows the and load game data etc.

various entities on the screen to The design o f the state

move, collide etc. Each state once management system

again needs to implement the update can be done in such a

process to only update the items way that the develop-

relevant to the current state. ment of new functionality Complex States

13 DEV.MAG ISSUE 8 2006


CODED EXAMPLE OF GAME STATE FRAMEWORK
public class GameState
{
protected GraphicsDeviceManager graphics;
protected ContentManager content;
protected SpriteBatch spriteBatch;
protected GameMouse mouse;
protected KeyboardState keyboard;
protected ImageList Images;

/// Constructor to create a new Game State


public GameState()
{
Cursor = null;
CursorOn = false;
mouse = new GameMouse();
}

/// Initialize all the required fields of the GameState.


/// This must be called after the game state is created.
public virtual void Initialise(GraphicsDeviceManager NewGraphics,
ContentManager NewContent, SpriteBatch NewSpriteBatch, ImageList NewImages)
{
graphics = NewGraphics;
content = NewContent;
spriteBatch = NewSpriteBatch;
Images = NewImages;
LoadResources();
}

private TImage _Cursor;

public TImage Cursor


{
get { return _Cursor; }
DESIGN

set { _Cursor = value; if (value != null) { CursorOn = true; } }


}

private NeheFont _Font;

public NeheFont Font


{
get { return _Font; }
set { _Font = value; }
}

private string _GameTitle = “C# XNA”;

public string GameTitle


{
get { return _GameTitle; }
set { _GameTitle = value; }
}

private bool _CursorOn = false;

/// When True the Cursor Image will be displayed.


public bool CursorOn
{
get { return _CursorOn; }
set { _CursorOn = value; }
}

public event StateEventHandler OnEndState;

/// Check User Input - Call DoInput()


public void Input()
{
mouse.GetState();
keyboard = Keyboard.GetState();
DoInput();
}

14 DEV.MAG ISSUE 8 2006


/// Update the objects etc
public void Update()
{
DoUpdate();
}

public virtual void LoadResources()


{
}

/// Call the Draw function


/// Display the Cursor if neccessary.
public void Draw()
{
DoDraw();

if (CursorOn & (Cursor != null))


{ Cursor.Draw(mouse.X, mouse.Y); }
}

/// Update the game state – Must be overriden by child classes


public virtual void DoUpdate()
{
}

/// Called when a state is entered for the first time


public virtual void DoStartState()
{
mouse.Clear();
}

/// Called when the state exists – Must be overriden by child classes
public virtual void DoEndState()

DESIGN
{
mouse.Clear();
if (OnEndState != null)
{
OnEndState(this);
}
}

/// Override to respond to user Input– Must be overriden by child classes


public virtual void DoInput()
{
}

/// Draw the state onto the screen – Must be overriden by child classes
public virtual void DoDraw()
{
}

private bool _Active;

public bool Active


{
get { return _Active; }
set { bool OldActive = _Active;
_Active = value;
if (_Active & !OldActive) { DoStartState(); }
}
}

15 DEV.MAG ISSUE 8 2006


BLENDER TUTORIAL PART 5

W
elcome back. This month we’ll be com- Let’s start with the board itself. Select one of the

pleting the checkerboard we modelled board pieces, go to the materials tab, and create

last time. If you followed the last tutorial, you a material. This new material will automatically be

should have the basic design of the checker- applied to any linked duplicates of the piece you

board with pieces. If you don’t, go back to last selected. We’ll set the material properties first, and

month’s tutorial and create the scene or down- then come back to colouring the pieces. Firstly,
DESIGN

load last month’s file from the Dev.Mag website’s naming the material is often a good idea, espe-

content section. cially in larger scenes where multiple materials are

used. Change the box which reads ‘MA: Material’


to another, more descriptive, name. Then use the
settings for the material shown in the figure at the

bottom of the page.

Once that is done, select one of the board blocks that


is not linked to the one you just applied your material

While we have a reasonably good and accurate- to. In the material tab of this new block, select the

looking model, a render doesn’t do it any justice material you just created from the drop down material

at the moment. It needs colour, shading and some box, and then select Add New. This will create a new,

better lighting. If you used the duplication methods independent, material that is based on the settings

described in the previous instalment, then applying of the previous one. Give this new material another

the materials to the correct objects will be easy. descriptive name.

16 DEV MAG ISSUE 8 2006


Now, for the sake of accuracy, bear in mind that -- in I picked the following red/white scheme for the
a traditional layout -- the light blocks always alter- pieces. The mirror value won’t be used here, so you
nate from the lower-right corner of the board and can ignore it.
the actual pieces are all placed on the dark blocks.

Apply the colours with that in mind. I used the follow- Red Pieces:
ing blue colour scheme for the board: Colour: (R: 1.0, G: 0.2, B: 0.2)
Specular: (R: 1.0, G: 0.3, B: 0.3)
Dark blocks:
Colour: (R: 0.0, G: 0.0, B: 0.2) White Pieces:
Specular: (R: 0.0, G: 0.0, B: 0.4) Colour: (R: 1.0, G: 1.0, B: 1.0)
Mirror: (R: 0.0, G: 0.0, B: 0.6) Specular: (R: 0.9, G: 0.9, B: 0.9)

Light blocks: We’ll also change the colour of the background from
Colour: (R: 0.6, G: 0.6, B: 1.0) the old boring blue. Switch to the Shading Menu, if
Specular: (R: 0.7, G: 0.7, B: 1.0) you aren’t still there, and click the World Buttons icon

DESIGN
Mirror: (R: 0.8, G: 0.8, B: 1.0) to bring up some new options. All you have to worry

about here is the left-most colour block. Click on it


We’ll repeat the same process for the actual pieces. and change it to white. You could also type in RGB
As before, create a material for the one set of values like you do with materials.
pieces, apply the shading settings, create another
material based on it, and then apply the colouring Finally, we’ll modify the lighting for better effect.
to the two separate materials. The shading settings Select the original point lamp, make 3 linked dupli-
I used are visible below. Our pieces won’t be trans- cates and arrange them around the four corners of
parent or reflective, so you can leave those settings the board. Make certain that they’re pretty high over
at their default values. the board. Set their brightness to 0.4. Disable their

shadow casting ability by clicking the Ray Shadow

button.

Now add a new spotlight, place it along one of the

edges or corners of the board, and point it obliquely


across the face of the board. You might need to
adjust the Dist value to give the light a little more

reach. Then, in the ‘Shadow and Spot’ tab, increase


the ‘SpotSi’ value to increase the angle of the
spotlight so that it encompasses a greater portion

of the board. Also change it to cast shadows using

17 DEV MAG ISSUE 8 2006


ray-tracing instead of the shadow buffer.

And that’s it! Your scene is done, and a render


should produce a scene similar to the picture below.
Congratulations, you have created a complete
scene in Blender. Feel free to make your own addi-

tions to the scene and see if you can improve on it.


[end.png]

The completed scene can be downloaded from What we started with.


devmag.org.za.

CH1PPIT
DESIGN

Our final scene. Good enough to play with.

18 DEV MAG ISSUE 8 2006


THE TECH
WIZARD
Data structures part 3: Trees

T
rees are a very popular form branches, any data that has filtered However, this would be very inef-

of data structure, mainly due down here is merely stored2, usually ficient usage of a tree, as we are
to their ability to store data hierar- in the form of a linked list. only dividing all of our data in half.

chically in a sorted manner. This Therefore, if you added 1000 values

functionality allows for the data in Binary Trees to the tree and then wanted to find

a tree to be accessed very quickly. a specific one, you would still have
Most often, trees are used to store The simplest form of a tree is known to search linearly through many of

world data for rendering or for pro- as a Binary Tree. This means that them until the one that you wanted

cessing, but they can also be very each node of the tree has at most was reached.

useful for general data storage 2 child branches that lead to new

nodes / data, and they are a very To expand on this example, the

TECH
Basic Tree Structure useful way to store data in a sorted equation used at each node down

method so that it can be retrieved the tree could be modified so that

The root level of a tree is made up efficiently at a later time. the data is easily sorted into ranges

a single node. This node has some of 10s. To do this, the node belong-
kind of equation(s) or condition(s) A very simple binary tree would be ing to the right child branch of the

associated with it that is used to one where the root node’s equation root node could have the equation

organize the incoming data, as was (x > 0). This means that all data (x > 10), and the node belonging

well as for doing searches when sent into the tree that was > 0 would to the left child branch of the root

data is requested. Along with be placed into the right child branch node could have the equation (x < -
these equation(s) are various of the tree, and all data that was <= 10). This would continue recursively

branches, each corresponding 0 would be placed into the left child for as long as we wanted, with each
to an outcome of the equation(s). branch of the tree new node adding an addition 10 to

Finally, at the end of each of these its equation.

branches are other nodes, also

with some equation(s)1, as well as

more branches.

This process continues recur- INSERT “btree2.jpg”

sively until nodes are reached that HERE

can no longer have an equation. At

this point, instead of having more


1 -- The equations at each node of the tree are usually derived from the root node equation, modified based on the current level of the tree that you are currently at.
2 -- Many types of tree usage also allow for data to be stored at nodes that do in fact have branches down to lower nodes.

19 DEV.MAG ISSUE 8 2006


However, this would lead to a very This keeps the tree more balanced usually some kind of exhaustive
unbalanced tree. This is because and reduces the number of potential testing algorithm is used to try vari-
the right child node of the right searches needed to locate data in ous combinations of which planes
child node would have (x > 20) the tree. to use at each level of the tree.
as its equation. Given this, we

would only be able to add to its BSP Trees


right child node and we wouldn’t

be able to do anything with its Perhaps the most well known kind of INSERT
left child node as all numbers tree is a BSP Tree, which stands for “bspdtree1a.jpg”, through
between 1 and 10 that get this far Binary Space Partitioning1. As the “bsptree1d.jpg” HERE
will remain at this node. name implies, it is really only a spe-

cific implementation of the simple


Unbalanced trees are not as binary trees discussed above, how-
efficient as balanced ones, as ever it was devised to specifically
they are always much deeper than handle the rendering of static world
balanced trees, and each level of geometry in 3D environments. They
a tree that needs to be traversed have actually been around for many
takes up additional time. A more years, but were only made popular
optimal solution would be to pick by the first generation of 3D FPS
a maximum value that our number games (Doom, Quake, etc.) as a way
could ever be, and instead of to efficiently render the visible world.
TECH

merely increasing the value in

our equation linearly, we adopt a A BSP Tree works by dividing the


divide and conquer method. geometry in a world so that only the

visible portion of the world is ren-


In other words if we choose 100 dered at any given time. What makes
as the maximum value that our them different from standard Binary
number can be, instead of setting Trees is that the equations used at
the equation of the root’s right the individual nodes for creating
child node to be (x > 10), we would the tree structure are actually the
set it to be (x > 50). Accordingly, planes that form the geometry of the
its right child node would then world itself. This is why they were
have the equation (x > 75) and very popular for the standard indoor
its left child node would have (x environment FPS games, as most of
> 25). This would continue until these worlds were just made up of
we reached a level that would be flat, perpendicular walls.
deemed sufficiently small enough

and not worth dividing again. In order to create a BSP Tree, any

plane can be chosen as the “equa-

tion” for each node in the tree. The reason behind breaking up the
However, choosing different planes world in this manner is so that for
can provide more balanced and any given plane in the world, it is
INSERT “btree3.jpg” therefore optimal tree creation, so easy to tell which other planes are
1 -- Binary = 2; Space = World/area that you are dealing with; Partitioning = Division

20 DEV.MAG ISSUE 8 2006


in front of it as well as behind it. world data (ie. the planes of the This continues recursively until
This then allows for very straight- polygons in the world), they only some kind of size limitation is met,
forward rendering of the world, as use planes that are perpendicular to at which point the tree is complete.
given the position and direction the world axes. Generally, KD Trees
of a camera you will easily be able used in a 2 dimensional sense (ie. X Generally, KD Trees are used for
to traverse through the built up and Z splitting planes), but can be storing objects in a game world as
tree and at each node check if the used 3 dimensionally as well (ie. X, it allows for easy searching of ones
plane data contained there is in Y, and Z splitting planes)2. that are close to each other in the
front of the camera1. world for such things as rendering,
So, instead of choosing a splitting as well as collision testing, etc. The
If it is, you can render that data of plane corresponding to some main advantage that KD Trees have
the world geometry represented arbitrary world geometry, the world over BSP trees is that they do not
by that plane. The process is then is initially split in the direction of a require the typical indoor FPS style
repeated in a recursive fashion single axis. It doesn’t matter which of “walled” worlds in order for them
down each branch of the tree that one, and it also doesn’t matter at to produce effective and efficient
the camera is in front of until a which point of the axis it is split (ie. trees.
terminating node is hit, at which (X = 0) and (X = 5) would both work).3 COOLHAND
point you have finished rendering

all visible world geometry. Once the world has been divided

along that initial axis, each of the


KD Trees

TECH
new halves is then divided along an
alternate axis (ie. if the X axis was
KD Trees are similar to BSP Trees used for the first division, then the
except that instead of using actual Y axis would be used for the next).

1 -- This is done by using simple algebra and plugging in the camera data into the Ax + By + Cz + D = 0 plane equation
2 -- However, like BSP Trees, KD Trees can be used in both 2D and 3D worlds
3 -- Generally, the axis used as well as its equation, like with BSP Trees, are decided upon by doing exhaustive searching at the tree generation time

21 DEV.MAG ISSUE 8 2006


MOBILE GAME
DEVELOPMENT IN JAVA

Multi-Platformer

F
or the last couple of months, we have been Check the emulator(s) you want to install and
working under a very utopian assumption click Next and then Finish. The platform will now
that Java’s ‘write once, run anywhere’ ideal appear in the list in the platform manager, you
is realistic. Even within the same profile and can close it.
configuration standards, different devices have
MOBILE

their own quirks. As a mobile developer, you Now in the Tutorial project’s properties dialog
need ways to deal with these quirks. The first (accessible by the right clicking on the project),
weapons in your arsenal are emulators. We have notice the Project Configuration section at the
been using the standard WTK emulator, but most top of the dialog. At the moment you should only
of the major cellphone manufacturers provide have DefaultConfiguration and Add Configuration
their own versions which should more closely in the dialog. Select Add Configuration and in the
resemble their handsets. We will be looking at dialog that pops up, give your new configuration
how to set up one of these emulators and how to a name appropriate to your newly added emulator
have multiple configurations for your project in (for example SonyEricsson) and click OK. Now
NetBeans so you can easily build different ver- in the list on the left, select the Platform group,
sions of your MIDlet. uncheck Use Values from “DefaultConfiguration”

and choose your newly added platform from the


The first thing you need to do is install a manu-
facturer SDK such as the Sony Ericsson one
mentioned last time (http://developer.sonyerics-

son.com/site/global/docstools/java/p_java.jsp).
Once installed, select Java Platform Manager
from the NetBeans Tools menu. In the platform

manager, click Add Platform. Change the radio

selection to Java Micro Edition Platform Emula-

tor and click next. NetBeans will now search for


any compliant emulators and list them for you. Adding a new platform to NetBeans

22 DEV MAG ISSUE 8 2006


Emulator Platform drop down menu. Ensure Notice that the preprocessor directives (like #if)
that MIDP-2.0 is selected. Switch to the Abilities are ‘commented out’, this is because unlike in
group and once again disable Use Values from C++, preprocessing is not normally part of the
“DefaultConfiguration”. Click Add to add a new build process (in fact some Java purists may be
ability, and name it after your emulator (e.g. appalled by this necessary evil). NetBeans auto-
SONYERICSSON). Now close the properties matically preprocesses out code for us, saving
dialog, and open TutorialCanvas.java so we can us from some extra work. The SONYERICSSON
see what all this was about. tested for above is the ‘Ability’ we added in the
project settings, so it may be different for you.
In your doPaint method, just before the draw-
String call that renders the available number of Now click in the margin to the left of the new
lives, add the following code: drawString call and a pink block indicating a

breakpoint will appear. Now run your project


//#if SONYERICSSON
(F5) and see what happens. Two things should
g.drawString(“SONYERICSSON”, getWidth()/2,
be different to what you are used to. First of

MOBILE
getHeight()/2, Graphics.HCENTER|Graphics.TOP);
//#endif
all, rather than Sun’s ugly (and unrealistically

large) emulator, you will see that you now have

Property configurations are extremely customizable

23 DEV MAG ISSUE 8 2006


an emulator running in what looks much more game right on the device! Stepping through code
like a real phone. Secondly, when you run your on it is obviously a bit slower than just using
game, rather than being faced with the bouncing the emulator, but this ability is amazingly useful
ball, paddle and blocks, you are kicked back into considering it is almost impossible for manufac-
NetBeans right where you set your breakpoint. turers to make their emulators behave exactly
This is a very good thing. As recently as 18 like the actual phone.
months ago, this sort of thing was only possible
through expensive IDEs like Jbuilder, and the That’s it for this edition. We have really only
typical hobbyist mobile developer would have to scratched the surface of what is possible with
make do with scattering System.out.println calls emulators and configurations and the best way
everywhere to determine what was going on for you to find out more is of course to play
when something went wrong. Notice that, in the around with these tools and see what you can
watches tab in the bottom right of NetBeans, you discover. Also, take a look in the folder where
can actually see the values of all local variables your NetBeans project files are stored, and com-
currently in scope. Feel free to look around at pare the java class files found in the preverified
MOBILE

the rest of the tabs to see what they offer as directory to the ‘originals’.
well. Click in the margin again to remove the
breakpoint and press Ctrl+F5 to continue run- Next week we will look at NetBeans’ powerful
ning the game. Notice the text in the middle of WYSWYG mobile form editor and add some
the screen? You expected that, right? structure to our game.
Now I’m sure you can guess what the preproces- FLINT
sor defines are for, but let’s do a little proof of

concept for interest sake. Close the emulator,


right click on the Tutorial project and choose Set
active project Configuration->DefaultConfigura-

tion. Notice how NetBeans has commented out


the code between the #if and #endif directives?
Set a breakpoint in the same point and run the

project again. Not only does the standard emula-


tor launch, the breakpoint is never hit and our
text is no longer drawn. So you see the combina-

tion of configurations, preprocessing and device


specific emulators makes it much easier to tailor
our code for each platform. In addition, if you

chose to install the Sony Ericsson emulators,

and you happen to have one of the newer Sony


Swish! A shiny vendor emulator.
Ericsson phones, you can actually debug your

24 DEV MAG ISSUE 8 2006


The Game Maker
Communities
On the net there are several Game Maker communities. By this, I mean websites dedicated to the
people who enjoy using the Game Maker development tool. In this article, I hope to give you an objec-
tive low-down on the most popular ones I have visited.

64Digits
http://www.64digits.com
Game Maker Community
64Digits is an exceptional site which not only
http://forums.gamemaker.nl
hosts your files, but also gives you access to
your own Game Maker blog, download counters
These are the official Game Maker forums. More
and badges. It is delightful to read all the like-

TAILPIECE
often than not, they are filled with lots of contro-
minded developers’ blogs, especially when Game
versies which no-one should play witness to. It
Maker greats like GearGOD (1st lighting engine
is usually what some may call a “n00b-ridden”
in GM) and FredFredrickson (King of Cagematch
place, but it has its merits.
winner, ie Best GM game ever) blog there.

The Game Maker Community is a great place to


64Digits is a very friendly and an easy community
get answers to problems, discuss Game Design
to get into. One can easily craft one’s own niche
and generally see what is happening in the world
into the site. With several games developed spe-
of Game Maker. It does its job in acting as the
cifically for 64Digits, like the LOLOMGWTFBBQ
global center for all Game Maker communities.
series and recent ColumsX, members can get
badges from the games, which makes the com-
munity grow closer and closer.

25 DEV MAG ISSUE 8 2006


Game Maker Showcase Game Maker Games
http://www.gmshowcase.dk http://www.gamemakergames.com

Game Maker Showcase does indeed do what it This is home to greats like Darthlupi (The
says. It is an awesome place to showcase your Cleaner) and Tapeworm (Seiklus). Game Maker
games, since a lot of games get reviewed length- Games is host to a vast archive of Game Maker
ily and quite frequently by the “reviewers”. Its titles! Most of the time, one’s game does not get
forum community seems close-knit – however, reviewed, but it is still a useful place to showcase
this does make it harder for newbies to get in. your work.

Some of the threads (in the off-topic section) are It has a “top-sites” section, which usually falls
legendary and a delight to read. It also seems victim to spammers, but it is still great place to
that it isn’t quite as geared toward game devel- check out the sites of other developers.
oping as other communities are.
TAILPIECE

Its forum community is small and not as active as


A recent event caused the whole site to be Game Maker Community.
remade, and it is still being reconstructed.

GM Clans Game Maker Info


http://www.gmclans.com http://gamemaker.info/nl

This is mostly a forum community built around Although this isn’t a Game Maker community, it’s
the concept of “clans”. While I have only a great place to get all the news from all Game
recently started “lurking” there, it seems quite Maker communities, since it gets an RSS feed off
decent. Members get XP for their games, and all the main communities.
level up according to what they did in a “clan”.

I hope I wasn’t too subjective about all the com-


munities, and I hope I catch you around on one of
these forums sometime!

TR00JG

26 DEV MAG ISSUE 8 2006