1 / 21

CIS 487 - Game Design I Chapter 6 and 7

CIS 487 - Game Design I Chapter 6 and 7. Blake Farrugia 10/24/2011. Chapter 6 – No Tanks. The next game focuses on projectile shooting using tanks. You play a green tank, killing blue tanks and gaining treasure to complete the level.

electra
Download Presentation

CIS 487 - Game Design I Chapter 6 and 7

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CIS 487 - Game Design IChapter 6 and 7 Blake Farrugia 10/24/2011

  2. Chapter 6 – No Tanks • The next game focuses on projectile shooting using tanks. • You play a green tank, killing blue tanks and gaining treasure to complete the level. • This game incorporates everything the book has covered so far. • New changes include tiles, sprite sheets, maze logic, moving enemy AI

  3. Setup • The last chapters talked about sprite sheets in general, but they implemented the assets in a separate image manner • This chapter uses an actual sprite sheet (one full picture) to animate the player, enemies, and explosions • Sprites are all 32x32 pixels; the map is set up as a 20x15 grid of tiles created using GIMP http://www.gimp.org

  4. Tile Set with ID Numbers 0 1 2 3 4 5 6 7 8 16 24 25 26 27 28 29 30 31

  5. Map Setup • Each tile ID is stored a 20x15 2D array of ints • The game uses this information to set each tile as needed to be in the map • No Tanks creators used a tile map editor called Mappy to make their map setup easier http://tilemap.co.uk/index.html • Arrays for map setup are stored in the Level1 class derived from Level

  6. Map Sprites and Object Sprites • The map itself is made of environment tiles, but object sprites are made of their own separate tiles • Some are in sets (idle sprite, animation sets) • Icons such as ammo upgrades and extra lives have their own sprites • Object sprites are stored in a 2D array within the Level1 class

  7. Using Tile Data • Mappy exports code usable by ActionScript, but some work has to be done to make that code functioning • Mappy creates 2D arrays for Level1.as to use

  8. Map Setup backGroundMap = [ [26,24,25,0,26,26,26,26,26,0,0,26,26,26,26,26,0,24,25,26], [27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,27], [29,0,28,0,0,0,24,25,0,24,25,0,24,25,0,0,0,27,0,29], [27,0,28,0,27,0,0,0,0,0,0,0,0,0,0,27,0,29,0,27], [29,0,0,0,29,0,0,30,0,0,0,0,31,0,0,29,0,0,0,29], [0,0,28,0,26,0,0,31,0,0,0,0,31,0,0,26,0,26,0,0], [0,0,0,0,0,0,0,31,0,0,0,0,31,0,26,0,0,0,0,0], [26,26,26,0,0,26,0,30,30,30,30,30,30,0,0,0,0,26,26,26], [0,0,0,26,0,0,0,0,0,0,0,28,0,0,0,0,26,0,0,0], [0,0,0,0,26,0,0,27,0,27,0,27,0,28,0,26,0,0,0,0], [27,0,0,0,27,0,0,29,0,29,0,29,0,28,0,27,0,0,0,27], [29,0,0,0,29,0,0,0,0,0,0,0,0,0,0,29,0,0,0,29], [27,0,0,0,0,26,0,28,0,28,0,28,28,0,26,0,0,0,0,27], [29,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29], [26,24,25,0,0,26,26,26,26,0,0,26,26,26,26,0,0,24,25,26] ];

  9. Map Setup spriteMap = [ [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,22,0,0,0,0,0,9,0,0,20,0], [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], [1,0,0,0,0,0,0,0,0,0,0,0,0,0,20,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,9,0,9,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,9,0], [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,20,0,0,0,0,0,9,0,23,0], [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] ];

  10. Using Tile Data • TileSheetDataXML.as to store all tile data and some frame data from XML package com.efg.games.notanks { public class TilesheetDataXML { public static varXMLData:XML= <tilesheet> <tile id="0" name="road" type="walkable"></tile> <tile id="1" name="player" type="sprite"></tile> <tile id="2" name="player" type="sprite"></tile> …… <tile id="31" name="blueblock8" type="nonwalkable"></tile> <smallexplode tiles="17,18,17"></smallexplode> <largeexplode tiles="17,18,19,18,17"></largeexplode> </tilesheet>; } // end class }// end package

  11. Using Tile Data • The GameDemo class parses and assigns tiles and creates all level properties • This class will be extended incrementally to build the complete game • Complete game is contained in GameDemoIteration6.as

  12. Flash Region Drawing • The sprite blitting used in No Tanks combines bitmap redrawing with Sprite class screen invalidation techniques that Flash does so well • Want to see Screen Invalidation? Right click most Flash applications and click the option “Show Redraw Region” • Individual object sprites (tanks, upgrades) will redraw themselves separately rather than drawing to background constantly

  13. New Level Creation • New levels are hardcoded on top of a Level class. • This is due to the fact that the author wants to keep all resources within the SWF and not have any external resources • This changes as needed, but the first (and only) level is called Level1

  14. Chapter 7 – Game Implementation • This chapter focuses on: • AI Logic • Line-Of-Sight firing • Pathfinding • Individual Sprite Blitting • Rotation • Smooth Movement

  15. Tile Movement • Tile-By-Tile movement used to be the norm for tile-based games. It’s rickety and not too pleasant to view • Smooth tile movement will be used in No Tanks • Cornering will only work when sprites are in the center of a given tile

  16. BlitSprite.as • A class that extends Sprite while adding frame animation functions • A reference of TileSheet is passed to it, and the held bitmap is redrawn individually using the copyPixels method • Rotation functionality is appended into this class and will be utilized by the next class, TileByTileBlitSprite.as

  17. TileByTileBlitSprite.as • A class extending BlitSprite, so BlitSprite functionality can be used for non-tile games • Holds additional direction, movement, and destination logic • Sprites that are not environment will use this class

  18. Game Setup • The majority of the game is run through NoTanks.as • A majority of the game’s setup is run through GameDemo.as • NoTanks handles much of the event code after GameDemo’s initial setup

  19. Iteration Testing • Within the project, there are several versions of the GameDemo class • Each class adds new functionality and incrementally builds the entire game • These were general tests for successful integration of all parts of this game: • Sprite Rendering/Collisions • AI Logic • Movement • Sounds

  20. Iterations • Iteration 1 – adds the player avatar coide • Iteration 2 – add key logic to move the player • Iteration 3 – updates states for player moves • Iteration 4 – Rendering player movement • Iteration 5 – Adding and moving enemy tanks also divides game platform into regions • Iteration 6 – Game AI added for enemy tanks (targeting, movement, collisions), sounds added to game

  21. Region Tracking and Chase Objects • Regions are quadrants of the level that the game focuses calculations on • As the player moves, the contents of a given region begin to react • Chase Objects are managers which point a predator object towards the path of a prey object • Chase objects handle pathfinding/attacks for enemies

More Related