Transcript
Game Design of Mobile Tank Ming Yang EECS Dept., Northwestern Univ. Email:
[email protected]
1
Game Introduction
Mobile Tank is a variation of the classical console game Battle City, which is particularly designed for mobile devices. The basic rules follow those of Battle City. The player wins either to destroy all the enemy tanks or destroy the enemy city center.
2 2.1
Game Specification System requirements • Microsoft Window XP • Visual Studio 2005 • Windows Mobile 5.0 Pocket PC SDK • Direct Draw Compatible 240 × 320 Display
2.2
Playing instruction
The current version runs on Windows Mobile 5.0 Pocket PC Emulator, so the keyboard is usable. The following summarizes the user input: Key Function ENTER Start the game from the splash screen SPACE Pause the game ESC Exit the game F1/Left Soft Key Fire F2/Right Soft Key Fire Up Arrow Move upward Down Arrow Move downward Left Arrow Move leftward Right Arrow Move rightward
1
2.3
Features • Multiple life single player • 4 different types of enemy tanks • 8 different terrain types • Scoring and high score statistics • Computer tank AI • Explosion effects • Sound effects • ∗ Limited ammo. • ∗ Limited range of fire • ∗ Partially destroyed bricks • ∗ Vision of the computer tanks (Enhanced AI) • ∗ Random generated maps.
There are 4 different types of computer tanks: normal medium tanks, high speed tanks, fast fire tanks, and triple armor heavy tanks. Normal medium tanks have normal speed, fire interval, and armor. High speed tanks runs 25% faster than normal tanks. Fast fire tanks have 25% shorter fire intervals. Heavy tanks have triple armor than the normal tanks, which means 3 hits are required to destroy a heavy tank. Regarding to Nate and Reid’s valuable suggestions, the game is improved in the following aspects: 1) the tanks have limited ammo now (50 bullets for each tanks), and the player’s ammo is shown as a red bar at the bottom; 2) the bullets have limited range of fire (about 2/3 of the screen); 3) the bricks can be partially destroyed (not as complicated as that in the original game); 4) the computer tanks now have vision to their front, left and right sides, if they see the player tank they will chase the player and fire; 5) the maps are randomly generated after level 2.
2.4
Screen shots
2.5
Pending issues • Further enhance computer tank AI. • Implement power • Fine partial destroyed bricks.
2
Figure 1: Splash screen and scoring screen.
2.6
Problems
The critical problem is the program speed. The emulator runs at about 10 fps on Pentium IV 3.2Ghz laptop. In addition, if I the whole map is drawn (i.e. draw 15 × 15 = 256 terrain image patches (16 × 16) on the screen, the frame rate will be about 5 fps. Current Window Mobile 5.0 Pocket PC doesn’t support DirectDraw back surface.
2.7
Reference
Demo project Donuts2 in Window Mobile 5.0 SDK is used as reference. The basic Direct Draw functions are modified from the codes in Donuts2.
3 3.1
Game Concepts Basic concepts
As the classical Battle City, the players control their tanks to protect the city base and destroy the invasive enemy tanks. When the players destroy all the enemy tanks, the game moves to the next stage. Each stage has unique map which contains various terrains and obstacles, such as bricks, steel, river and bushes.
3
Figure 2: Gaming screens for level 1 and level 2.
3.2
New concepts • Enemy city base. The enemy also has a city base to protect. If the player destroys the enemy base, the player wins this stage no matter how many enemy tanks remaining. This design will leave room for multiple players game. • Power bar. The player can accelerate the tank speed by hold the power button. Though the power is limited it can restore as time goes by. • Vision of the enemy tanks. Enhance the AI of the enemy tanks by introducing the vision concept. The enemy tanks can see the things in front of them, if they see the player they will try to follow the player and attack. • Limit of ammo. The ammo of the player will be limited.
Note: these concepts are tentative, there is no guarantee that they will be implemented.
4
Rule Description
The rule will follow the classical Battle City.
5 5.1
Software Architecture Design Target platform
Window Mobile 5.0 Pocket PC + Visual Studio 2005 C++.
4
5.2
User interface
The user interface design will follow the classical Battle City and be tailored for Pocket PC. At the first step, images obtained by screen-shot the classical Battle City will be used. The 320 × 240 screen of Pocket PC will be divided to the battle field area (240 × 240) and the info area (80 × 240). The battle field area will be divided to 15 × 15 cells, where each 16 × 16 cell is the basic unit for a tank or terrain. There will be 3 layers for the battle field. The ground layer for the basic terrains such as grass and ground, the middle layer for the tank and the terrains may interact with tanks, e.g. brick, steel and river, the upper layer for the bushes. The user input includes at most 6 keys: up, down, left, right, power, and fire.
5.3
State diagram
Edit Map
Welcome
Gaming
Score Statistic
Replay
Figure 3: State diagram of the game.
5.4
Block diagram
The block diagram of the game procedure in the timer callback function is shown below.
5.5
Class diagram
There are 3 sub-systems in this game: sprite sub-system, map sub-system, and game state and logic sub-system. The incomplete design is shown below.
5
MainTimer
GameLogic
Game Logic
CDxDisplayGame
User Input:Keyboard
Fire:CreateBullets
Map_CellArray : CMap
MTankList
IDisplayGame
AI Modules
ETankList
BulletList
CollisionCheck
CollisionCheck
CollisionCheck
UpdateState
UpdateState
UpdateState
GameState : CGameState
MoveOn
UpdateGameState
CreateTanks
MoveOn
MoveOn
DisplayGame
Figure 4: Block diagram of the timer callback function.
6
<
> SDirection
Sprite sub-system
+drUp +drDown +drLeft +drRight +drStop
Map sub-system
CSprite
+taCanPass +taCanBreak +taBulletPass +taCityCenter
-m_X : int -m_Y : int -m_Speed : int -m_Direction : SDirection -m_SpriteAttr : SSpriteAttr -m_bDead : bool -m_bActive : bool -m_Bitmap -m_FrameNum : int
<> SSpriteAttr +saUnDirectional +saCellCollision +saTankCollision +saBulletCollision
CTerrain -m_Bitmap -m_TerrainAttr : STerrainAttr
+CheckBoundCollisions() : bool +GetRect() +MoveOn() +UpdateState()
CCell -m_Layer : int -m_CX : int -m_CY : int -m_BreakMap -m_TerrainNo -m_Rect
CTank -m_Ammo : int -m_Armor : int -m_Score
CBullet
CGem
+GetRect() +GetTerrainAttr() : STerrainAttr +Explode()
* 1
+Fire()
CMap CMTank
+UserInput()
-m_LayerNum : int -m_CellArray : CCell
CETank
+AI()
<<‰ ¿ >> IDisplayGame
CGameState -m_PlayerNum : int -m_GameState : SGameState +DisplayGame() <> SGameState
Game state sub-system
<> STerrainAttr
+gsWelcome +gsGaming +gsScore +gsReplay +gsEditMap
Figure 5: Class diagram.
7
* 1 CTerrainArray -m_TerrainArray : CTerrain #CreateTerrain()