Adobe Flash 11 Stage3D (Molehill) Game Programming
Let's Make a Game Using Molehill!
Using 2D Flash text and sprites
The structure of a Molehill application
Flowchart of a Molehill program
Time for action – things we do once, during the setup
Time for action – things we do over and over again
Step 1: Downloading Flash 11 (Molehill) from Adobe
Time for action – getting the plugin
Time for action - getting the Flash 11 profile for CS5
Time for action – upgrading Flex
Time for action – upgrading the Flex playerglobal.swc
Time for action – using SWF Version 13 when compiling in Flex
Time for action – updating your template HTML file
Time for action – creating an empty project
Time for action – importing Stage3D-specific classes
Time for action – initializing Molehill
Time for action – defining some variables
Time for action – embedding a texture
Time for action – defining the geometry of your 3D mesh
Time for action – starting your engines
Time for action – adding to the onContext3DCreate function
Time for action – uploading our data
Time for action – setting up the camera
Time for action – let's animate
Time for action – setting the render state and drawing the mesh
Basic Shaders: I can see Something!
AGAL: Adobe Graphics Assembly Language
Time for action – writing your first vertex program
Time for action – writing your first fragment program
Compiling the AGAL source code
Time for action – compiling AGAL
Time for action – creating the FPS GUI
Time for action – adding the GUI to our inits
Time for action – adding multiple shaders to the demo
Time for action – initializing the shaders
Time for action – animating the shaders
Time for action – uploading data to Stage3D
Time for action – coding the Stage3dObjParser class
Time for action – creating the class constructor function
Time for action – coding the parsing functions
Time for action – processing the data
Time for action – coding some handy utility functions
Time for action – starting the render loop
Time for action – adding the score to the GUI
Time for action – upgrading your init routines
Time for action – parsing our mesh data
Time for action – animating the scene
Textures: Making Things Look Pretty
Time for a plan: creating a "real" game
Time for action – updating UV coordinates each frame
Time for action – rendering a mesh's backfaces
Time for action – making a mesh not affect the zbuffer
Time for action – rendering an opaque mesh
Time for action – rendering a mesh with transparent regions
Time for action – rendering a mesh so it lightens the scene
Adding texture effects to our demo
Time for action – embedding the new art
Time for action – adding the variables we need
Time for action – upgrading the GUI
Time for action – listening for key presses
Time for action – upgrading our render loop
Time for action – upgrading the renderTerrain function
Time for action – upgrading our Stage3D inits
Time for action – simplifying the initShaders function
Time for action – parsing the new meshes
Time for action – rendering different meshes as appropriate
Time for action – switching textures
Time for action – switching blend modes
Timers, Inputs, and Entities: Gameplay Goodness!
Making our game more interactive
Time for action – adding a GUI overlay
Time for action – creating the game timer class
Time for action – adding the GameTimer class constructor
Time for action – implementing the tick function
Time for action – creating the GameInput class
Time for action – coding the GameInput class constructor
Time for action – detecting mouse movement
Time for action – detecting the keyboard input
Time for action – detecting key release events
Time for action – detecting the input focus
Time for action – creating the Stage3dEntity class
Time for action – creating the Stage3dEntity class constructor
Hiding complex code by using get and set functions
Time for action – getting and setting the transform
Time for action – getting and setting the entity position
Time for action – getting and setting the entity rotation
Time for action – getting and setting the entity's scale
Time for action – updating the transform or values on demand
Time for action – creating the movement utility functions
Time for action – implementing vector utility functions
Time for action – adding some handy entity utility functions
Time for action – cloning an entity
Time for action – rendering an entity
Design art for our new improved game world
Time for action – importing our new classes
Time for action – adding new variables to our game
Time for action – embedding the new art
Time for action – upgrading the game inits
Time for action – upgrading the GUI
Time for action – simplifying the shaders
Time for action – using the new textures
Time for action – spawning some game entities
Time for action – upgrading the render function
Time for action – creating a simulation step function
Time for action – creating a heartbeat function
Time for action – upgrading the enterFrame function
Time for action – extending the entity class for particles
Time for action – adding particle properties
Time for action – coding the particle class constructor
Time for action – cloning particles
Time for action – generating numbers used for animation
Time for action – simulating the particles
Time for action – respawning particles
Time for action – rendering particles
Keyframed vertex animation shader
Time for action – creating a keyframed particle vertex program
Time for action – creating a static particle vertex program
Time for action – creating a particle fragment program
Time for action – compiling the particle shader
A particle system manager class
Time for action – coding a particle system manager class
Time for action – defining a type of particle
Time for action – simulating all particles at once
Time for action – rendering all particles at once
Time for action – spawning particles on demand
Time for action – creating new particles if needed
Time for action – sculpting a single particle
Time for action – sculpting a group of particles
Time for action – sculpting the second keyframe
Incorporating the particle system class in our game
Time for action – adding particles to your game
Time for action – preparing a type of particle for use
Time for action – upgrading the renderScene function
Time for action – adding particles to the gameStep function
Time for action – keeping track of particle statistics
Let's see the new particle system in action!
Extending the entity class for "actors"
Time for action – creating a game actor class
Time for action – extending the actor's properties
Time for action – coding the GameActor class constructor
Time for action – creating a step animation function
Time for action – animating actors
Time for action – using timers
Time for action – shooting at enemies
Time for action – cloning an actor
Time for action – handling an actor's death
Time for action – respawning an actor
Time for action – detecting collisions
Time for action – detecting sphere-to-sphere collisions
Time for action – detecting bounding-box collisions
Time for action – creating an actor pool
Time for action – defining a clone parent
Time for action – animating the entire actor pool
Time for action – rendering an actor pool
Time for action – spawning an actor
Time for action – checking for collisions between actors
Restricting display to nearby actors for better framerate
Time for action – hiding actors that are far away
Time for action – destroying every actor in the pool
Easy world creation using a map image
Time for action – implementing a level parser class
Time for action – spawning actors based on a map image
Time for action – parsing the map image pixels
Time for action – adding more properties to the input class
Time for action – handling click events
Time for action – upgrading the key events
Time for action – drawing a title screen
Time for action – importing required classes
Adding new variables to our game
Time for action – tracking the game state
Time for action – adding variables for timer-based events
Time for action – adding movement related variables
Time for action – keeping track of all entities
Time for action – upgrading the HUD
Time for action – defining variables used by Stage3D
Time for action – embedding our new art assets (AS3 version)
Time for action – embedding our new art assets (CS5 version)
Time for action – embedding all the meshes
Time for action – keeping track of art assets
Upgrading the final game source code
Time for action – upgrading the inits
Time for action – initializing Stage3D
Time for action – upgrading the initGUI function
Time for action – upgrading the texture inits
Time for action – upgrading the shaders
Time for action – defining new actor types and behaviors
Time for action – initializing the terrain meshes
Time for action – initializing the enemies
Time for action – initializing the bullets
Time for action – initializing the asteroids
Time for action – initializing the space stations
Time for action – initializing the particle models
Time for action – creating the game level
Time for action – upgrading the render loop
Defining gameplay-specific events
Time for action – tracking game events
Time for action – handling game over
Time for action – updating the score display
Time for action – updating the FPS display
Time for action – handling collision events
Time for action – handling the player input
Time for action – upgrading the gameStep function
Time for action – upgrading the heartbeat function
Time for action – upgrading the enterFrame function
Publish... distribute... profit!