Upload
alfred-drye
View
214
Download
0
Tags:
Embed Size (px)
Citation preview
Game BoyGame Boy
Mark GreenMark Green
School of Creative MediaSchool of Creative Media
City University of Hong KongCity University of Hong Kong
IntroductionIntroduction
Probably the most successful console:Probably the most successful console: Largest number of salesLargest number of sales Longest lifeLongest life
Basically owns the mobile game console Basically owns the mobile game console market, even Sony is having a hard time market, even Sony is having a hard time competing against itcompeting against it
Sega was knocked out of the market, Sega was knocked out of the market, Nokia hasn’t made much progressNokia hasn’t made much progress
IntroductionIntroduction
Despite its size, Game Boy has all of the Despite its size, Game Boy has all of the characteristics of larger game consolescharacteristics of larger game consoles
Technology isn’t as advanced, one or two Technology isn’t as advanced, one or two generations behindgenerations behind
But, game development, marketing, But, game development, marketing, production and other aspects are all the production and other aspects are all the samesame
Good case study for mobile games and Good case study for mobile games and consolesconsoles
IntroductionIntroduction
There are two main differences between There are two main differences between the Game Boy and other consoles:the Game Boy and other consoles: We know a lot about the Game Boy internals, We know a lot about the Game Boy internals,
the hardware used and how it can be the hardware used and how it can be programmedprogrammed
There are a number of free and inexpensive There are a number of free and inexpensive tools that can be used to develop Game Boy tools that can be used to develop Game Boy gamesgames
Ideal place to learn console game Ideal place to learn console game developmentdevelopment
Console GamesConsole Games
Console game development is different Console game development is different from PC games, not a lot of companies do from PC games, not a lot of companies do bothboth
Consoles are designed to be cheap, a Consoles are designed to be cheap, a small savings on one unit means a lot small savings on one unit means a lot when you are making millionswhen you are making millions
Try to do clever engineering to reduce Try to do clever engineering to reduce costs, don’t care if its easy to programcosts, don’t care if its easy to program
Console GamesConsole Games
Consoles can’t be upgraded, no changes Consoles can’t be upgraded, no changes to:to: ProcessorProcessor GraphicsGraphics SoundSound
A console has a 3 to 5 year life timeA console has a 3 to 5 year life time Must be better than a PC when first Must be better than a PC when first
released, otherwise it will date very quicklyreleased, otherwise it will date very quickly
Console GamesConsole Games
Engineers do a lot of tricks to make things Engineers do a lot of tricks to make things look better and run fasterlook better and run faster
Want to have a range of features that give Want to have a range of features that give WOW to the consoleWOW to the console
Extend the life of the consoleExtend the life of the console Result: hardware is not well organized, Result: hardware is not well organized,
may not be easy to use or programmay not be easy to use or program A lot of tricks to learnA lot of tricks to learn
Console Game DevelopmentConsole Game Development
Different consoles are quite differentDifferent consoles are quite different Often need to redevelop most of a game Often need to redevelop most of a game
when it moves from one console to when it moves from one console to anotheranother Program code will be quite differentProgram code will be quite different Art work may also be differentArt work may also be different
Also need to retrain developers when they Also need to retrain developers when they move from one console to another!move from one console to another!
Console Game DevelopmentConsole Game Development
Develop on one platform and test on Develop on one platform and test on anotheranother
Emulators can help find program bugs, but Emulators can help find program bugs, but the don’t give the same experience:the don’t give the same experience: Differences in processor speedDifferences in processor speed Differences in graphics / display qualityDifferences in graphics / display quality Differences in sound generationDifferences in sound generation
Development process more difficult, takes Development process more difficult, takes longerlonger
Game BoyGame Boy
Concentrate on the GBAConcentrate on the GBA Most recent version that we have a lot of Most recent version that we have a lot of
information oninformation on Don’t know much about the DS yet, Don’t know much about the DS yet,
haven’t seen cheap or free tools for haven’t seen cheap or free tools for development on itdevelopment on it
Many web sites discuss the GBA Many web sites discuss the GBA hardware and programming it, so lots of hardware and programming it, so lots of informationinformation
Game BoyGame Boy
Like most consoles a rather ugly Like most consoles a rather ugly architecturearchitecture
Tries to get as much as it can out of a low Tries to get as much as it can out of a low priced unitpriced unit
Based on the ARM7TDMI CPU chip, also Based on the ARM7TDMI CPU chip, also used on some phones and PDAsused on some phones and PDAs
Appears to be off-the-shelf, no Appears to be off-the-shelf, no customization by Nintendocustomization by Nintendo
CPUCPU
Two modes, 16 bit instructions and 32 bit Two modes, 16 bit instructions and 32 bit instructions, can switch between modesinstructions, can switch between modes
Why?Why? Internal RAM is 32 bitsInternal RAM is 32 bits ROM cartridges are 16 bitsROM cartridges are 16 bits
Switch instructions to match the memory Switch instructions to match the memory being used, can copy code from cartridge being used, can copy code from cartridge to internal RAMto internal RAM
MemoryMemory
Many memory areas, most are quite small:Many memory areas, most are quite small: 32 Kbytes on chip memory32 Kbytes on chip memory 256 Kbytes off chip working memory256 Kbytes off chip working memory 96 Kbytes VRAM (video RAM)96 Kbytes VRAM (video RAM) 1 Kbyte sprite properties1 Kbyte sprite properties 1 Kbyte pallette1 Kbyte pallette 32 Mbytes cartridge memory (may have 32 Mbytes cartridge memory (may have
several banks of this)several banks of this)
MemoryMemory
Access to the cartridge is quite slowAccess to the cartridge is quite slow Can run 16 bit code from the cartridgeCan run 16 bit code from the cartridge Better to copy important code to working Better to copy important code to working
memory and use 32 bit instructionsmemory and use 32 bit instructions Can store art work in cartridge, bring it into Can store art work in cartridge, bring it into
memory when neededmemory when needed Programmers need to think more about Programmers need to think more about
memory allocationmemory allocation
GraphicsGraphics
The display is 240 x 160 pixelsThe display is 240 x 160 pixels Can display up to 32768 colours, but this Can display up to 32768 colours, but this
depends upon the display modedepends upon the display mode Most of the time use a 16 colour or 256 Most of the time use a 16 colour or 256
colour palettecolour palette Many different modes and options, not all Many different modes and options, not all
of them can be combined togetherof them can be combined together
GraphicsGraphics
Two types of graphics:Two types of graphics: BackgroundsBackgrounds SpritesSprites
Background is always drawn first, sprites Background is always drawn first, sprites are drawn over topare drawn over top
Can use sprite priorities to put a sprite Can use sprite priorities to put a sprite behind part of the background, this gets to behind part of the background, this gets to be a bit complicatedbe a bit complicated
BackgroundsBackgrounds
There can be up to 4 background levelsThere can be up to 4 background levels There are 6 background modesThere are 6 background modes Three modes are tile based, tiles can be Three modes are tile based, tiles can be
either 16 colour or 256 coloureither 16 colour or 256 colour Tiled backgrounds can vary from 128 x Tiled backgrounds can vary from 128 x
128 to 1024 x 1024 in size128 to 1024 x 1024 in size Tiles are stored in VRAM and can be Tiles are stored in VRAM and can be
shared between background levelsshared between background levels
BackgroundsBackgrounds
Three raster background modes, can Three raster background modes, can access individual pixels:access individual pixels: Single buffer, 240 x 160, 32768 coloursSingle buffer, 240 x 160, 32768 colours Double buffer, 240 x 160, 256 coloursDouble buffer, 240 x 160, 256 colours Double buffer, 160 x 128, 32768 coloursDouble buffer, 160 x 128, 32768 colours
Size of raster backgrounds is limited by Size of raster backgrounds is limited by the amount of VRAMthe amount of VRAM
Can’t do full screen, full colour, double Can’t do full screen, full colour, double bufferedbuffered
BackgroundsBackgrounds
Hardware supports a number of special Hardware supports a number of special effects on backgroundseffects on backgrounds
Can scale and rotate some of the Can scale and rotate some of the background levelsbackground levels
Can pan all of the background levels Can pan all of the background levels independentlyindependently
Can alpha blend two background levels, Can alpha blend two background levels, also increase of decrease level brightnessalso increase of decrease level brightness
PalettesPalettes
Two separate palettes, one for Two separate palettes, one for backgrounds, one for spritesbackgrounds, one for sprites
Palettes have 256 entries of 15 bit colour, Palettes have 256 entries of 15 bit colour, 5 bits red, 5 bits green, 5 bits blue5 bits red, 5 bits green, 5 bits blue
Total 512 bytes per paletteTotal 512 bytes per palette Palette can be viewed as one 256 colour Palette can be viewed as one 256 colour
palette, or 16 palettes of 16 colourspalette, or 16 palettes of 16 colours
SpritesSprites
Up to 128 sprites, some restrictions on Up to 128 sprites, some restrictions on number of sprites per linenumber of sprites per line
Sprites built from 8x8 pixel tiles, either 16 Sprites built from 8x8 pixel tiles, either 16 or 256 coloursor 256 colours
Sprites can vary in size from 8x8 to 64x64 Sprites can vary in size from 8x8 to 64x64 pixels, either square or rectangularpixels, either square or rectangular
Sprites can share tiles, multiple objects Sprites can share tiles, multiple objects with same appearance don’t need extra with same appearance don’t need extra memorymemory
SpritesSprites
Tile memory can hold between 256 and Tile memory can hold between 256 and 1024 8x8 tiles, depending upon colour 1024 8x8 tiles, depending upon colour depth and background modedepth and background mode
This limits the number of large sprites and This limits the number of large sprites and the amount of animationthe amount of animation
For animation need to store a separate set For animation need to store a separate set of tiles for each frame, can quickly use up of tiles for each frame, can quickly use up all of the tile memory for large spritesall of the tile memory for large sprites
ExampleExample
A 64x64 sprite requires 64 tiles for 16 A 64x64 sprite requires 64 tiles for 16 colours and 128 tiles for 256 colourscolours and 128 tiles for 256 colours
If there are 10 frames of animation (the If there are 10 frames of animation (the player character in our phone example has player character in our phone example has 12) we need 640 or 1280 (too many) tiles12) we need 640 or 1280 (too many) tiles
Only store some of the animation frames Only store some of the animation frames in tile memory, copy frames in when in tile memory, copy frames in when requiredrequired
SpritesSprites
Sprite position, address of tiles and other Sprite position, address of tiles and other properties stored in sprite memoryproperties stored in sprite memory
Can change properties between framesCan change properties between frames 32 sets of scaling and rotation data that 32 sets of scaling and rotation data that
can be shared between the spritescan be shared between the sprites Each sprite can be flipped about horizontal Each sprite can be flipped about horizontal
or vertical axisor vertical axis
SoundSound
A mixture of old Game Boy analogue A mixture of old Game Boy analogue sound and newer digital soundsound and newer digital sound
There are 6 sound channels that are There are 6 sound channels that are mixed to provide a final stereo sound (only mixed to provide a final stereo sound (only heard in headphones)heard in headphones)
The final output sound is 9 bits sampled at The final output sound is 9 bits sampled at a rate of 32768 Hza rate of 32768 Hz
This is not very high quality!This is not very high quality!
SoundSound
First four channels are basically noise First four channels are basically noise generatorsgenerators
Can control their parameters, each Can control their parameters, each channel produces a different type of noisechannel produces a different type of noise
The last two channels are for digital soundThe last two channels are for digital sound This is basically 8 bits sampled at 32768 This is basically 8 bits sampled at 32768
HzHz Samples stored in on chip RAMSamples stored in on chip RAM
Serial PortSerial Port
There is one serial port that is used for a There is one serial port that is used for a number of communications tasks:number of communications tasks: Communications with up to three other Game Communications with up to three other Game
Boys, multi-player gamesBoys, multi-player games Communications with external devices, like Communications with external devices, like
game controllers and joysticksgame controllers and joysticks Communications with development machines, Communications with development machines,
downloading of code and debuggingdownloading of code and debugging
Serial PortSerial Port
One of the standard ways of getting code One of the standard ways of getting code onto a Game Boyonto a Game Boy
Program prepared on a PC, art work Program prepared on a PC, art work collected and program compiledcollected and program compiled
Cable connects PC to Game Boy serial Cable connects PC to Game Boy serial port, game is transferred to the Game Boy port, game is transferred to the Game Boy RAMRAM
Only works for programs that fit into 256 Only works for programs that fit into 256 Kbytes RAMKbytes RAM
CartridgeCartridge
Standard ROM cartridges can have up to Standard ROM cartridges can have up to 32 Mbytes of program32 Mbytes of program
Executing from cartridge is slower than Executing from cartridge is slower than RAM, but there is much more roomRAM, but there is much more room
Usually transfer program code to RAM for Usually transfer program code to RAM for execution, take advantage of faster execution, take advantage of faster memory on Game Boymemory on Game Boy
Program split between cartridge and RAMProgram split between cartridge and RAM
CartridgeCartridge
Each cartridge has a header recorded at Each cartridge has a header recorded at the start of ROMthe start of ROM
Contains name of game, manufacturer, Contains name of game, manufacturer, device codes, where to start execution of device codes, where to start execution of the gamethe game
Also contains a compressed version of the Also contains a compressed version of the standard Nintendo logostandard Nintendo logo
Program will not run without the logo, Program will not run without the logo, Game Boy checks for thisGame Boy checks for this
CartridgeCartridge
One of the important steps in game One of the important steps in game development is to add the logo to the development is to add the logo to the header for your programheader for your program
This is put there for legal reasons, to catch This is put there for legal reasons, to catch piracypiracy
Very weak protection in terms of copying, Very weak protection in terms of copying, can easily copy the logo from another can easily copy the logo from another cartridge and add it to your programcartridge and add it to your program
CartridgeCartridge
Mainly used for court casesMainly used for court cases The Nintendo logo is a copyrighted The Nintendo logo is a copyrighted
trademarktrademark You cannot use it without permission from You cannot use it without permission from
Nintendo, so legally you can’t put it in your Nintendo, so legally you can’t put it in your programprogram
Legal case is based on use of trademark, Legal case is based on use of trademark, not the illegal copying of the game!not the illegal copying of the game!
Development ProcessDevelopment Process
Everything is on the cartridge, Game Boy Everything is on the cartridge, Game Boy views it as a programviews it as a program
It doesn’t know anything about files, it It doesn’t know anything about files, it doesn’t have anydoesn’t have any
Content can’t be stored as files on the Content can’t be stored as files on the cartridgecartridge
Must become part of the program, part of Must become part of the program, part of the data that is built into the programthe data that is built into the program
Development ProcessDevelopment Process
Art work can be produced using standard Art work can be produced using standard tools, well at least some of ittools, well at least some of it
This art work then needs to be put into a This art work then needs to be put into a format where it can be used in the gameformat where it can be used in the game
For example, sprites need to be divided For example, sprites need to be divided into tilesinto tiles
Usually produce a standard set of images Usually produce a standard set of images for the sprites, artist doesn’t think about for the sprites, artist doesn’t think about tilestiles
Development ProcessDevelopment Process
First use a program to divide the sprite First use a program to divide the sprite images into tilesimages into tiles
All the sprites use the same palette, so All the sprites use the same palette, so some care must be used here:some care must be used here: Develop a single palette that is used for all Develop a single palette that is used for all
sprite imagessprite images Use a program that constructs a “best fit” Use a program that constructs a “best fit”
palette from all the sprite imagespalette from all the sprite images
Development ProcessDevelopment Process
Now have tiled sprites, plus a paletteNow have tiled sprites, plus a palette Need to convert this into program code or Need to convert this into program code or
data, something we can put in the data, something we can put in the cartridgecartridge
Another program is used for this, produces Another program is used for this, produces a file that is combined with the programa file that is combined with the program
Each time the art work changes, all these Each time the art work changes, all these programs must be run againprograms must be run again
Development ProcessDevelopment Process
Backgrounds are a bit easierBackgrounds are a bit easier Tile based map editors are common, level Tile based map editors are common, level
designers are used to dealing with themdesigners are used to dealing with them Still need to convert the background Still need to convert the background
images into a format that can be included images into a format that can be included with the programwith the program
Sound is harder, need special tools due to Sound is harder, need special tools due to the strange sound formatsthe strange sound formats
Tool ChainTool Chain
The set of programs used to create the art The set of programs used to create the art work is called a tool chainwork is called a tool chain
Programs are executed one after the Programs are executed one after the other, like the links in a chainother, like the links in a chain
If one of them is missed, or doesn’t work If one of them is missed, or doesn’t work right, the art work is no goodright, the art work is no good
A change to the original art work means A change to the original art work means we have to execute the whole chainwe have to execute the whole chain
Tool ChainTool Chain
Programmers usually develop the tool Programmers usually develop the tool chains for individual game projectschains for individual game projects
Usually work closely with artists, make it Usually work closely with artists, make it easier for them to produce the art workeasier for them to produce the art work
Tool chains sometimes shared between Tool chains sometimes shared between gamesgames
Trend towards having technically Trend towards having technically sophisticated artists produce the tool sophisticated artists produce the tool chains – technical artistchains – technical artist
Nintendo DSNintendo DS
Information just beginning to appear now, Information just beginning to appear now, still not a lot of detailsstill not a lot of details
The DS is considerably more complex The DS is considerably more complex than the Game Boy:than the Game Boy: Much harder to program, some very tricky Much harder to program, some very tricky
issues as we will seeissues as we will see Harder to find informationHarder to find information Harder to produce programming toolsHarder to produce programming tools
CPUsCPUs
The DS has two CPUs, this makes it more The DS has two CPUs, this makes it more complicatedcomplicated
The first CPU is a ARM7TDMI, same as The first CPU is a ARM7TDMI, same as the Game Boy, but twice as fastthe Game Boy, but twice as fast
The second CPU is an ARM9426E, more The second CPU is an ARM9426E, more modern than Game Boy and running four modern than Game Boy and running four times fastertimes faster
Both seem to be standard off the shelfBoth seem to be standard off the shelf
CPUsCPUs
It appears that the ARM9 is the main It appears that the ARM9 is the main processor, responsible for main game processor, responsible for main game logic and graphicslogic and graphics
The ARM7 is a slave and deals with:The ARM7 is a slave and deals with: SoundSound WifiWifi Touch padTouch pad
The ARM7 may not be able to do graphicsThe ARM7 may not be able to do graphics
MemoryMemory
The DS has considerably more memoryThe DS has considerably more memory The working RAM is 4Mbytes, and is The working RAM is 4Mbytes, and is
shared between the two processorsshared between the two processors This memory is used for program code This memory is used for program code
and communications between the CPUsand communications between the CPUs There is also 32 Kbytes of internal RAM, There is also 32 Kbytes of internal RAM,
not sure if this is shared or a separate not sure if this is shared or a separate copy for each processorcopy for each processor
VideoVideo
The main external feature of the DSThe main external feature of the DS Two 256x192 pixel displays, still 16 bit Two 256x192 pixel displays, still 16 bit
colourcolour Approximately 700 Kbytes of video RAMApproximately 700 Kbytes of video RAM Four main banks of 128 Kbytes that Four main banks of 128 Kbytes that
appear to serve the same function as appear to serve the same function as Game Boy VRAMGame Boy VRAM
Can simulate Game Boy graphicsCan simulate Game Boy graphics
VideoVideo
There are two 2D graphics engines, main There are two 2D graphics engines, main and sub (attached to the two displays??)and sub (attached to the two displays??)
The main engine is more powerfulThe main engine is more powerful Has at least 7 background modes, many Has at least 7 background modes, many
are tile based and similar to the Game Boyare tile based and similar to the Game Boy Can also have full frame buffer access, Can also have full frame buffer access,
can apparently use the first four memory can apparently use the first four memory banks for thisbanks for this
VideoVideo
Sprite support seems to be similar to Sprite support seems to be similar to Game BoyGame Boy
The 2D engines have separate palette and The 2D engines have separate palette and sprite memory, but it might be possible to sprite memory, but it might be possible to share the VRAMshare the VRAM
Big advance is 3D graphics engine, can be Big advance is 3D graphics engine, can be shared between the two screens, but there shared between the two screens, but there is a speed penaltyis a speed penalty
3D3D
Primitive by modern standardsPrimitive by modern standards No floating point, uses fixed point integer No floating point, uses fixed point integer
coordinates, etccoordinates, etc Need to be careful with model Need to be careful with model
construction, particularly transformationsconstruction, particularly transformations May need to process models before they May need to process models before they
can be used on the DScan be used on the DS This could be a bit trickyThis could be a bit tricky
3D3D
Still 16 bit colourStill 16 bit colour Has texture mapping, but no texture Has texture mapping, but no texture
filteringfiltering Can do hardware anti-aliasingCan do hardware anti-aliasing There are suggestions that it can do There are suggestions that it can do
special video effects like toon shading, but special video effects like toon shading, but this hasn’t been seenthis hasn’t been seen
SoundSound
May support Game Boy soundMay support Game Boy sound Appears to have a better sound system Appears to have a better sound system
that is based on sampled soundsthat is based on sampled sounds Appears to have up to 8 channels of Appears to have up to 8 channels of
sampled or wave sound that can be mixed sampled or wave sound that can be mixed and played togetherand played together
Appears that the ARM7 controls the soundAppears that the ARM7 controls the sound
WIFIWIFI
The DS can use standard 802.11g The DS can use standard 802.11g wireless networking, not sure how wireless networking, not sure how complete this iscomplete this is
It also has its own Nintendo based It also has its own Nintendo based protocol – called NIFIprotocol – called NIFI
This is mainly used for multiplayer games, This is mainly used for multiplayer games, same as the link cables on Game Boysame as the link cables on Game Boy
Can also download games over NIFICan also download games over NIFI
CartridgesCartridges
The DS cartridges are encrypted in real The DS cartridges are encrypted in real time, so they are harder to deal with than time, so they are harder to deal with than Game Boy onesGame Boy ones
The cartridge itself has a processor for The cartridge itself has a processor for encryption, the DS sends it the information encryption, the DS sends it the information for encryption when it startsfor encryption when it starts
Only the initial cartridge header isn’t Only the initial cartridge header isn’t encryptedencrypted
DevelopmentDevelopment
The first problem is getting code onto the The first problem is getting code onto the DS, can’t simply write cartridgesDS, can’t simply write cartridges
There are now two approachesThere are now two approaches First is to intercept the DS cartridge First is to intercept the DS cartridge
header and modify it to point to the GBA header and modify it to point to the GBA cartridgecartridge
The GBA cartridge has the DS program, The GBA cartridge has the DS program, can be written by standard GBA toolscan be written by standard GBA tools
DevelopmentDevelopment
This requires a DS cartridge to use as a This requires a DS cartridge to use as a header donor, and a special hardware header donor, and a special hardware device to modify the headerdevice to modify the header
The second approach is to use NIFI to The second approach is to use NIFI to download a program, usually to read the download a program, usually to read the game from the GBA cartridgegame from the GBA cartridge
This requires a particular WIFI adaptor for This requires a particular WIFI adaptor for the PC, only one type will workthe PC, only one type will work
This seems to be the best approachThis seems to be the best approach
DevelopmentDevelopment
Most of the tools used for Game Boy Most of the tools used for Game Boy development can also be used with DSdevelopment can also be used with DS
The 2D art work is basically the same, and The 2D art work is basically the same, and similar processors are usedsimilar processors are used
The main difference is in sound formats The main difference is in sound formats and 3D graphicsand 3D graphics
Need to keep the ARM7 and ARM9 code Need to keep the ARM7 and ARM9 code separateseparate