Date post: | 20-Dec-2015 |
Category: |
Documents |
View: | 213 times |
Download: | 0 times |
Mobile GamesMobile Games
Mark GreenMark Green
School of Creative MediaSchool of Creative Media
City University of Hong KongCity University of Hong Kong
IntroductionIntroduction
Mobile games are played on a phone or a Mobile games are played on a phone or a mobile game consolemobile game console
These devices have limited processing These devices have limited processing power, little to no graphics supportpower, little to no graphics support
3D graphics accelerators for mobile 3D graphics accelerators for mobile devices are coming, but they are not devices are coming, but they are not widely available yetwidely available yet
Must design for limited devicesMust design for limited devices
DeviceDevice
Since devices are limited, mainly work with Since devices are limited, mainly work with pre-computed or pre-drawn imagespre-computed or pre-drawn images
Devices don’t have the power to compute Devices don’t have the power to compute images from scratchimages from scratch
This is different from current PC and This is different from current PC and console games, but similar to older console games, but similar to older console and PC gamesconsole and PC games
We can use the same approach as these We can use the same approach as these older gamesolder games
Basic ApproachBasic Approach
Start by looking at the basic design Start by looking at the basic design approach or theoryapproach or theory
Can’t compute images, so start with pre-Can’t compute images, so start with pre-computed images and put them togethercomputed images and put them together
Produce a set of images that can be Produce a set of images that can be combined interactively to produce the combined interactively to produce the game displaygame display
Simple matter of copying images to the Simple matter of copying images to the screenscreen
Basic ApproachBasic Approach
There are two types of images:There are two types of images: Background – form the background for the Background – form the background for the
gamegame Sprite – smaller images that are placed on top Sprite – smaller images that are placed on top
of the background, could be player, enemies of the background, could be player, enemies or game itemsor game items
These images are usually hand drawn, but These images are usually hand drawn, but could be computed from 3D modelscould be computed from 3D models
BackgroundBackground
Background images are usually quite Background images are usually quite large, several times larger than the display large, several times larger than the display screenscreen
To see how this works look at a side To see how this works look at a side scrolling game, one where the player scrolling game, one where the player moves left or right through the game levelmoves left or right through the game level
The background image is one long strip, The background image is one long strip, as the player moves the part of the image as the player moves the part of the image displayed changesdisplayed changes
BackgroundBackground
Draw one image that is the height of the Draw one image that is the height of the screen, and as long as the levelscreen, and as long as the level
Only display part of this image at a time, Only display part of this image at a time, as the player moves right, the displayed as the player moves right, the displayed part of the image moves right as wellpart of the image moves right as well
The background image only scrolls when The background image only scrolls when the player gets close to one of the edgesthe player gets close to one of the edges
BackgroundBackground
BackgroundBackground
The same thing can be done with a maze The same thing can be done with a maze or racing gameor racing game
In this case the background image is In this case the background image is closer to a squarecloser to a square
A display sized portion of the image is A display sized portion of the image is displayed as the player moves around the displayed as the player moves around the game areagame area
BackgroundBackground
Simple games have a single background Simple games have a single background image, but multiple images are possibleimage, but multiple images are possible
Why use multiple layers of background?Why use multiple layers of background? Can be used to produce a 3D like effectCan be used to produce a 3D like effect Can be used to add details to the backgroundCan be used to add details to the background
If we have multiple layers can place If we have multiple layers can place objects in different layers based on their objects in different layers based on their distancedistance
BackgroundBackground
The furthest layer will scroll slowly, while The furthest layer will scroll slowly, while the closest layer will scroll quicklythe closest layer will scroll quickly
This gives a bit of a depth effect, since This gives a bit of a depth effect, since objects close to us move more when we objects close to us move more when we movemove
Multiple layers can also be used for Multiple layers can also be used for details, easier to reuse the detail imagesdetails, easier to reuse the detail images
BackgroundBackground
Produce one large background image and Produce one large background image and several detail images, the detail images several detail images, the detail images can be smallercan be smaller
For example, the background could have For example, the background could have mountains and lakes, while the detail mountains and lakes, while the detail images could have roads and housesimages could have roads and houses
Can use the same detail image at several Can use the same detail image at several places on the backgroundplaces on the background
DetailsDetails
How does this work on different devices?How does this work on different devices? MIDP 1 doesn’t have transparent images, MIDP 1 doesn’t have transparent images,
so one layer backgrounds are the bestso one layer backgrounds are the best The background images can be any size, The background images can be any size,
as long as the phone can handle it, but as long as the phone can handle it, but must be in the PNG formatmust be in the PNG format
The lack of transparency is a major hassle The lack of transparency is a major hassle for MIDP 1 game developmentfor MIDP 1 game development
DetailsDetails
MIDP 2 has transparent images, so it is MIDP 2 has transparent images, so it is easier to do multi layer backgroundseasier to do multi layer backgrounds
Note that MIDP 2 is only available on new Note that MIDP 2 is only available on new phonesphones
Some phone manufacturers have game Some phone manufacturers have game APIs that remove some of the MIDP 1 APIs that remove some of the MIDP 1 restrictions, but this limits your game to restrictions, but this limits your game to one type of phoneone type of phone
DetailsDetails
Gameboy supports up to 4 layers of Gameboy supports up to 4 layers of background in hardwarebackground in hardware
But, it places limits on the size of images, But, it places limits on the size of images, depending on format can be 512x512 or depending on format can be 512x512 or 1024x10241024x1024
Usually need to tile the background, Usually need to tile the background, produce multiple background images and produce multiple background images and switch between themswitch between them
SpritesSprites
Sprites are smaller images, maybe 16x16 Sprites are smaller images, maybe 16x16 or 32x32 that can move around the screenor 32x32 that can move around the screen
Sprites are used for:Sprites are used for: Player characterPlayer character EnemiesEnemies Other charactersOther characters Games itemsGames items Level detailsLevel details
SpritesSprites
After the background is drawn the sprites After the background is drawn the sprites are drawn on top of itare drawn on top of it
The simplest sprite is just an image that The simplest sprite is just an image that has a fixed position within the levelhas a fixed position within the level
Whenever the sprite is visible it is drawn Whenever the sprite is visible it is drawn on the screenon the screen
Used for game items, such as coins, could Used for game items, such as coins, could also be used for bricks that make up a also be used for bricks that make up a levellevel
Character SpritesCharacter Sprites
Character sprites are more complicated, Character sprites are more complicated, since characters can movesince characters can move
Need to have multiple images:Need to have multiple images: Character could face different directions or Character could face different directions or
have different poseshave different poses Animation of the character as it movesAnimation of the character as it moves
The sprite needs to know which of these The sprite needs to know which of these images to display, and how to cycle images to display, and how to cycle through themthrough them
Character SpritesCharacter Sprites
Consider a walking character, need to Consider a walking character, need to have at least 3 images:have at least 3 images: Right foot in front of left footRight foot in front of left foot Both feet togetherBoth feet together Left foot in front of right footLeft foot in front of right foot
If the character can walk in two directions, If the character can walk in two directions, need two sets of these images, one for need two sets of these images, one for each directioneach direction
Character SpritesCharacter Sprites
Character SpritesCharacter Sprites
To produce walking animation we cycle To produce walking animation we cycle through the images, both forwards and through the images, both forwards and backback
More images produce better animation, More images produce better animation, but take more space and timebut take more space and time
Need to be careful when drawing images Need to be careful when drawing images so character doesn’t change size or colour so character doesn’t change size or colour from one image to the nextfrom one image to the next
Character SpritesCharacter Sprites
How do we organize these images?How do we organize these images? Could use a set of separate images, but Could use a set of separate images, but
this causes a number of problemsthis causes a number of problems Need to keep track of all of the images, Need to keep track of all of the images,
and remember to load all of themand remember to load all of them Some formats, such as PNG, have a lot of Some formats, such as PNG, have a lot of
overhead for small images, so this will overhead for small images, so this will waste a lot of spacewaste a lot of space
Character SpritesCharacter Sprites
Filmstrip format: use one large image to Filmstrip format: use one large image to store all of the imagesstore all of the images
Place them one after another in a Place them one after another in a horizontal row, view individual images as horizontal row, view individual images as the frames in a moviethe frames in a movie
Animations are now represented as the Animations are now represented as the set of frames to be displayed in a cycleset of frames to be displayed in a cycle
Character SpritesCharacter Sprites
The data we prepare for each sprite The data we prepare for each sprite includes:includes: The filmstrip imageThe filmstrip image For each pose and animation, the frame For each pose and animation, the frame
numbers to be displayednumbers to be displayed This keeps the art work separate from the This keeps the art work separate from the
program code, easier to manage and program code, easier to manage and organizeorganize
SpritesSprites
Some sprites have behaviour, they do Some sprites have behaviour, they do things in the gamethings in the game
The simplest behaviour is moving, in most The simplest behaviour is moving, in most cases the sprite moves in a straight line cases the sprite moves in a straight line until something interrupts ituntil something interrupts it
Another simple behaviour is collision, Another simple behaviour is collision, occurs when two sprites run into each occurs when two sprites run into each otherother
SpritesSprites
There are usually only a few types of There are usually only a few types of sprites in the game:sprites in the game: Static or game objectsStatic or game objects Player spritePlayer sprite Enemy spriteEnemy sprite
The static sprites are the simplest, they The static sprites are the simplest, they don’t move and only have a few simple don’t move and only have a few simple behavioursbehaviours
SpritesSprites
Static sprites typically have a collision Static sprites typically have a collision behaviour, so players and enemies know behaviour, so players and enemies know when they have run into themwhen they have run into them
In response to a collision the sprite may In response to a collision the sprite may give the player something, a gold coin, give the player something, a gold coin, and they may disappear from the screenand they may disappear from the screen
The player sprite is a bit more The player sprite is a bit more complicated, since it can movecomplicated, since it can move
SpritesSprites
The motion of the player sprite is The motion of the player sprite is controlled by the player, so we don’t need controlled by the player, so we don’t need to worry about thisto worry about this
We still need animations and poses for the We still need animations and poses for the charactercharacter
We will also need to keep track of its We will also need to keep track of its inventory, health and a few other thingsinventory, health and a few other things
SpritesSprites
The enemy sprites are more complex The enemy sprites are more complex since they should have reasonable motionsince they should have reasonable motion
This will need to be programmed, but in This will need to be programmed, but in most cases it will be quite simplemost cases it will be quite simple
For simple games there are only a few For simple games there are only a few types of enemy sprites, the main types of enemy sprites, the main differences are in the images used for differences are in the images used for themthem
DetailsDetails
How are sprites implemented on various How are sprites implemented on various platformsplatforms
In the case of MIDP 1 there is no support In the case of MIDP 1 there is no support for sprites, so we must program it all for sprites, so we must program it all ourselvesourselves
MIDP 1 doesn’t have transparent images, MIDP 1 doesn’t have transparent images, this makes sprites more difficultthis makes sprites more difficult
Copy the sprite images to the screen, a Copy the sprite images to the screen, a rectangular block of pixelsrectangular block of pixels
DetailsDetails
If the character is a rectangle we are okay, If the character is a rectangle we are okay, but otherwise the background won’t show but otherwise the background won’t show throughthrough
There are some tricks that can be played:There are some tricks that can be played: Divide sprite into smaller rectangular imagesDivide sprite into smaller rectangular images Draw the sprite one pixel at a time, this is very Draw the sprite one pixel at a time, this is very
slowslow Need to be careful with sprite designNeed to be careful with sprite design
DetailsDetails
MIDP 2 has transparency, so this isn’t a MIDP 2 has transparency, so this isn’t a problem, a much better platform for game problem, a much better platform for game developmentdevelopment
MIDP 2 also has a Sprite class, which MIDP 2 also has a Sprite class, which handles some of the sprite details:handles some of the sprite details: Draw spriteDraw sprite Simple animation sequenceSimple animation sequence Maintain basic sprite dataMaintain basic sprite data
DetailsDetails
Gameboy has special hardware for Gameboy has special hardware for sprites, don’t need to do as much sprites, don’t need to do as much programmingprogramming
Manages the sprite images and draws Manages the sprite images and draws them in the correct place and orderthem in the correct place and order
Special memory for sprites that gives Special memory for sprites that gives higher performance, but restricts the higher performance, but restricts the number of sprite imagesnumber of sprite images
DetailsDetails
For both MIDP 2 and Gameboy need to For both MIDP 2 and Gameboy need to program the sprite behaviorprogram the sprite behavior
Need to move the sprite, and advance the Need to move the sprite, and advance the frames in the animationframes in the animation
Need to program collision responses and Need to program collision responses and the reaction of the sprite to other objects in the reaction of the sprite to other objects in the gamethe game
Putting it all TogetherPutting it all Together
We now know the basic theory, how do we We now know the basic theory, how do we put it together to make a game?put it together to make a game?
There are two main components:There are two main components: Program codeProgram code ArtArt
We are mainly going to concentrate on the We are mainly going to concentrate on the art, but will also discuss the program codeart, but will also discuss the program code
Separation of ConcernsSeparation of Concerns
Would really like to keep the art and the Would really like to keep the art and the program code separate:program code separate: Usually done by different people, don’t want Usually done by different people, don’t want
them stepping on each other’s toesthem stepping on each other’s toes Use different tools, have a different production Use different tools, have a different production
processprocess Easier to update the program code or artEasier to update the program code or art Easier to add new levels, just download the Easier to add new levels, just download the
art from a serverart from a server
Separation of ConcernsSeparation of Concerns
The Nokia game example doesn’t do a The Nokia game example doesn’t do a good job of this:good job of this: The images are separate files – goodThe images are separate files – good The animations are stored in the program The animations are stored in the program
code- badcode- bad The tile positions are stored in the program The tile positions are stored in the program
code – badcode – bad If we change the sprite or the background If we change the sprite or the background
we need to change the programwe need to change the program
ArtArt
One of the main components is the One of the main components is the images, but also need to store how they images, but also need to store how they are usedare used
Start by looking at backgroundStart by looking at background With a single background image this isn’t With a single background image this isn’t
much of a problem, we really only have much of a problem, we really only have the image file, but need to know the image the image file, but need to know the image file for each levelfile for each level
BackgroundBackground
For a tiled background the situation is For a tiled background the situation is more complicatedmore complicated
We still need to have the image that has We still need to have the image that has the tiles, but we need to know how they the tiles, but we need to know how they are placedare placed
For each layer need to know the size of For each layer need to know the size of the layer, width and height in tiles, also the layer, width and height in tiles, also need to know this size of the tilesneed to know this size of the tiles
For each tile position, the tile to be For each tile position, the tile to be displayed theredisplayed there
BackgroundBackground
In the case of MIDP 2, the image tiles are In the case of MIDP 2, the image tiles are numbered left to right, then top to bottom, numbered left to right, then top to bottom, starting at onestarting at one
Tile number zero is transparentTile number zero is transparent In the Nokia example, this information was In the Nokia example, this information was
stored in an array in the programstored in an array in the program A better solution is to store this information A better solution is to store this information
in an external text filein an external text file
Nokia Image Tiles Nokia Image Tiles
BackgroundBackground
For each level there is a text file, for level For each level there is a text file, for level n the file name could be “leveln”n the file name could be “leveln”
File contains the following information:File contains the following information: Size of background, in tilesSize of background, in tiles Number of layersNumber of layers Image for each layerImage for each layer The size of the tilesThe size of the tiles For each layer the tile displayed in each of its For each layer the tile displayed in each of its
cellscells
BackgroundBackground
If we use a text file, could use something If we use a text file, could use something simple like notepad to construct itsimple like notepad to construct it
Cheap, but not the easiest to useCheap, but not the easiest to use A better approach would be to produce a A better approach would be to produce a
graphical editor for selecting the tiles for graphical editor for selecting the tiles for each layereach layer
This editor would produce the text fileThis editor would produce the text file Could be used to produce several gamesCould be used to produce several games
ArtArt
The next main art component is spritesThe next main art component is sprites This isn’t as easy as the background, need This isn’t as easy as the background, need
to decide how much to includeto decide how much to include The minimum is the images for the sprite The minimum is the images for the sprite
and the animation sequencesand the animation sequences MIDP 2 organizes sprite images similar to MIDP 2 organizes sprite images similar to
tile images, viewed as a set of sub-tile images, viewed as a set of sub-images, all the same sizeimages, all the same size
Nokia Sprite FileNokia Sprite File
SpritesSprites
The sub-images are numbered left to right The sub-images are numbered left to right and top to bottom, in this case the first and top to bottom, in this case the first sub-image is zerosub-image is zero
The animations are given as the sequence The animations are given as the sequence of sub-images to be displayedof sub-images to be displayed
These images will be displayed as a loopThese images will be displayed as a loop In the Nokia example the animations are In the Nokia example the animations are
stored in the program codestored in the program code
SpritesSprites
One solution is to use a text file for each One solution is to use a text file for each spritesprite
An alternative is to have a single file that An alternative is to have a single file that contains the information for all of the contains the information for all of the spritessprites
The minimum information we need is the The minimum information we need is the name of the image file, the tile size, and name of the image file, the tile size, and the animation sequencethe animation sequence
SpritesSprites
The animation sequence has a list of The animation sequence has a list of image numbers, but how do we associate image numbers, but how do we associate this with motion in the program?this with motion in the program?
One way is to give a name to each One way is to give a name to each animation sequence, stored as name animation sequence, stored as name followed by image sequencefollowed by image sequence
Then the program can just gives the name Then the program can just gives the name of the animation it wantsof the animation it wants
SpritesSprites
We usually want to do something with We usually want to do something with spritessprites
We could leave this up to the program, but We could leave this up to the program, but there are a number of things we could do there are a number of things we could do at the art levelat the art level
Example: coins placed in the level, each Example: coins placed in the level, each coin has a simple animation and when coin has a simple animation and when player collides with it, they get a pointplayer collides with it, they get a point
SpritesSprites
All the coins have the same animation and All the coins have the same animation and behavior, the only thing that changes is behavior, the only thing that changes is their positiontheir position
Its easier for the artist to place the coins in Its easier for the artist to place the coins in the level, since they are designing the rest the level, since they are designing the rest of the levelof the level
The programmer can create a coin class The programmer can create a coin class that does the behavior, the artist does the that does the behavior, the artist does the restrest
SpritesSprites
How does this change our text file?How does this change our text file? We still need to have the images and the We still need to have the images and the
animation sequencesanimation sequences We add to this the type of the sprite and We add to this the type of the sprite and
any sprite specific informationany sprite specific information In the case of coins, the only extra In the case of coins, the only extra
information we need is the position of the information we need is the position of the coin within the levelcoin within the level
SpritesSprites
We can do the same sort of thing with We can do the same sort of thing with enemiesenemies
There are only a few types of enemies in There are only a few types of enemies in each game, programmer can produce a each game, programmer can produce a class for each of themclass for each of them
The sprite file entry contains the type of The sprite file entry contains the type of enemy, its name, its initial position within enemy, its name, its initial position within the level, its strength, and number of the level, its strength, and number of points for killing itpoints for killing it
ArtArt
The last thing we need to worry about is The last thing we need to worry about is the player characterthe player character
The player is a sprite, but it’s special since The player is a sprite, but it’s special since it moves from level to levelit moves from level to level
The player may have a choice of several The player may have a choice of several characters when they start the game, so characters when they start the game, so we may need to design several of themwe may need to design several of them
Player CharacterPlayer Character
Each player character can be stored in a Each player character can be stored in a separate file, player selects the one they separate file, player selects the one they want at the beginningwant at the beginning
Each file contains:Each file contains: The name of the image file for the spriteThe name of the image file for the sprite The animations for the spriteThe animations for the sprite The name of the characterThe name of the character The character’s properties: strength, speed, The character’s properties: strength, speed,
etcetc
The Art PackageThe Art Package
So what do we end up with?So what do we end up with? Tile image file for each background layerTile image file for each background layer Sprite image file for each spriteSprite image file for each sprite Background text file for each levelBackground text file for each level Sprite text file for each levelSprite text file for each level Character text file for each player characterCharacter text file for each player character
Note that background layers and sprites Note that background layers and sprites can share image filescan share image files
The Art PackageThe Art Package
tile1tile1 level1level1 spriteImage1spriteImage1 sprites1sprites1 player1player1
tile2tile2 level2level2 spriteImage2spriteImage2 sprites2sprites2 player2player2
tile3tile3 level3level3 spriteImage3spriteImage3 sprites3sprites3 player3player3
tile4tile4 level4level4 spriteImage4spriteImage4 sprites4sprites4
tile5tile5 spriteImage5spriteImage5
tile6tile6 spriteImage6spriteImage6
tile7tile7 spriteImage7spriteImage7
The Art PackageThe Art Package
These are the files we would need for a These are the files we would need for a four level game with three player four level game with three player characterscharacters
We will still need some way of organizing We will still need some way of organizing these files during productionthese files during production
Will probably only deliver one or two levels Will probably only deliver one or two levels at a time over the phone, download levels at a time over the phone, download levels as they are neededas they are needed
Program CodeProgram Code
Take a quick look at the program codeTake a quick look at the program code The program code divides into two parts:The program code divides into two parts:
Generic code used by most games – game Generic code used by most games – game engineengine
Specific code for the game being developedSpecific code for the game being developed Game engine used for multiple games, Game engine used for multiple games,
may be purchased or developed locally, may be purchased or developed locally, reduces development timereduces development time
Game EngineGame Engine
The game engine is responsible for:The game engine is responsible for: Loading game dataLoading game data Network communicationsNetwork communications Background and level managementBackground and level management Basic sprite behaviorBasic sprite behavior
Game engine doesn’t handle game Game engine doesn’t handle game details, otherwise everyone’s game would details, otherwise everyone’s game would be the same!be the same!
SpecificsSpecifics
What does the game programmer do?What does the game programmer do? Programs the sprites used in the game, the Programs the sprites used in the game, the
game specific sprite behaviorgame specific sprite behavior Programs the game rulesPrograms the game rules Handles the specifics of where the game data Handles the specifics of where the game data
is located and networkingis located and networking The programmer makes the game The programmer makes the game
different, provides those extra little details different, provides those extra little details that make the differencethat make the difference
SpecificsSpecifics
It’s a good idea to separate the game It’s a good idea to separate the game engine code from the game specific codeengine code from the game specific code
This simplifies program development, less This simplifies program development, less for the programmer to deal withfor the programmer to deal with
Have a separate file for the game sprites, Have a separate file for the game sprites, programmer responsible for thisprogrammer responsible for this
Small number of places in the game Small number of places in the game engine that can be customizedengine that can be customized
Program CodeProgram Code
So what does the program need to do?So what does the program need to do? Intro screenIntro screen Help screenHelp screen Preferences?Preferences? Load game dataLoad game data Manage backgroundManage background Manage spritesManage sprites Game loopGame loop
UtilityUtility
Standard support stuff needed by all Standard support stuff needed by all gamesgames
Intro screen: name of the game, credits, Intro screen: name of the game, credits, etc displayed while loading game dataetc displayed while loading game data
Character selection screen if there are Character selection screen if there are multiple charactersmultiple characters
New game / saved game screen if we let New game / saved game screen if we let the player save gamesthe player save games
UtilityUtility
Will probably need a help screen, explain Will probably need a help screen, explain how to play the game and the basic ruleshow to play the game and the basic rules
Help screen should be short, point to web Help screen should be short, point to web page where there are more detailspage where there are more details
Might also have a preferences screen, not Might also have a preferences screen, not used by many mobile games, but might be used by many mobile games, but might be necessary for more complex onesnecessary for more complex ones
Load Game DataLoad Game Data
The game will load the data it needs, The game will load the data it needs, hopefully from local fileshopefully from local files
May also need to read saved game data, May also need to read saved game data, while tell us which level to start atwhile tell us which level to start at
May need to load a new level from the May need to load a new level from the network, or check that the player has paid network, or check that the player has paid monthly subscription feemonthly subscription fee
Manage BackgroundManage Background
The game displays the background for the The game displays the background for the current levelcurrent level
May need to scroll the background as the May need to scroll the background as the player movesplayer moves
Try to keep the player close to the center Try to keep the player close to the center of the screenof the screen
If you wait until the reach the edge the If you wait until the reach the edge the player will have too many surprisesplayer will have too many surprises
Manage SpritesManage Sprites
For each sprite need to advance its For each sprite need to advance its animation on each moveanimation on each move
In the case of enemies also need to move In the case of enemies also need to move the sprite and possibly respond to the the sprite and possibly respond to the playerplayer
In the case of treasure, the sprite will give In the case of treasure, the sprite will give the player points and remove itself from the player points and remove itself from the gamethe game
Game LoopGame Loop
This is where most of the action occurs, This is where most of the action occurs, respond to the player’s actionsrespond to the player’s actions
Start by reading the keys, determine what Start by reading the keys, determine what the player wants to dothe player wants to do
Move the player sprite and see what Move the player sprite and see what happens, see if the player collides with the happens, see if the player collides with the background or another spritebackground or another sprite
Game LoopGame Loop
If the player collides with the background, If the player collides with the background, he can’t move to this location, and we he can’t move to this location, and we move him backmove him back
If the player collides with a treasure sprite If the player collides with a treasure sprite we collect the treasurewe collect the treasure
If the player collides with an enemy sprite If the player collides with an enemy sprite we start a fightwe start a fight
Finally advance the player animationFinally advance the player animation
Mark’s Game EngineMark’s Game Engine
I have produced a simple mobile game I have produced a simple mobile game engine for use in this courseengine for use in this course
This will give us the opportunity to see This will give us the opportunity to see how a mobile game engine works, and how a mobile game engine works, and produce some simple gamesproduce some simple games
The game engine is based on separating The game engine is based on separating art from programming, so some games art from programming, so some games can be produced with no programmingcan be produced with no programming
Mark’s Game EngineMark’s Game Engine
The game engine is based on the The game engine is based on the following style:following style: The levels are maze like, think Mario and The levels are maze like, think Mario and
similar gamessimilar games The player moves through the level trying to The player moves through the level trying to
find the exit pointfind the exit point Along the way the player collects treasure and Along the way the player collects treasure and
encounters monstersencounters monsters
Mark’s Game EngineMark’s Game Engine
The game engine and the art work is a The game engine and the art work is a NetBeans projectNetBeans project
Use NetBeans to package the game, Use NetBeans to package the game, produce the .jad and .jar filesproduce the .jad and .jar files
NetBeams also provides an emulator for NetBeams also provides an emulator for testing the gametesting the game
Can also extend the Java code if you likeCan also extend the Java code if you like
ExamplesExamples
Now lets look at how this all worksNow lets look at how this all works We will start by taking the Nokia example We will start by taking the Nokia example
game and putting its art in files instead of game and putting its art in files instead of in the program codein the program code
Since this game really doesn’t do anything Since this game really doesn’t do anything this is relatively easythis is relatively easy
We will start by producing the file for the We will start by producing the file for the player characterplayer character
PlayerPlayer
We already have the image file that We already have the image file that contains the individual images for the contains the individual images for the charactercharacter
We need to construct a text file that We need to construct a text file that describes the character and its animationsdescribes the character and its animations
We will use notepad to construct this file, We will use notepad to construct this file, since it isn’t very longsince it isn’t very long
Player FilePlayer File
Space Bob/images/example_sprite.png24 324left 3 9 10 11right 3 3 4 5up 3 0 1 2down 3 6 7 8
Player FilePlayer File
The first line of this file contains the name The first line of this file contains the name of the characterof the character
The next line contains the name of the file The next line contains the name of the file that has the character imagesthat has the character images
The third line is the size of each of the The third line is the size of each of the sub-images (in pixels)sub-images (in pixels)
The fourth line is the initial pose, or sub-The fourth line is the initial pose, or sub-image used to display the characterimage used to display the character
Player FilePlayer File
There remainder of the file is the There remainder of the file is the character’s animationscharacter’s animations
The first item for each animation is the The first item for each animation is the name of the animationname of the animation
This is followed by the number of frames This is followed by the number of frames in the animationin the animation
The rest of the line has the image The rest of the line has the image numbers for frames in the animationnumbers for frames in the animation
Player FilePlayer File
All player characters are assumed to have All player characters are assumed to have four standard animations:four standard animations: Left Left RightRight UpUp DownDown
These animations are used when the These animations are used when the player moves, other animations are used player moves, other animations are used for special effectsfor special effects
BackgroundBackground
The background file for the level is similar The background file for the level is similar to the character fileto the character file
It is created using notepad and contains It is created using notepad and contains the information for the two layers of the the information for the two layers of the backgroundbackground
This is a larger file, since it also contains This is a larger file, since it also contains the contents of each cell for both layersthe contents of each cell for both layers
BackgroundBackground10 100 0216 315/images/example_tile_palette.png24 350118 118 117 31 31 31 85 46 46 46 31 31 103 31 31 134 28 46 46 46 31 31 103 31 31 31 31 28 46 46 31 31 103 31 31 31 31 134 28 30 31 31 103 31 31 31 31 31 134 31 31 31 103 31 31 31 31 31 31 31 96 96 101 96 96 96 96 96 96 96 31 31 103 31 31 133 31 134 31 31 31 31 104 118 118 118 118 115 130 31 31 31 31 31 31 31 31 133 31 31
BackgroundBackground/images/example_tile_palette.png24 351 0 0 0 127 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 131 0 0 127 0 0 0 0 131 0 0 131 0 127 0 0 0 0 0 0 127 0 127 0 0 0 0 0 0 0 132 127 132 0 0 0 0 0 0 0 0 0 0 0 0 0 0124 124 0 112 0 0 0 0 0 0124 124 0 0 0 0 0 0 0 0 0 124 112 0 0 124 0 0 0 0
BackgroundBackground
The first line of the file contains the size of The first line of the file contains the size of the background in tilesthe background in tiles
In this case we have a 10 x 10 tile levelIn this case we have a 10 x 10 tile level The next line is the start position for the The next line is the start position for the
level, this is the (x, y) position, in pixels level, this is the (x, y) position, in pixels where the player character startswhere the player character starts
The third line contains the end point of the The third line contains the end point of the level, the pixel coordinates of the place the level, the pixel coordinates of the place the player is trying to get toplayer is trying to get to
BackgroundBackground
This header information is followed by This header information is followed by information for each background layerinformation for each background layer
There can be any number of background There can be any number of background layerslayers
The first set of background lines is for the The first set of background lines is for the bottom layer of the backgroundbottom layer of the background
It starts with the name of the image file It starts with the name of the image file followed by the size of the individual tile followed by the size of the individual tile images, in this case 24 x 35 pixelsimages, in this case 24 x 35 pixels
BackgroundBackground
The next line contains a collision flag, if The next line contains a collision flag, if the value of this flag is 0 no collision the value of this flag is 0 no collision detection is done on the layerdetection is done on the layer
The next 10 lines are the contents of the The next 10 lines are the contents of the layers cellslayers cells
Note that there are 10 lines of 10 cellsNote that there are 10 lines of 10 cells the second layer is basically the same, the second layer is basically the same,
except its collision flag is 1, so collision except its collision flag is 1, so collision detection will be done on this layerdetection will be done on this layer
PackagingPackaging
We need to put these files together with We need to put these files together with the game engine to produce a gamethe game engine to produce a game
This is done in NetBeansThis is done in NetBeans Create a new NetBeans project, make Create a new NetBeans project, make
sure to select CLDC 1 and MIDP 2, using sure to select CLDC 1 and MIDP 2, using the game engine source codethe game engine source code
Add your files to the data folder and then Add your files to the data folder and then run the projectrun the project
PackagingPackaging
PackagingPackaging
ExampleExample
Other MediaOther Media
So far life has been easy So far life has been easy Most modern phones support MIDP 2 Most modern phones support MIDP 2
graphics, so what we have done so far graphics, so what we have done so far should work on most phonesshould work on most phones
For other types of media and services the For other types of media and services the situation is quite differentsituation is quite different
There are no standards and things tend to There are no standards and things tend to vary from one phone to the nextvary from one phone to the next
SoundSound
Sound is one area where things can vary a Sound is one area where things can vary a lot, the possibilities include:lot, the possibilities include: Simple tonesSimple tones Tone sequencesTone sequences MIDIMIDI Sampled sounds (WAV or MP3 files)Sampled sounds (WAV or MP3 files)
Can’t predict what a particular phone will Can’t predict what a particular phone will be able to handle, need to check at run-be able to handle, need to check at run-timetime
SoundSound
There are two main solutions to this There are two main solutions to this problem:problem: Use the most primitive format, likely available Use the most primitive format, likely available
on all phoneson all phones Use the best possible format, produce the Use the best possible format, produce the
best possible sound on a given phonebest possible sound on a given phone The first alternative is the easiest choice, The first alternative is the easiest choice,
only need to produce one version of the only need to produce one version of the sound contentsound content
SoundSound
Unfortunately we don’t take advantage of Unfortunately we don’t take advantage of the features of better phonesthe features of better phones
Game will not sound better on better Game will not sound better on better phonesphones
If we take the second alternative will need If we take the second alternative will need to produce several versions of the sound to produce several versions of the sound content, one for each possible formatcontent, one for each possible format
Better sound, but much more workBetter sound, but much more work
Simple TonesSimple Tones
This should be supported by all phonesThis should be supported by all phones Plays a single note at a time, procedure Plays a single note at a time, procedure
must be called for each notemust be called for each note Somewhat similar to MIDI, give a note Somewhat similar to MIDI, give a note
number, length (in milliseconds) and number, length (in milliseconds) and volume (percentage of full volume)volume (percentage of full volume)
Have no control over the sound that is Have no control over the sound that is played, each phone could be differentplayed, each phone could be different
Simple ToneSimple Tone
Hard to play a song, would need to Hard to play a song, would need to program each noteprogram each note
Better for sound effects, play a tone when Better for sound effects, play a tone when something occurs in the gamesomething occurs in the game CollisionCollision Hit by enemyHit by enemy Hit the enemyHit the enemy
Could be specified with player art workCould be specified with player art work
Tone SequenceTone Sequence
Ability to play a sequence of tonesAbility to play a sequence of tones Only one tone at a time, and no control Only one tone at a time, and no control
over the instrument that plays the toneover the instrument that plays the tone For each note can give the pitch and For each note can give the pitch and
length, volume events used to set the length, volume events used to set the volume of following tonesvolume of following tones
Can be viewed as a simplified version of Can be viewed as a simplified version of MIDIMIDI
Tone SequenceTone Sequence
Represented by an array of bytes, a Represented by an array of bytes, a numerical representation of the tone numerical representation of the tone sequencesequence
Array can be stored in program, or it can Array can be stored in program, or it can be stored in a filebe stored in a file
Don’t know of any programs that can be Don’t know of any programs that can be used to construct this file formatused to construct this file format
Not that easy to work withNot that easy to work with
Tone SequenceTone Sequence
Could be used for background musicCould be used for background music Could be able to play a tone while a tone Could be able to play a tone while a tone
sequence is playing, depends on phonesequence is playing, depends on phone Could also be used to signal events in a Could also be used to signal events in a
gamegame Tone sequence files could be part of the Tone sequence files could be part of the
art work, attached to levels or possibly the art work, attached to levels or possibly the player characterplayer character
MIDIMIDI
This is probably supported by more This is probably supported by more expensive phones that already use MIDI expensive phones that already use MIDI for ring tonesfor ring tones
This gives us more control over the This gives us more control over the sounds, can control the instrumentsounds, can control the instrument
Can also have multiple notes playing at Can also have multiple notes playing at the same timethe same time
Possible to mix several MIDI piecesPossible to mix several MIDI pieces
MIDIMIDI
There are two ways that MIDI can be There are two ways that MIDI can be used:used: Use a standard MIDI file, of most interest to Use a standard MIDI file, of most interest to
usus Send individual MIDI events under program Send individual MIDI events under program
controlcontrol For file playback can control the pitch, For file playback can control the pitch,
volume and rate of playback on some volume and rate of playback on some phonesphones
MIDIMIDI
In the case of pitch and rate control, can’t In the case of pitch and rate control, can’t control the absolute pitch or ratecontrol the absolute pitch or rate
Instead specify a percentage increase or Instead specify a percentage increase or decreasedecrease
This can be used to increase the pitch and This can be used to increase the pitch and tempo as the player moves through the tempo as the player moves through the level, increase the level of excitementlevel, increase the level of excitement
MIDIMIDI
Can be used for background music and to Can be used for background music and to signal eventssignal events
Can use standard MIDI editors to create Can use standard MIDI editors to create content and then include them in the game content and then include them in the game JAR fileJAR file
Easier to author than tone sequences, and Easier to author than tone sequences, and produce a much better soundproduce a much better sound
Can be attached to any game graphicsCan be attached to any game graphics
Sampled SoundsSampled Sounds
Produces the best quality sound, but only Produces the best quality sound, but only supported on more recent high end supported on more recent high end phonesphones
Can be wav or MP3 filesCan be wav or MP3 files Could be possible to mix several files to Could be possible to mix several files to
play at the same timeplay at the same time Main problem is the size of the files, this Main problem is the size of the files, this
can be very expensive to downloadcan be very expensive to download
Sampled SoundsSampled Sounds
Can control the pitch and rate of playback Can control the pitch and rate of playback in the same way as MIDI soundsin the same way as MIDI sounds
Can also control the volume during Can also control the volume during playbackplayback
Can only be stored in a separate file, really Can only be stored in a separate file, really can’t generate in the game engine itself, can’t generate in the game engine itself, not enough processing powernot enough processing power
Sample SoundsSample Sounds
Probably don’t want to use as background Probably don’t want to use as background music, too largemusic, too large
Can be used to signal events, much Can be used to signal events, much shorter fileshorter file
Can use standard sound editing program Can use standard sound editing program to create sound filesto create sound files
Can attach to player character or possibly Can attach to player character or possibly spritessprites
Game EngineGame Engine
How does the game engine handle How does the game engine handle sounds?sounds?
It first needs to determine which sound It first needs to determine which sound formats are supported by the phoneformats are supported by the phone
If the art work has multiple sound formats If the art work has multiple sound formats it will choose the best sound format that it will choose the best sound format that the phone will supportthe phone will support
Lots of extra program code!Lots of extra program code!
PackagingPackaging
This is an important considerationThis is an important consideration If our game supports multiple sound If our game supports multiple sound
formats do we put all the sound content in formats do we put all the sound content in the same JAR file?the same JAR file?
Everything in one file is the easiest to Everything in one file is the easiest to produce, game engine can determine produce, game engine can determine format when it runs on the phoneformat when it runs on the phone
Will always make the correct sound format Will always make the correct sound format choicechoice
PackagingPackaging
But this requires extra space:But this requires extra space: Costs more to download the gameCosts more to download the game Needs more room on phone, may prevent Needs more room on phone, may prevent
download on some phonesdownload on some phones Since each phone will only use part of the Since each phone will only use part of the
content makes sense to only include what content makes sense to only include what it needsit needs
Better use of bandwidth and memoryBetter use of bandwidth and memory
PackagingPackaging
But how do we know what to include?But how do we know what to include? Two possible approachesTwo possible approaches Download the sound content after Download the sound content after
determining the formats supported by the determining the formats supported by the phonephone
Small initial download, opportunity for Small initial download, opportunity for additional revenue from network usageadditional revenue from network usage
PackagingPackaging
Determine the sound formats supported by Determine the sound formats supported by each type of phoneeach type of phone
When JAR file is requested, provide the When JAR file is requested, provide the one that matches the phoneone that matches the phone
Good results with minimal use of Good results with minimal use of bandwidthbandwidth
But, most test each possible phoneBut, most test each possible phone Need a fallback for new or unknown Need a fallback for new or unknown
phonesphones
Sound CaptureSound Capture
Since phones have microphones it should Since phones have microphones it should be possible to capture soundbe possible to capture sound
This is supported on some phones, but This is supported on some phones, but doesn’t appear to be commondoesn’t appear to be common
Could be used to capture custom sounds Could be used to capture custom sounds for a gamefor a game
Send captured sound to other players in a Send captured sound to other players in a networked gamenetworked game
VideoVideo
Video playback is supported on some Video playback is supported on some phones, mainly 3Gphones, mainly 3G
Could be used in games, same way as PC Could be used in games, same way as PC and platform gamesand platform games
Main problem is file size, not enough Main problem is file size, not enough storage on most phones and cost of storage on most phones and cost of downloaddownload
Could use external memory cardCould use external memory card
VideoVideo
Another possibility would be to stream the Another possibility would be to stream the video to the phonevideo to the phone
3G networks are good at this, so it could 3G networks are good at this, so it could be economically feasiblebe economically feasible
Could add extra interest to the game, Could add extra interest to the game, videos could change on a daily basis, videos could change on a daily basis, feature top playersfeature top players
Could be location based, videos change Could be location based, videos change as you move through the cityas you move through the city
VideoVideo
Video and still capture might be more Video and still capture might be more interestinginteresting
Capture still image of player and put it in Capture still image of player and put it in the gamethe game
Capture video clip to send to other playersCapture video clip to send to other players Still capture seems to be the most Still capture seems to be the most
practical, since it involves less memory practical, since it involves less memory and processingand processing
VideoVideo
Video could also be used as part of the Video could also be used as part of the interactioninteraction
Use simple image processing to detect Use simple image processing to detect movement or objects in the scenemovement or objects in the scene
Could be used as another form of game Could be used as another form of game controller, or a way of interacting with the controller, or a way of interacting with the gamegame
Video and SoundVideo and Sound
I haven’t seen video and sound capture I haven’t seen video and sound capture used in a mobile gameused in a mobile game
There might be some interesting things There might be some interesting things that could be done with this, a new game that could be done with this, a new game genregenre
Could have a video scavenger hunt, take Could have a video scavenger hunt, take pictures of target objects, first one to have pictures of target objects, first one to have a complete set winsa complete set wins
Video and SoundVideo and Sound
Could have a tag or shooting gameCould have a tag or shooting game Take picture of all the members of the Take picture of all the members of the
other team before they take pictures of other team before they take pictures of youyou
A lot of possibilities, try to take advantage A lot of possibilities, try to take advantage of groups of people and short play timeof groups of people and short play time
Could also be used for dating and match Could also be used for dating and match making gamesmaking games
CLDC 1.1CLDC 1.1
Most phones are CLDC 1, defines the Most phones are CLDC 1, defines the version of Java used on the phoneversion of Java used on the phone
CLDC only has integer arithmetic, aimed CLDC only has integer arithmetic, aimed at current generation of phones with at current generation of phones with limited processorslimited processors
CLDC 1.1 supports floating point CLDC 1.1 supports floating point arithmetic, aimed at next generation of arithmetic, aimed at next generation of phones with better processorsphones with better processors
CLDC 1.1CLDC 1.1
Some of the things that we would like to Some of the things that we would like to do are only supported in CLDC 1.1do are only supported in CLDC 1.1 3D graphics3D graphics Location based gamesLocation based games
This will become more popular in the This will become more popular in the future, so worth taking a look at nowfuture, so worth taking a look at now
3D Graphics3D Graphics
This could make mobile games more This could make mobile games more interesting, but really isn’t possible on interesting, but really isn’t possible on today’s phonestoday’s phones
Working on mobile graphics chips, some Working on mobile graphics chips, some are available now that support 3D graphicsare available now that support 3D graphics
Will start appearing in phones over the Will start appearing in phones over the next few yearsnext few years
Will be common within 5 years, maybe Will be common within 5 years, maybe soonersooner
OpenGL ESOpenGL ES
A version of OpenGL for mobile devices, A version of OpenGL for mobile devices, both phones and PDAsboth phones and PDAs
A subset of OpenGL that is easier to A subset of OpenGL that is easier to implement on small devicesimplement on small devices
Since many 3D games use OpenGL, this Since many 3D games use OpenGL, this could open the door to 3D games on could open the door to 3D games on mobile phonesmobile phones
There is an integer only subset, could be There is an integer only subset, could be put on current phonesput on current phones
OpenGL ESOpenGL ES
There are versions of OpenGL ES for There are versions of OpenGL ES for PDAs, I’ve used one of themPDAs, I’ve used one of them
I haven’t seen it on a production mobile I haven’t seen it on a production mobile phone yet, but I’ve seen demosphone yet, but I’ve seen demos
Has the advantage of being well known, Has the advantage of being well known, large number of programmers know large number of programmers know OpenGLOpenGL
Could even port some existing gamesCould even port some existing games
3D Graphics3D Graphics
Two versions of 3D graphics for Java on Two versions of 3D graphics for Java on mobile phonesmobile phones
Version of OpenGL ES for Java, provides Version of OpenGL ES for Java, provides interface to OpenGL ES for Java programsinterface to OpenGL ES for Java programs
Not clear how widely this will be Not clear how widely this will be implemented, since it clashes with other implemented, since it clashes with other Java standardsJava standards
Could be done on CLDC 1Could be done on CLDC 1
3D Graphics3D Graphics
In the past there has been some conflict In the past there has been some conflict between the Java community and the between the Java community and the OpenGL communityOpenGL community
A pure OpenGL ES implementation in A pure OpenGL ES implementation in Java may not be popularJava may not be popular
There are also some performance issues There are also some performance issues as well, since Java on phones isn’t fastas well, since Java on phones isn’t fast
Mobile 3D GraphicsMobile 3D Graphics
One of the main problems with Java is One of the main problems with Java is lack of speedlack of speed
In C or C++ can use a large number of In C or C++ can use a large number of calls to graphics package, not a calls to graphics package, not a performance problemperformance problem
A call for each vertex of each object is A call for each vertex of each object is okayokay
Can easily modify geometry from one Can easily modify geometry from one frame to the nextframe to the next
Mobile 3D GraphicsMobile 3D Graphics
This is what gives good smooth animation This is what gives good smooth animation in most 3D gamesin most 3D games
Can tweak the motion frame by frame to Can tweak the motion frame by frame to give the best resultgive the best result
This is hard to do in Java because of its This is hard to do in Java because of its performance, calls to the graphics performance, calls to the graphics package are much slowerpackage are much slower
This would greatly restrict the size of the This would greatly restrict the size of the models that can be usedmodels that can be used
Mobile 3D GraphicsMobile 3D Graphics
The proposed solution is to do most of the The proposed solution is to do most of the graphics underneath Java, can then use graphics underneath Java, can then use more efficient languagesmore efficient languages
Pass the graphical information to this Pass the graphical information to this lower level to manage and displaylower level to manage and display
The Java program just handles the higher The Java program just handles the higher level detailslevel details
This give adequate performance at a priceThis give adequate performance at a price
Mobile 3D GraphicsMobile 3D Graphics
The Java 3D API uses a scene graph, a The Java 3D API uses a scene graph, a high level representation of the graphical high level representation of the graphical informationinformation
This is a standard graphics techniqueThis is a standard graphics technique The Java program constructs the scene The Java program constructs the scene
graph and then passes it to the lower level graph and then passes it to the lower level for displayfor display
Tries not to change the scene graph after Tries not to change the scene graph after it is constructedit is constructed
Mobile 3D GraphicsMobile 3D Graphics
This results in good performance, scene This results in good performance, scene graph display handled efficiently at lower graph display handled efficiently at lower levellevel
But, if we change the scene graph we are But, if we change the scene graph we are back to our original problemback to our original problem
So, if nothing moves we are okaySo, if nothing moves we are okay This might be okay for some applications, This might be okay for some applications,
like eCommerce, but doesn’t work for like eCommerce, but doesn’t work for gamesgames
Mobile 3D GraphicsMobile 3D Graphics
One solution to this problem is to only One solution to this problem is to only change the transformations in the scene change the transformations in the scene graphgraph
This is a small amount of data that only This is a small amount of data that only effects a small part of the scene grapheffects a small part of the scene graph
This gives the ability to do rigid motion This gives the ability to do rigid motion efficiently, but still doesn’t have the best efficiently, but still doesn’t have the best qualityquality
Mobile 3D GraphicsMobile 3D Graphics
There is also the ability to do skinned There is also the ability to do skinned meshesmeshes
This can give better looking animations, This can give better looking animations, but the Java program needs to do more but the Java program needs to do more work for thiswork for this
There is also a special file format for the There is also a special file format for the mobile 3D graphics packagemobile 3D graphics package
I don’t know of any modeling programs I don’t know of any modeling programs that produces this formatthat produces this format
Mobile 3D GraphicsMobile 3D Graphics
I don’t know whether this approach will be I don’t know whether this approach will be successfulsuccessful
3D graphics on PCs and consoles is quite 3D graphics on PCs and consoles is quite good and improvinggood and improving
3D graphics for phones will not be near as 3D graphics for phones will not be near as good, and may not be acceptable to good, and may not be acceptable to consumersconsumers
The quality difference might be too largeThe quality difference might be too large
Mobile 3D GraphicsMobile 3D Graphics
In addition, there are no modeling tools In addition, there are no modeling tools that support the file formatthat support the file format
Hard to get good content if we must rely Hard to get good content if we must rely on programmers to produce all the models on programmers to produce all the models and animationsand animations
Might be better to stick to 2D graphics and Might be better to stick to 2D graphics and do a good job of it, produce better quality do a good job of it, produce better quality gamesgames
Location Based ServicesLocation Based Services
Mobile phones know where they are, or at Mobile phones know where they are, or at least the phone company knows where least the phone company knows where they arethey are
Talk of location based services for many Talk of location based services for many years, but I don’t know of anyyears, but I don’t know of any
GPS receivers are available for PDAs and GPS receivers are available for PDAs and map based services have been developed map based services have been developed for them, becoming a popular addition for them, becoming a popular addition
Location Based ServicesLocation Based Services
A J2ME API for determining location has A J2ME API for determining location has been proposedbeen proposed
Based on CLDC 1.1, so won’t work on Based on CLDC 1.1, so won’t work on most existing phonesmost existing phones
This API gives the longitude and latitude of This API gives the longitude and latitude of the phone, in some cases it can also give the phone, in some cases it can also give the altitudethe altitude
Need to convert this into something usefulNeed to convert this into something useful
Location Based ServicesLocation Based Services
Need to know the latitude and longitude of Need to know the latitude and longitude of interesting placesinteresting places
One way of doing this is to store the One way of doing this is to store the location information of important location information of important landmarks on the phonelandmarks on the phone
This could be downloaded from the This could be downloaded from the service providerservice provider
Could also get this from web sites that Could also get this from web sites that provide a location serviceprovide a location service
Location Based ServicesLocation Based Services
Given the phone’s location, need to search Given the phone’s location, need to search through the list of known locations to find through the list of known locations to find where we really arewhere we really are
The phone’s location can be updated The phone’s location can be updated every few minutes, so this must be every few minutes, so this must be efficientefficient
Now we need to think about how this Now we need to think about how this information could be usedinformation could be used
Location Based ServicesLocation Based Services
Suggested uses include advertising, Suggested uses include advertising, locating children, mapslocating children, maps
How could this be used in games?How could this be used in games? Game content or play needs to depend Game content or play needs to depend
upon locationupon location Content is hard to produce, so its unlikely Content is hard to produce, so its unlikely
that content will depend upon location, that content will depend upon location, need to concentrate on game playneed to concentrate on game play
Location Based ServicesLocation Based Services
Other player’s locations is important in the Other player’s locations is important in the game:game: Hide and seekHide and seek TagTag Spy gamesSpy games Assassination, or crime gamesAssassination, or crime games Scavenger and treasure huntsScavenger and treasure hunts
If we get close enough to a particular If we get close enough to a particular location we receive some points or awardslocation we receive some points or awards
Location Based GamesLocation Based Games
I have not seen this used in mobile phone I have not seen this used in mobile phone games, but I have seen a tag game for games, but I have seen a tag game for PDAsPDAs
This could produce a new game genreThis could produce a new game genre Look for something that can be played Look for something that can be played
quickly and involves a considerable quickly and involves a considerable amount of actionamount of action
Could be good exerciseCould be good exercise
SummarySummary
Easy to develop mobile games with just Easy to develop mobile games with just 2D graphics, will work on most newer 2D graphics, will work on most newer phonesphones
After that life gets more complicated, After that life gets more complicated, features vary from phone to phonefeatures vary from phone to phone
Hard to produce a game that will run well Hard to produce a game that will run well on all phoneson all phones
Need to develop different versions, control Need to develop different versions, control how content is deliveredhow content is delivered
FutureFuture
Things could get better in the future, more Things could get better in the future, more standardization, easier to produce games standardization, easier to produce games for a wide range of phonesfor a wide range of phones
Some interest in doing this:Some interest in doing this: Easier for game developers, will produce Easier for game developers, will produce
more content for phonesmore content for phones Selling point for phones, a new phone will Selling point for phones, a new phone will
already have contentalready have content
FutureFuture
If games become a major money maker If games become a major money maker there may be pressure to develop special there may be pressure to develop special feature for each phonefeature for each phone
Similar to game consoles, want to have Similar to game consoles, want to have better graphics and sound than the better graphics and sound than the competitorscompetitors
This could make development harder in This could make development harder in the futurethe future