Tile-based game advantages
Creating Code 128 Code Set A In None
Using Barcode encoder for Font Control to generate, create Code128 image in Font applications.www.OnBarcode.com
Barcode Drawer In None
Using Barcode encoder for Font Control to generate, create Barcode image in Font applications.www.OnBarcode.com
Tile-based systems for building games are so widely used that they ve become the de facto standard approach for building games not just with Flash, but most other game-design technologies. This is true not only for 2D games, but 3D as well. Odds are that any professional games you ve played have used a tile-based system, and by the time you ve finished reading this chapter, you might find that most of the games you make will, too. The tile-based system is popular because it automatically solves a number of problems that are very complex to solve by other means. Here are some of its advantages: Array storage: In tile-based games, game levels are stored in arrays. Once your tile-based engine is in place, you can add limitless numbers of new game levels quickly, just by creating new arrays to describe the levels. You can test and tweak your level design without touching the underlying game engine code, and also create visual tools for players to create their own levels. Extremely efficient collision detection: Objects check for collisions only with other objects in their immediate vicinity. This means that there s very little unnecessary checking going on, and that s a big performance savings. Simplified AI: In a tile-based world, game objects are aware of their surroundings. They can make decisions based on simple rules about what to do when their environment changes. Intricate AI behavior can often be created with code that is no more complex than one if statement. Pathfinding (the subject of the next chapter) is also a breeze to implement in a tile-based game world. Efficient use of graphics: Tile-based games make very efficient use of graphics by reusing as much artwork as possible. This results in small file sizes, low memory usage, and quick processing.
Generate UPC A In None
Using Barcode drawer for Font Control to generate, create UCC - 12 image in Font applications.www.OnBarcode.com
DataMatrix Printer In None
Using Barcode creation for Font Control to generate, create ECC200 image in Font applications.www.OnBarcode.com
TILE-BASED GAME DESIGN
QR Code Drawer In None
Using Barcode generation for Font Control to generate, create QR-Code image in Font applications.www.OnBarcode.com
PDF-417 2d Barcode Drawer In None
Using Barcode generator for Font Control to generate, create PDF-417 2d barcode image in Font applications.www.OnBarcode.com
The concepts involved for making tile-based action games are the same as the concepts for making logic and board games. Once you understand the basic theory and techniques for building tile-based games, game projects that seem very complicated suddenly won t seem so complex anymore.
UCC.EAN - 128 Drawer In None
Using Barcode creator for Font Control to generate, create UCC - 12 image in Font applications.www.OnBarcode.com
Creating EAN8 In None
Using Barcode printer for Font Control to generate, create EAN8 image in Font applications.www.OnBarcode.com
Building the game world
Code 128 Code Set C Creation In Visual Basic .NET
Using Barcode generation for VS .NET Control to generate, create Code 128 image in .NET applications.www.OnBarcode.com
ANSI/AIM Code 128 Encoder In None
Using Barcode creator for Software Control to generate, create Code128 image in Software applications.www.OnBarcode.com
You ll be happy to know that in this chapter, we re going to diverge from the dark and brooding universe of sci-fi games and enter the bubbly, Technicolor world of platform and racing games. Unsurprisingly, for a tile-based game, the first step is creating some tiles.
Barcode Scanner In Visual Studio .NET
Using Barcode decoder for Visual Studio .NET Control to read, scan read, scan image in .NET framework applications.www.OnBarcode.com
Encode USS-128 In VS .NET
Using Barcode printer for Reporting Service Control to generate, create EAN 128 image in Reporting Service applications.www.OnBarcode.com
Code 128C Creator In Visual Studio .NET
Using Barcode drawer for Reporting Service Control to generate, create ANSI/AIM Code 128 image in Reporting Service applications.www.OnBarcode.com
Drawing PDF417 In None
Using Barcode creator for Online Control to generate, create PDF 417 image in Online applications.www.OnBarcode.com
Tiles are rectangles that contain the graphics that you want to use in your game. The rectangles can be any height or width, but their size will place certain constraints on the dimensions of the stage. It s important to decide right from the beginning what size your tiles will be. You can create tiles using any image-editing software you like, including the free GIMP image editor or Aviary, the online, Flash-based image and sound-editing suite. All the tiles for the examples in this chapter are bitmaps that are 64 by 64 pixels. As noted in 6, computers handle bitmap sizes that are multiples of 2 very efficiently. Because of this, tile dimensions of 16 by 16, 32 by 32, and 64 by 64 are popular choices. But if you need tiles that are unusual sizes, like 23 by 77, go for it!
Drawing PDF417 In Java
Using Barcode creation for Java Control to generate, create PDF 417 image in Java applications.www.OnBarcode.com
Code128 Drawer In None
Using Barcode encoder for Online Control to generate, create Code 128 Code Set A image in Online applications.www.OnBarcode.com
The tile sheet
Creating Data Matrix ECC200 In Objective-C
Using Barcode maker for iPad Control to generate, create DataMatrix image in iPad applications.www.OnBarcode.com
Decode Data Matrix In VS .NET
Using Barcode scanner for Visual Studio .NET Control to read, scan read, scan image in .NET applications.www.OnBarcode.com
The tiles for all the examples in this chapter are stored in a single 256-by-256 square bitmap image the tile sheet as shown in Figure 8-1. You ll find this in the images folder of the chapter s source files. I created all these game characters and objects individually using Adobe Illustrator, and then used Adobe Fireworks to scale them down to size and put together the single composite PNG file.
Code 39 Creation In Visual Studio .NET
Using Barcode generation for VS .NET Control to generate, create Code 39 image in .NET applications.www.OnBarcode.com
Code 39 Extended Encoder In None
Using Barcode encoder for Excel Control to generate, create ANSI/AIM Code 39 image in Office Excel applications.www.OnBarcode.com
When working in Fireworks, I selected Show grid from the View menu and edited the grid settings so that each cell was 64 by 64 pixels. This made it easy to position each tile in the correct place. I also made sure that the background was transparent.
Figure 8-1. The tile sheet in Adobe Fireworks. All the game objects and environment graphics are contained in the cells of a single bitmap image called a tile sheet. You can also see from Figure 8-1 that the images in the tiles are all different shapes and sizes. The 64-by-64 dimension is only the maximum size that a tile should be. Notice that images in the tiles that are smaller than the maximum size are aligned to the top-left corner of the cell they occupy. This will become a very important detail when we look at how tiles are copied from the tile sheet into the game. There s no particular order to how these tiles are organized on the tile sheet. And the tile sheet itself can be any dimension you choose. You don t even need to decide how many tiles you need before you start coding a game just add them to the tile sheet as you need them. All of the games in this chapter were made using just this one tile sheet. Can you see how convenient this is With just one small PNG file in your back pocket and a little code, you have a surprisingly large number of options available to make a wide variety of games.