Flash11 Stage3D Book Chapter 9

Adobe Flash 11 Stage3D (Molehill) Game Programming
Beginner’s Guide: Chapter 9 Demo

“A world filled with action”

In chapter nine we upgrade our game engine to implement AI (artificial intelligence), along with an “actor reuse pool” which can spawn and respawn game entities by reusing “dead” enemies again and again. We also implement simplistic “level editor” functionality by creating a class that can parse the pixels in a tiny image to use as the layout of your game world. Other new optimizations include object culling based on distance from the camera and colision detection so that bullets can destroy enemies.

This demo “looks” the same as the one in chapter eight since nothing has changed except many internal classes have been created in preparation for chapter ten. Click the viewport above and hold down the spacebar to spawn particles. W,A,S,D or arrow keys to move.

Here’s an excerpt from the chapter introduction:

Time to design the world and fill it with lethal enemies!

The second last step in our adventure is to create some game-specific classes that will flesh out the world and allow for easy level creation. We also need to be able to spawn entities that move and react to the player and know when they are collided with.

To make a finished, polished and playable 3d game, we need more than simple rendering functionality. Let’s program a way to create a complex game world by drawing levels in an image editor rather than having to manually enter them in the source code. While we’re at it, let’s design way to control enemies and make them move around in space by implementing simple artificial intelligence. We want the game to detect when things are bumping into each other so we can trigger explosions or grant the player more points, so this is the ideal time to implement collision detection. We we are done, our game will be filled with enemies that shoot at the player and level props that the player can crash into.

In chapter nine we will:

extend the entity class with game “actor” functionality
implement simplistic artificial intelligence
program collision detection
implement an “actor reuse pool” system
optimize our game to only display actors that are nearby
program a map parsing mechanism to allow for easy world creation
upgrade the input routines

Learn how to program a Flash 11 3d game in my new book:
Adobe Flash 11 Stage3D (Molehill) Game Programming Beginner’s Guide

View the other demos from the book:
Chapter One – introduction
Chapter Two – terminology
Chapter Three – basic quad
Chapter Four – basic agal shaders
Chapter Five – mesh parser
Chapter Six – render states
Chapter Seven – inputs and timers
Chapter Eight – particle system
Chapter Nine – game actor classes
Chapter Ten – the final game demo

About Breakdance McFunkypants

Also known as Chris K, an Indie Game Developer based in Victoria Canada. A lifelong coder and hardcore gamer, he grew up part of the old-school “demoscene” BBS culture and spent his youth in shady arcades. (twitter.com/McFunkypants)
This entry was posted in 3d, AS3, Book, Coding, Flash, Flash11, Game, Molehill, Stage3D. Bookmark the permalink.

2 Responses to Flash11 Stage3D Book Chapter 9

  1. Pingback: Flash11 Stage3D Book Chapter 8 | Indie Game Developer Breakdance McFunkypants

  2. Pingback: Flash11 Stage3D Book Chapter 6 | Indie Game Developer Breakdance McFunkypants

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>