Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
Mobile Game Development

Mobile Game Development

|Views: 441|Likes:
Published by fasi425
Simple Mobile Game Development procedure. It's just basic.
Simple Mobile Game Development procedure. It's just basic.

More info:

Published by: fasi425 on Jan 16, 2010
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less





This article is the first part in my Mobile Game Programing for Beginners series. Theseries start out with a super-simple game but will continue to show how to implement avariety of different game types and the techniques used to code them.The series is a four part series where I'll go through the following games:
Top Down Scroller 
3D Space GameThis part will show you how to implement a very simple game, which tools you'll needand how to actually try it out on your handset.In this game, the goal is to navigate your avatar to a target, no obstacles and the targetisn't even moving. There's no way to "die", no way to loose, but it's a good starting pointto show the basics of game programming. The areas I'll cover in this first part are:
Tools of the Trade, the applications required (or at least the ones I like to use).
Creating a MIDlet, an application that can run on your mobile phone.
Basic Game Loop, the foundation of any game.
Reading user input.
Tools of the Trade
All the games in this series have been developed using three software packages:
Java 6 SDK 
Java 6 SDK 
The Java SDK (or JDK, Java Development Kit) is a collection of class libaries, tools anddocumentation used when developing Java applications. It is not to be confused with aJRE, Java Runtime Environment, which is something that is used to run Java basedapplication. I downloaded my JDK fromhere.You'll need a JDK installed to use the next tool on the list, NetBeans, so make sure this is the first thing you download.
 NetBeans is an Integrated Development Environment, IDE, mainly for Java development.It is free, which is good, but the best thing about it is that it truly rocks. According to meit's by far the best Java IDE around right now. NetBeans is the tool that you'll use to implement and test your game as it comes bundleswith a neat emulator so that you don't have to install the game on your mobile phone before you know it works.Gohere and download the
pack and get that installed. The
pack includes the
JDK (Java 2 Mobile Edition), which contains the class librariesrequired to write a MIDlet (which is a java application that can run on a mobile device),and the tools required (such as emulators for testing the game without having to install iton an actual handset).
Almost all games needs some sort of graphics to make them enjoyable, I prefer to usePaint.NET to create the graphics for my games (when it's not generated by the gameitself, but more on that in the second part of the series). The reason I'm not using Paintthat comes bundles with windows is that it's simply not packed with all the nice featuresthat Paint.NET have, such as support for transparent png files.Head on over to Paint.NET'sdownload pageand download it.Once you have these three tools installed you're almost ready to start coding.
Basic Game Loop
Almost all games rely on a central
 game loop
, it is the loop that manages or control thegame. As the games you write become more and more complicated the methods calledfrom the game loop will have to contain more and more logic, but the actual game loopwill still be a fairly simple loop. In its simplest form it might look something like this:Collapse
while(gameShouldStillBeRunning) {// Capture inputreadInput(); // Update the game stateupdateGameState(); // Present the game to the user, i. e. render or draw it to screenrenderGameState();// Check for game overcheckGameState();} 
Reading Input
This method is responsible for reading or capturing the current state of the input. Thisincludes for example checking which keys are pressed and how far the mouse has movedsince last check. The method typically stores the input that is relevant to the game in a place where the
method can access it.Storing the game state can be as easy as setting a boolean value to
if a key is pressedand to
it it's not pressed. The reason for checking the input and storing it first,instead of checking it when you actually need it (i.e when updating the game state), is because it is often quite expensive CPU wise to read the input and it is best to get all theinput required at once. Otherwise different parts of the code that updates the game statemight query the OS several times for the same key input, which would be unecessary.Making the games run smooth and fast is a major part of game development and I willdiscuss this in a later part of this series.You'll notice that the game included in this article doesn't read the input state in the gameloop, that is because it's relying on a built in functionality of the
, more on this later.
Update Game State
Updating the game state include all the actual processing of the game logic, such asmoving the players character according to the input captured, moving enemies according

Activity (21)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
jocansino4496 liked this
Lebnan Nader liked this
Hitesh Chavan liked this
Sreecharan99 liked this
mcwong644 liked this
theblessed liked this
love2390 liked this
Yuli Aria Winata liked this

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->