Dev - Mag - 05
Dev - Mag - 05
ON THE BACK
GAMEPLAY:
INNOVATION VS FRILL
MOBILE
GAME
DEVELOPMENT
IN JAVA:
PART 3 SAY IT WITH
SPRITES
03 - ED’S NOTE
04 - DIGITAL STOMPIES
FEATURE
05 - I.T INTELLECT LAN
SPOTLIGHT
07 - DION SCHER AND EVAN HURWITZ
REVIEW
08 - PREHYSTERIA
09 - BALL FALL
DESIGN
10 - GAMEPLAY
11 - BACK OF A NAPKIN PART 4: TRANSPARENCY,
TRANSLUCENCY AND BLENDING
13 - POSITIVE AND NEGATIVE FEEDBACK
14 - FUNDAMENTALS OF 3D AND BLENDER
16 - 2D ASSETS WITH 3D SOFTWARE: PART 2
17 - PROJECT MANAGEMENT PART 1
MOBILE
19 - GAME DEVELOPMENT IN JAVA
PART 3: SAY IT WITH SPRITES
TECH
21 - A LITTLE BIT ABOUT COMPUTER MEMORY
SYSTEMS
TAILPIECE
23 - POEM
ED’S NOTE THE TEAM
ENIGMATIC ED
Stuart “GoNz0” Botma
I would first like to take this opportunity to apologize for the lengthy delay
DASTARDLY DEPUTY
that was experienced with the release of our last issue. Due to certain
Rodain “Nandrew” Joubert
errors and problems in the design process, the issue was held back.
DILIGENT DESIGNERS
Now for good news, everyone! From this issue onwards, you can expect a Brandon “CyberNinja” Rajkumar
Paul “Higushi” Myburgh
new issue of Dev.Mag to be released on the last Saturday of every month.
Additionally, and in keeping with tradition, we once again have something
JUBILANT JOURNALISTS
new to offer: This month sees GeometriX joining the team with the
Simon “Tr00jg” de la Rouviere
beginning of his episodic series on project management in game Ricky “Insomniac” Abell
development. William “cairswm” Cairns
Bernard “BurnAbis” Boshoff
Danny “dislekcia” Day
rAge is on the horizon and it has the full attention of the Dev.Mag team
Andre “Fengol” Odendaal
who are preparing for the trip to South Africa’s largest electronic and Yuri “knet” Oyoko
gaming expo. It’s going to be a fun-filled trip where we’ll be pushing Heinrich “Himmler” Rall
Matt “Flint” Benic
Dev.Mag around and discussing its future. I personally can’t wait and I
Luke “Coolhand” Lamothe
hope to see you there.
Greg "Zphyr" Reveret
Geoff "GeometriX" Burrows
WIZARDLY WEBSTER
Claudio “Ch1ppit” de Sa
Editor
Stuart ‘GoNz0’ Botma
WEBSITE
devmag.googlepages.com
main page.
FEATURE
like a scene from Napoleon Dynamite.
The venue was awesome, and it really was a pity that, due to
FEATURE
How long have you been working on the project? When you go live what will you use for subscription
[Dion] We actually had the idea 2 years ago and have been payments?
talking about it on and off for a while. Last year in December I [Evan] Paypal! It’s been available in South Africa for awhile.
decided to start working on it properly and I asked Evan to help
with the documentation and calculations. What technologies are you using in Prehysteria?
[Dion] ASP.NET 1.1, Javascript, SQL Server 2000
What research have you done for Prehysteria?
[Evan] We used our own personal experience from playing Are you going to be looking at any Web 2.0 technologies?
SPOTLIGHT
games like Kings of Chaos, Hell Wars and Darkthrone. [Dion] Not at this moment, it’s not important to the game.
In terms of game-play, what has been your biggest You’ve built an MMO but the inter-player communication is
challenge? How did you overcome it? rather weak (no trading resources, no collaboration except
[Evan] Dion has spent too much time playing as a Game for premium species and no communication with lower
Master in roleplaying games and tends to like hurting players ranked players), are there plans to improve this?
more than necessary. Game balance and fine tuning is our [Dion] We’ve tried to build an office game that only takes a
biggest challenge. couple of minutes a day to play. Collaboration would require
[Dion] We’ve got Evan debugging 100% and writing the help more of the player’s time plus collaboration would make it
file to help players in difficult areas. We also believe team-play difficult for starting players. It also doesn’t fit into the theme of
is very important in our development, and we meet once a the game; species don’t mingle well.
week in official meetings and spend up to 3 hours on the phone
each day discussing ideas and plans. What is your message to other game developers in South
Africa.
Do you belong to any game development communities? [Dion] It’s a good idea to let ideas mature between coding
[Evan] No, but we’re both active gamers and belong to local periods. Breaks are important to let ideas grow. You must
LAN and gaming groups. also have an Outcomes Document so that you know where you
going and can tick off what you’ve finished. It’s very important
Do you think there’s any value in a game development that you finish your product.
community? [Evan] Like Nike, ‘Just Do It!’ Set real deadlines and don’t be
[Dion] Yes and no. While development communities provide afraid to make mistakes.
valuable resources, opinions and good reviews, I worry about
the politics that generally surrounds these groups. I’m also
worried because of the heavy focus of designing into oblivion For more info about the game,
quickly makes things a lot more complex both its advantages and its drawbacks – now!
though, and soon you have to make some balancing issues are still being NANDREW
critical decisions with your limited addressed by the developers, and some
supplies – do you purchase additional chosen lifestyles seem to be more FIND IT!
defences to protect you against that difficult to play than others. However,
http://www.prehysteria.org
annoying, aggressive mammal who this does mean that designers are very
keeps attacking you, or do you enhance much open to feedback on their title,
your breeding capability so that your allowing you to shape
armies can grow quickly enough to further development of
smack him about later? What about the game yourself and
getting a spy network to set up snares even score a few free
and traps for the
next time
someone decides
to stomp over
and take a bite
out of you? Add
REVIEW
The game seems a little daunting and
confusing the first time you play it but in
no time you'll understand what's going
on. Soon, you'll be hooked and will keep
trying to break that elusive 10000-point Overall, it's a polished and great
barrier. The powerups add a lot of depth experience. The menu is simple and
to the gameplay and are activated by effective, and you get a clear
passing over colourful, flower-shaped explanation of the object of the game
objects. Different colours do different and what the different colour powerups
things – for example, red will stop all do. There are also options to turn sound
blocks from falling for a brief period, effects, music and fullscreen mode on or
while blue will create a spiral flame off which is a welcome touch. The
which keeps growing bigger until you background music is a midi version of it's a great game which takes a simple
touch the centre of the flame – the the song Track 2 by Blur and doesn't get concept and executes it well.
bigger the flame is when you do this, the too annoying in the background – but if it Everyone should give it a try.
higher the score bonus you receive. does, then you can easily turn it off. INSOMNIAC
Lets take a basic retro game as an will want to go to Russia! It has an Well, I tried to explain, but I hope by
example: Tetris. amazing unique backtrack done by the now you understand. Developers add
impeccable Yun Kamagi and totally things that do not add to the core
Apart from the Russian music backtrack, awesome graphics."Right, nothing gameplay.
Tetris was insanely addictive. It lived wrong with the above, but here comes
around the core gameplay of fitting the twist. The way to go? If you design games,
blocks neatly into place. That is all. No more isn't always better. If you add
other frills, just good plain addictive "Tetris not only has block fitting galore, something new, think about it. Does it
russian block-fitting! but there is a deep system behind the add to gameplay or is it just frill?
block fitting. Small people known as TR00JG
Now, let's take a modern game ... I am
going to suggest Black and White 2.
Transparency, the first method Translucency and the alpha channel of doom!
Back in the day when people manually blitted their sprites to Hopefully many of you will have heard of the idea of “alpha”.
screen memory (if you’re too young to know what blitting When we talk about textures and transparency, alpha refers to
DESIGN
means, Google can help with that curiosity), they used to pick an extra channel per pixel. We already have red, green and
a specific colour in the sprite and simply not draw anything to blue channels that define the colour of a specific pixel in a
the screen when they encountered that colour. Thus a texture or sprite, if we add another channel to that we can
technique called chroma keying was born! really start doing some funky things.
Nowadays graphics APIs support chroma keying without the The simplest implementation of alpha is single-bit alpha. That
whole manual pixel colour check thing, which to be perfectly means that each pixel has an alpha value of either 1 or 0
honest was a bit annoying to do. However, chroma keying which means it’s either on (visible) or off (not visible). This may
does have a downside in modern applications: Things like sound similar to chroma keying, but the major difference is in
bilinear filtering (remember last month’s texture filtering how the alpha information is used by graphics APIs.
article?) will “blur” individual pixel colours together, so you’ll
end up with the edge pixels in your texture having some of the Before we tell whichever API we’re using (GL, DirectX, or any
chroma colour bled into them, giving you a nasty “halo” around engine that uses either of those) to use a specific texture while
your transparent object. it’s rendering, we can specify a blending operation for it to
perform while it’s using that texture. Essentially blending is all
about controlling the final colour value of a pixel on screen by
multiplying the source colour information (the colour that the
system is trying to make the pixel, gotten from a sprite or
texture) and the destination colour information (the colour that
the screen pixel is already) in all sorts of different ways. The
usual blending operation is to get the final colour on screen by
multiplying the source colour by its alpha value, and adding
the destination colour multiplied by 1 – the source’s alpha.
This gives us something similar to what you get by looking
through a piece of coloured glass: The colour behind the glass
is “let through” by how transparent the glass is, while also
being tinted by the how un-transparent (opaque) the glass is.
This means that an alpha value of 0 doesn’t change the
onscreen colour at all (ie: fully transparent, perfect glass) while
So our final value for F is {0.5, 0.5, 0}, giving us a half-red, effects you can create. Blending is extremely versatile, some
half-green, mucky brown colour. Exactly what you would see if people even use blending to achieve advanced stencil and
you looked through a red glass window at a green field, yay! lighting effects, all it takes is a little thinking outside the box.
T
ypically in games, a small the player already has. Negative feedback system could allow the
advantage can often be turned feedback can also be used to adjust the players that joined later to catch up to
into a big advantage. Such as finding a level of AI to match the players skills. the first few players more easily.
rare Diablo magical item, or having the Negative feedback can sometimes spoil
upper hand in resource gathering in an a game for a player as they may find it A game can implement a handicap
RTS. An advantage like this can often difficult to grow their position in the structure by adjusting the effects of the
help the player get a bigger and bigger game. positive and negative loops on the
advantage in the game. The RTS player various players. Weaker players could
DESIGN
can then build more armies from the New players that play the game for the be given a larger positive multiplier to
extra resources, which results in said first time will often find the use of allow them to compete more easily with
player being able to get a territorial positive feedback an encouragement to better players, or they could be
advantage, and then more resources, playing the game. Their positions in the penalised less for any advantage that
etc. game will quickly improve, thus they achieve. For example, if each
encouraging them to keep playing. soldier a player builds costs twice the
The extra opportunities gained from a Players that already know how to play number of existing soldiers in gold
slight positional advantage in a game is the game will use and positive feedback (negative feedback) a weaker player
called positive feedback. Basically systems to attempt to get an advantage could have each soldier costing only
positive feedback is the process in over the other players, while negative 1.8 times the number of soldiers they
which a small advantage can be feedback will make the game easier to already have.
extended to a bigger and bigger balance between good and bad players
advantage. Positive feedback is both a by not allowing the better player to build By keeping in mind the effect of the
good and a bad design principle to build such a big advantage over the other resource and skill systems on the
into a game. In single player games players. advantages that players can achieve in
positive feedback can be used to allow a game, the system can be adjusted to
the player to quickly build a bigger and Good players will find ways of using ensure balance for all players of the
better position. In multiplayer games its both positive and negative feedback game. Some games require quick
more important to limit positive feedback systems to their own advantage. Both sudden advantages in a player's game
to give everyone a fair chance in the positive and negative feedback systems experience, while other games need to
game. can be used to balance a game. limit the speed in which the teams build
However, it must be remembered that a their strength. Time spent identifying
The opposite of positive feedback is positive feedback system would typically the effects of the positive and negative
negative feedback. Negative feedback is not allow new players to join in a feedback loops in a game will make
used to slow down the speed in which multiplayer game as the first few players that game easier to balance and
players can gain an advantage. For would have an insurmountable therefore more fun for its players.
example the cost of building new units advantage purely from having started CAIRNSWM
could be based on the number of units playing first. The use of a negative
expensive. Blender is a free, open- Looking around (NOT the numbers above the QWERTY
source alternative that is capable of keys) to change to preset views. Press
creating nearly anything that The first step to creating a model is to 7 to change to top view (which is the
professional software can. This tutorial know how to move your view around. default view), 1 to change to front-view,
will teach you how to create 3- The middle mouse button is used and 3 to change to side view. 5 will
dimensional models in Blender. extensively in this process, but if you toggle between perspective and
don’t have one you needn’t worry. The orthogonal view. All of these view
To understand modelling, one must first left mouse button, together with the ALT functions can also be accessed from
understand the basic concepts and key, can serve as a substitute. Hold the view menu under the 3d window.
elements that comprise 3D models. The
most basic unit is a vertex, which is
simply a point in space. Two vertices
form a line, or edge, and three or more
vertices can form a flat plane known as
a face. Multiple faces form solid, 3-
dimensional objects. [More detail on 3D
concepts can be found in our “Napkin”
series - Eds]
DESIGN
will activate rotation mode, which you to wireframe mode, or press Z. This is
can use to spin the object. Rotation can useful when in edit mode.There were a
also be performed on the camera object lot of things to cover in this section, but
and on certain lights, but will have no now you should be aware of all the
effect on the one in your scene. Try basics. You should try using all these
rotating, moving and scaling some features to become acquainted with
objects now, and then press F12 to see their use. You’ll be using them often.
Changing to Edit Mode what effect they had on the render. And that is all for this Blender tutorial.
Next time, we’ll delve into more detail,
If you are using a recent version of In addition to these controls, the camera and learn about lights and materials.
Blender, your view may also contain object can be moved in another, simpler CH1PPIT
coloured arrows. These represent way. By pressing CTRL + ALT + Where to get it?
Blender’s ‘3d transform manipulator’. Numpad 0, the camera will move to the Blender is available for free from www.blender.org.
This tutorial should be correct for most recent
This is just alternate way to manipulate location of the 3d view. While
versions of Blender. The latest available version is
objects and you can safely disable it to manipulating objects as a whole is 2.42, and this tutorial was created with version 2.41
get it out of the way. We won’t be using useful, to create detailed models one
it. Press CTRL+SPACE to remove the must be able to edit the finer details of RECAP - CONTROLS
arrows, or click to hand icon under the an object. While making sure the cube
Middle Mouse Button: Move around. Pan with SHIFT, zoom with CTRL.
3d view. is selected, click the drop down box Right Mouse Button: Select objects.
outline of the cube tells you that it is the vertices of the cube will become visible G: Grab
S: Scale (Resize)
currently selected object. If it is not as pink dots. Whilst in Edit Mode, you
R: Rotate
outlined in pink, you can right-click on it can manipulate each of these vertices TAB: Toggle Edit Mode
to select it. If you hold down SHIFT just as you did with the cube as a Z: Toggle Wireframe Mode
T
o start off, you need a 3D model that you want to use in the shadows on the image. Take a pencil tool, and clean up
your game environment. I made myself this little buggy/ the areas that need clarity [the magic selector can also work in
a pinch, but it's a little more fiddly -- Eds]. When you are done,
it should look something like the image below.
Now we finally get to use our asset in Game Maker. Open
game maker and create your object. Add your new sprite and
assign it to the object. How does it look? Need to redo some
post-editing? Maybe you'd like to render it with a little more
light, or with a different texture? Next month, I'll show you how
to make a fake shadow to go along with your sprite, which is
all done within game maker. And then, in the following month,
we'll start with animated sprites.
HIMMLER
DESIGN
"Projects happen in two ways: a) Planned and then executed or b) Executed, stopped, planned and then
executed."
-Project Management Proverb
should) be managed – from the interface, to the story, to the will not be technical. The primary purpose of this stage is to
voice acting. So, how exactly do you manage a project? decide what your game will be, not how you will build or play
it. Decide the genre of the game, as well as the main feeling
DESIGN
There are hundreds of books written on the subject – each you want the players to experience.
insight into PM as a whole, and give you the tools necessary developing on, and which language or engine you will be
to provide a basic level of management for any game you using. The purpose of this phase is to simply make decisions.
3) Design
Commit yourself to a deadline. This can be difficult if you are
4) Execute
inexperienced, or are attempting something completely
5) Maintain
different to your usual games.
It can be argued that there are a lot of similarities between The important thing to remember is to be realistic – if you
some of the stages. Planning and designing are often thought have studies, work, or other time-impacting duties, then you
of as a single process, but this is far from the truth. should factor those in. If you are building your game with or
for someone else, it is vital to have their input for your
with each step – I ask you to use the tools I provide to either
create a new game, or re-create an old one. By using these Once you have an outline of your project, and feel confident
tools together with your game-building abilities, you will find that you can achieve your deadline with the tools you have
chosen, you can begin the next phase.
Step 2 – Plan
You’ve (hopefully) done everything from step 1, and are now That brings us to the end of part one of project management.
ready to start fleshing out your project. There are many I strongly advise you to complete both stage 1 and stage 2,
theories behind the importance of planning, but it is generally and to not begin any coding or graphic design just yet. In the
accepted that one should spend 70% of their time planning next issue, we will go into the details of the design stage, in
and designing, 20% executing (content creation), and 10% which you will delve a little deeper into the creation of your
refining, polishing and maintaining. This may sound like a game, and will be essentially creating the whole game on
huge waste of time, but it is during this phase that the heart paper.
of your project will take place. GEOMETRIX
T
he first thing we need to do is actually import the Game pack-
//Main MIDlet class
public class TutorialMIDlet extends MIDlet
age, we do this by importing javax.microedition.lcdui.game.* at
{
the top of our source file. ...
}
Now we must make our TutorialCanvas class a GameCanvas sub-
class. To do this we first replace extends Canvas in our class dec- //Canvas class
class TutorialCanvas extends GameCanvas implements Runnable
laration with extends GameCanvas, and then add super(true) as {
...
the first line of our constructor. We do this because GameCanvas
MOBILE
//Constructor
has a boolean parameter in its constructor controlling how input is public TutorialCanvas()
{
handled. We also slightly change the way we handle drawing by super(true);
...
renaming our paint method to doPaint, and replacing the calls to }
repaint and serviceRepaints with calls to doPaint and the Game- //run the game loop
public void run()
Canvas method flushGraphics. As you may have guessed, this {
while(!exit)
automatically makes use of double buffering if the device supports {
...
it. All this changes can be seen (bolded) in Listing 1. //paint everything
doPaint(getGraphics());
flushGraphics();
...
Now we’re going to replace our simple graphics sphere with a }
}
bouncing sprite. We need an image of a ball. I created my 10x10
//paint the canvas
pixel smiley-ball using The Gimp (free from www.gimp.org), so
protected void doPaint(Graphics g)
{
that I could have a transparent background. You can use Windows
...
Paint if you like, but your background will be solid, just be sure to }
}
save it as a .png file called ball.png. Copy that file to the res direc-
tory in your project directory (for example C:\WTK22\apps\Tuto-
rial\res).
In the TutorialCanvas class, we add a Sprite member ballSprite and
in the constructor we assign it a new sprite object initialized with an
Image created from ball.png (notice the leading ‘/’ in the filename)
and set its initial position.
We can also move the ballX and ballY declarations into the game
loop, since the sprite itself can store those values. In the game loop
we modify our bounce code to take the sprite’s size into account
and update the sprite’s position with the setPosition method. Finally
we replace the arc drawing code from the do Paint method with a
call to ballSprite’s paint method. You can see all of these changes
in Listing 2. Img1ResDirectory.bmp: Copy ball.png to your res directory.
//Constructor Until then, there is loads of room to clean up and improve this
public TutorialCanvas() code, and you’re just the game coder to do it!
{
FLINT
...
try
{
ballSprite = new Sprite(Image.createImage
(“/ball.png”));
} catch(Exception e)
{
e.printStackTrace();
}
ballSprite.setPosition(1, 1);
}
{
//update our ball position
int ballX = ballSprite.getX();
if(ballX < 0 ||
ballX + ballSprite.getWidth() > getWidth
())
{
ballVX = -ballVX;
}
ballX += ballVX;
int ballY = ballSprite.getY();
if(ballY < 0 ||
ballY + ballSprite.getHeight() > getHeight
())
{
ballVY = -ballVY;
}
ballY += ballVY;
ballSprite.setPosition(ballX, ballY);
//paint everything
...
}
}
MEMORY TERMS Since all functions in your program share this same local
stack memory, some behind the scenes trickery is necessary
TECH
the kilobyte (KB), which is 1024* bytes long, and the location of the top of the stack. Each time data is stored on
megabyte (MB), which is 1024 kilobytes long. the stack, the stack pointer is moved to be after this new
data.
All data on a computer is stored in its memory. This memory
is separated into two different types: random access Diagram 1:
memory (RAM) and hard disk memory. RAM is used by
currently running programs to store their active data into.
Hard disk memory is used to store more long-term data, like
the programs themselves as well as the data resources that
they need to run with.
RAM
LOCAL STACK
* Although the prefix “kilo” is usually associated with the value 1000, in computer terms it is associated with 1024 as it is considered to be a
10
power of 2 value (ie. 2 ).
variables that are declared outside of the scope of a function The actual method of using the address stored in your
are placed into this memory. These are known as global pointer variable will differ depending on what language you
variables. Secondly, any dynamic memory allocation are programming in. Generally, you will apply an operator to
requests that are made by the program get their memory the variable that will extract or dereference the data from the
from here. pointer, and allow you use it.
The size available for the global heap on most systems is CONCLUSION
regarded to as the amount of available RAM that the
computer has, minus the amount of memory needed for the If you can understand how data is stored in memory and how
local stack, plus any additional virtual memory* that the that memory can be accessed through use of addresses and
operating system memory manager may have. pointers, then you’ve got past one of the most difficult
concepts in the entirety of computer programming. Now you
This makes it quite a bit larger than the local stack, and in have the power to be able to go and start creating much
most cases the amount of global heap memory used by an more complex and advanced game systems and algorithms!
application to store its data will be anywhere from 2 MB to
512 MB. However, keep in mind that using addresses and pointers is
not without its own dangers. It can be very useful to have a
MEMORY ACCESSING value that can by used by anything and at any point of your
program, to either view or modify specific data.
In order to store data, you need to create a variable.
Variables are the simplest form of data structures for use in The downside is that you can easily destroy or overwrite that
computer programming. They generally come in three main data, so be sure to use pointers and addressing carefully and
types: single bytes, multi-byte integers, and multi-byte with responsibility!
floating point values. COOLHAND
* Virtual memory is “simulated” RAM where the operating system memory manager uses hard disk space to store program memory data. It is
usually quite slow to use, as the memory manager has to read and write to the physical hard disk.
** The term came about from the fact that the variable “points” to where in memory your data is located.
Import mind.start.*;
TAILPIECE
for(love = 0; love<infinity; love++)
{
the pleasures of creating
gaming
}
while(above is true)
{
I'll continue
With the
Click click click
Of creating my dreams;
Ideal = true;
}
If(complete == true)
{
Silently close
The completed
Rejoice in personal
reward
To start again
With something more(); //!!!
}
TR00JG