The following is an attempt to summarize the features that are built into the engine. The engine itself is divided into two parts:
The Canvas is found on the left hand side of the screen. Here is where all the graphics will be displayed for our game. Canvases are defined using a tile based grid system. Tile information is stored in an XML file. A game can hold many Canvas definitions. Each Canvas can be thought of as a scene for a game. A scene may be a level, or a menu screen or a combination.
The Editor is found on the left hand side of the screen. In the header of the Editor, there is some basic version information, a title, and some basic run time stats about the current game including, FPS: Frames Per Second, Memory: being used by the game and Quality: the anti-aliasing level currently being displayed. The rest of the editor is divided into two systems. The first section is the Canvas System. The second section is the Metric System. Both systems are designed to be robust and flexible.
The first menu in the Canvas section provides some basic Controls for the game. Edit Mode is the mode used while making your canvases. It allows you to create and edit everything that will be draw on the canvas at runtime including tile graphics, characters and objects. Game Mode is used to preview exactly how everything will appear and react during game play. The Reset button will reset the canvas to it’s start state. It will also place any characters that may have moved while in Game Mode back to their original starting positions. The Save button saves any changes made to the current canvases to an XML file so that you can come back later and continue to edit.
The first item in the Canvases menu shows a list of the canvases currently in our project and provides buttons to both add additional canvases or remove current ones.
The next item is the Layers controls. Isometric canvases currently only allow one layer however, 2D tiled canvases allow a Foreground, MidGround and Background options to be used. These layers allow for paralax scrolling effects often seen in Super Mario type platforming games. In addition there is also a Visible checkbox which, while in Edit Mode, allows the editor to show and hide the particular Layer for easier drawing and editing.
The next item allows you to select a Background Fill Color. This simply provides the Canvas with a color that will appear behind all tiles and graphics drawn on it.
Next is the Tile Library drop down box. Here you can select from a list of available tile libraries that match the current tile size and style of the canvas you are currently editing.
Belwo the Tile Library is a Gravity toggle. Here you can enter a number that will determine the strength of the downward pull on characters on your canvas. It will automatically set itself to acceptable values if the values entered are too large. Also, Isometric canvases currently do not have the ability to support gravity effects, only 2D canvases do.
The next item is a GUI dropdown box. Here we can assign any available GUI elements to appear on top of the currently selected canvas.
Let’s take a look at the menu we would see if we clicked on the ADD CANVAS button.
First thing is to name your new canvas. Second is to choose if this canvas will be a 2D or Isometric style. Once a style is chosen, the options vary a bit from there.
If we are making a 2D canvas, you are given a choice of 3 different pixel dimensions for your tiles. You are also given 3 different Map Orientation choices. A Wide orientation sets the a default number of tiles high, depending on your selected tile size and overall height of your Flash file, and allows you to choose how many tiles wide you want your canvas to be. A High orientation sets the default number of tiles wide, also depending on your selected tile size and overall width of your Flash file, and allows you to choose how many tiles high you want your canvas to be. Square orientation provides you with the option to choose how many tiles square you would like your canvas to be.
If we are making a Isometric canvas, your options are slighted limited compared to 2D. Here there are two options for pixel dimensions of your tiles. Unlike 2D tiles, which are square, Iso tiles are diamond shaped, where they are twice as wide as they are tall. Square is the only orientation permitted when using an Iso canvas. This is to prevent wasted bitmap data. Since Square orientation is the only option, only the number of tiles square must be entered.
All entered vales for Map Size will be auto edited down if the value entered is too large to be handle by the engine. Current standards of the engine limit any one dimension to 3200 pixels.
Nodes are basically a class that hold a bunch of information together and then are boiled down to just the important bits for an editor. There two types of Nodes that can be used on any canvas. The first type is a Character Node. Characters are sprites that can be moved around the canvas during gameplay and contain animation sequences. The second type is an Object Node. Objects are static graphics or shapes that do not move and contain no frames of animation. One important thing about nodes is that they are both Depth Sorted together during gameplay. This is used mainly on Isometric canvases where it is important for a moving Character Node to appear in proper Z depth position in relation to the other characters and objects on the canvas.
Let’s take look at the menu for adding a new character node.
Once you name your new character, you can use the Character Library drop down box to select from the available characters to use on your current canvas type. Like the Tiles Library drop down for Canvases, this library is always pre-populated for you with the matching type.
Next you must select the graphic representation for your new character. The first icon is a unique icon that represents a camera. The camera icon will appear on the canvas while you are in Edit Mode, however it will be invisible while in Game Mode. This allows you to put basically an invisible character on the screen but still be able to use any behavior that a visible character would have available.
The next step is to enter the Start X and Start Y of the character. This is start tile location from which your character will start it’s journey.
Next, you must enter a BBox Width and BBox Height. This is the pixel dimensions of the bounding box of a character. The bounding box is used to detect collision with walls, objects and other characters. By default is set to slightly smaller than the pixel dimensions of the tiles on your current canvas. A bounding box can be smaller in dimensions to the tiles but never larger. The values will reset themselves if the values entered are too large.
The Mass of the character is the next item you must set. The Mass will effect how much time it takes a character to accelerate to it’s top speed in any direction. A higher mass means slower acceleration.
Horizontal Maxspeed is max number of pixels a character can move horizontally in one frame.
Horizontal Resist is the amount of friction a character faces while trying to move horizontally across the screen. This should always be lower than the Horizontal Maxspeed or else your character will be unable to move in the horizontal direction.
Vertical Maxspeed is the max number of pixels a character can move vertically in one frame. For 2D canvases this is often used for jumping, however for Isometric canvases, which there currently is no jumping, this should be set to the same as the Horizontal Maxspeed to insure an even speed for you character on both the horizontal and vertical lines.
Vertical Resist is the amount of friction a character faces while trying to move vertically. Again, this usually effects jumping on a 2D canvas and should be set the same as Horizontal Resist on an Isometric canvas. This should always be set lower than the Vertical Maxspeed or else your character will be unable to move in the vertical direction.
Next you have the ability to set the Framerate for the character. This gives you the ability to vary the framerate of the characters animated sequences, meaning it doesn’t have to run at the same framerate that the overall game is running. Using 1, sets the framerate of the characters animation to the same as the game. Using 1/2 sets it to half and using 1/4 sets it to one quarter. This option is there to save you from having to creating animated sequences with a large amount of frames when creating a sprite sheet for a character.
The last thing that needs to be set for a character node is a Behavior. The Behaviors are what will tell the character how to behave during gameplay. Currently there are two options, None and Player Controled. Player Controled gives the character the ability to move, while in Game Mode, using the arrow keys and the spacebar to jump. Player Controled also will keep the character always on screen. For Isometric canvases, the Player Controled character will always appear in the center of the screen. For 2D, it will keep the player in the center of the screen until it approaches the edges of the map.
Object Nodes differ a bit from Character Nodes because the don’t require as much information. Object Nodes contain no frames of animation and no script can be attached to them. All they require is an image and an X and Y or tile column and row location on the map. The best example of this could be a building that is part of the scenery in an isometric game. I should mention that Object Nodes do get Depth Sorted in an isometric scene. So a moving character can move inbetween Object Nodes and maintain proper Z depth.
To place an Object Node on your map, select and icon and roll your mouse over the map and place it where you would like it.
The Metric System
The Metric System was created to execute and manage all Events and Numbers that need handled in a game. Using a series of forms, even a non-programmer can enter Metrics and Events for use during game play. All the information used by the Metric System is stored in an XML file.
First let’s take a look at Metrics, which are basically any value that will need to be tracked during the game. They could be anything from a player’s health to how much money the player has collected.
To add a new Metric, simply click ADD under the Metrics menu. Then give it a name and a start value. The Metrics menu displays the list of Metrics in the game including the Start and SimValues. The SimValue will change during game play according to it’s current value.
Two other things you can set here are the Allow Negative Values toggle, which determines if your Metrics are permitted to drop below zero during game play or not, and an AutoSave toogle. This allows anything you enter under the Metric System to be auto saved to the games XML.
Markable Sub-Metrics are values that can be set to change automatically during the course of a game. Although not useful in every type of game, they are relevant enough that I built them into the system.
To create a new Markable Sub-Metric, click the ADD button. Just like Metrics, you need to enter a name and start value. Once the Markable Sub-Metric is added to the list, you can then set different Marker values. To advance to the next Marker, click the right arrow in the Marker toggle. Then change the MarkerValue next to the Sub-Metric you wish to change. You can use the Marker arrows to toggle back and forth between which marker you are looking at. This version of FLAG sets a marker at every 10 player turns. This is what we found useful for the first game we built with FLAG. Future versions will most likely have this as an adjustable number.
Inbetween the Markers, the values of the Sub-Metrics change automatically. The values gradually change over the amount of turns to the next marker value. For example, if the first MarkerValue for a Sub-Metric is 0 and the second MarkerValue is 10, over a span of 10 turns ( the distance between markers), the value of the Sub-Metric at turn one would be 1, at turn two it would be 2 and so on until turn ten where the next MarkerValue is 10. It may sound confusing, but it’s relatively simple with a bit of practice.
Events represent just about everything that happens in a game. Their main function is to adjust the Metrics and Sub-Metrics of the game. Currently there are four types of Events built into FLAG. To add a new Event, simply click ADD under the Events menu. The Event types are Build Events, Multiple Choice Events, Slider Events and Happenstance Events. When creating a new Event, the author is required to choose one of the four Event types. Then, depending on the selection, the author is presented a form to fill. The form for every Event type is similar but contains minor differences to supply the proper data. Some of the standard items included on an Event form include the Event’s name, display text, one time metric effects, recurring metric effects, prerequisite events and repeat limit.
The one time metric effects datagrid holds all the information about how an Event will effect the Metrics and or Sub-Metrics when this Event occurs. The rows of the datagrid represent the Metrics available to be altered. The columns represent the methods used to alter the Metrics. These methods include an Amount, a Diminisher, and all the Sub-Metrics.
The Amount column can hold a couple of different values. First, an author can enter a number in the Amount field. That number will then be combined with the value of the corresponding Metric value after the Event has occured. Second, an author can enter a multiplier in the Amount field. The syntax for this is a number followed by an x or X. Multipliers are used when an author wishes to use Sub-Metrics to determine the Metric effect of an Event. The multipler will take the total of any included Sub-Metrics, multiply them by that number, and then combine that value with the current corresponding Metric value after the Event has occured. To include a Sub-Metric in a multiplier calculation, an author can place either a + or – sympbol in the Sub-Metrics column. Sub-Metrics themselves can also be altered here, please see the next paragraph for information on Sub-Metric alterations. The Third way an author can fill the Amount field is with a number followed by a % sign. This takes a percentage of the corresponding Metric value and combine it to the current corresponding Metric value after the Event occurs. All three of theses option can be negative if preceeded by a – sign.
Sub-Metric alteration is indicated using (). Inside the () an author has several options. First a + or – should be entered to indicate and addition or subtraction to the current Sub-Metric value. Second a number should be entered. Third a p or an s should entered. The ‘p’ represents a perminant change to the Sub-Metric. Meaning, after this Event occurs, the Sub-Metric value will remain the new value, unless further changes occur later. The ‘s’ represents a spike change in the Sub-metric. A spike sets the Sub-Metric to the change value and then gradually returns to the next marker value. A fourth option an author has is to enter a % sign after the p or s. This will take a percentage of the curent Sub-Metric value and then perform the previously describe actions. As an example, let’s say an author enters -(+50p%) in a Sub-Metric’s column. The action performed here would be taking 50 percent of the current Sub-Metric value, adding it to the current Sub-Metric value and perminately altering that Sub-Metric to the result. Then, indicated by the – sign in front of the () statement, it would take a negative of the new value to use with a multiplier for the current row’s Metric value. If it sounds confusing, that’s because it is. But, it does add a huge amount of flexibility and control in a relatively simple form.
Next let’s look at the Diminisher column. The Diminisher is designed to allow an author to increase or decrease the over all effect of an Event on a Metric if the Event is occurring a second or multiple times. The Diminisher field should include a + or – symbol and a number. This value will be combined with the Amount field of the corresponding row whenever this Event is occuring a second or multiple times.
The recurring metric effects datagrid holds all the information about how an Event will effect the Metrics and or Sub-Metrics for the rest of the game, or everytime an Event occurs. It follows the same syntax rules as the one time effects datagrid.
The prerequisite event field requires a number, or numbers seperated by commas, of other events that must occur before this event is permitted to occur.
The repeat limit field requires a number that represents the amount of time this event can occur during a player’s game before it will no longer be permitted to occur.
The Events Simulator allows and author to run any of the Events by selecting an Event under the Events menu, and then clicking on Selected under the Events Simulator menu. The simulator then calls the displayEvent function in FLAG’s GUI class which displays the event for interaction in the Canvas. Once run, an author can see the effects of an Event on the Metric values by looking at the Metric SimValues column under the Metrics menu. In addition to running a selected event an author can choose to run random Events using the Random button. This will find a random Event to run following any prerequisite and repeat limit rules established by the Events. An author also has the option of simulating any amount of turns using random events using the Simulate Game button and the field next to it, which represents the number of turns to be simulated. The Reset button clears the current game in progress and returns all values to their start state.
The Event Simulator is designed to help with user testing without the need of actual users.
Although heavily rewritten and customized for Econ U, the Event History menu is designed to show a brief synopsis of the Events that have occured during the current game. It shows information such as the turn number when the event occured, the name of the event and the effects it had on the game’s Metrics.