Flash Game Toolkit

The working journal for the Flash Game Toolkit. Read all about the progress and challenges I encounter in the Open Source Project. The key bits of knowledge I am hoping to gain is how to run an Extreme Programming Project and a large scale project in ActionScript. MacroMedia Flash ActionScript is a great language to prototype games in. The Flash Game Toolkit intends to build the components a board/dice/card game designer would need to put together a game.

Sunday, June 29

Custom Component Help

Sometimes the most obvious things will occur: like writing help text for the classes would be very useful. And so I found this link that explains everything. Create Flash MX Custom Component Help

I'll probably want to modify the editors help too. But that is lower priority.

Saturday, June 28

Cards and Deck

Breaking my own rule for writing the test cases first, I sat down and wrote these classes tonight. It is obvious that I will need a control class for each and I added the idea of callbacks.

The jumpstart was caused by my own realization that I played a lot of backgammon and solitaire. I would much prefer to play my own versions and be playtesting games. But in order to write the games, I need the library done. I started on cards.

Some testing ideas: tarot, solitaire, ...

Documentation: FlagCard

Public Methods:
Deck GetOwner()
SetOwner( Deck )
bool IsShowing()
SetShowing( bool )
Flip()
GetValue()
SetValue()
GetType()
SetType()

Event Callbacks:
OnShowingChanged()
OnDeckChanged()
OnValueChanged()
OnTypeChanged()

Documentation: FlagDeck

Public Methods:
Player GetOwner()
SetOwner( Player )
Shuffle()
Card ViewCardAt(index)
bool InsertCardAt( Card, index )
Card RemoveCardAt(index)
Card ViewTopCard() - get first card (not removed)
bool Push(Card) - add card to stack (top)
Card Pop() - remove card from stack (top)
Card ViewBottomCard()
bool Unshift( Card ) - add card to stack (bottom)
Card Shift() - get last card (bottom)
IsEmpty()
GetCount()
IsViewAllowed( location )
IsInsertAllowed( location )
IsRemoveAllowed( location )
SetViewAllowed( location )
SetInsertAllowed( location )
SetRemoveAllowed( location )

Event Callbacks:
OnCardsChanged()
OnOwnerChanged()
OnRulesChanged()

Constants
DECKLOCATION_ALL
DECKLOCATION_TOP
DECKLOCATION_BOTTOM
DECKLOCATION_NONE

Thursday, June 19

Counts

Added a SiteMeter free count. It is set to ignore my own hits. So hopefully I can get some feedback if anyone is reading this page.

Sunday, June 15

Breakfast Time

I feel like I have accomplished quite a bit for the first 24 hours. But now I am getting hungry and it is time for breakfast and some chores.

The ASUnit stuff is functional. It wasn't my code but I made some changes to improve the output.

The basic requirements seem solid. I think I should be able to crank through one class today -- spending time making sure I am testing properly. And then the rest of the objects will just start falling into place. Could the whole thing be done already if I didn't care about the process? Not important.

I got carried away on getting the dice to be 3D objects. But v1.1 will have that support. I think I can be clever and map all the rotational stuff into like 9 images (and paint the dots on the faces.) It may require a fixed camera angle (as if you were rolling dice onto a table but I don't think that is too restrictive.) Bouncing dice will be the v1.1 demo highlight.

Version 1.0 Specification

The first version of the Flash Game Toolkit is going to be simplistic. The goal is to get something working and some samples. Network suppport and some of the board game functionality will have to wait. But enough about what it isn't going to be...

Version 1.0 Objects and their Public Methods:

Game - The underlying game mechanics
StartGame() - initialize the game
EndGame() - the game is over
StartRound()
EndRound()
int GetCurrentRound();
SetMaxRounds( int );
int GetMaxRounds();
SetNumberPlayers( int )
int GetNumberPlayers()
Player GetPlayer(index)
Player GetCurrentPlayer()
SetCurrentPlayer(index)
NextPlayer()

Callback (application can overwrite)
OnStartGame()
OnEndGame()
OnStartRound()
OnEndRound()
OnStartTurn()
OnEndTurn()


Player - the participants
string GetName() -
SetName( string ) - the printable name
bool IsPlaying() - true if the player is active
Playing(bool) - indicate if the player is active
Token GetToken() - physical representation


Token - physical representation of player
GetColor()
SetColor()
SetOwner(Object)
Object GetOwner()
GetLocation()
SetLocation()


Bank - to handle deposits and withdrawals
float GetBalance()
SetBalance(float)
Withdraw(float)
Deposit(float)
bool IsInfinite() - some banks don't have a limit
SetInifite(bool)

Callbacks
OnBankrupt() - bank is out of money


Chip - physical representation of money
GetColor()
SetColor()
float GetValue()
SetValue(float)
SetOwner(Object)
Object GetOwner()
GetLocation()
SetLocation()


Board - keeps track of player locations and other items (cards, tokens)
[TBD]


BoardControl - the thing that draws the board
[TBD]


RandomGenerator - base object for spinners/dice
int GetValue() - get the spinner value.
SetNextValue(int) - set the final value (when spinner stops)
SetUseRandom(bool) - ignore SetNextValue()
bool IsUseRandom() - checks to see if spinner is random
int GetMinValue() - get minimum value
SetMinValue(int) - set minimum value
int GetMaxValue() - get maximum value
SetMaxValue(int) - set maximum value


Spinner - a spinning device to generate random values
* derived from RandomGenerator
Spin() - start the spinning.
bool IsSpinning() - check if spinner is moving
Stop() - force the spinning to stop
float GetFriction() - get the spinner friction
SetFriction(float) - set the spinner friction (0.0 : never stops -> 1.0 : stops immediately)
float GetVelocity() - get spinning velocity (positive for clockwise)
SetSpinVelocity(float) - start spinning velocity


SpinnerControl - the spinner display
* sample


Dice - properly called die
* derived from RandomGenerator
* derived from Object3D
Roll() - start the roll
bool IsRolling() - check if dice is moving
Stop() - force the rolling to stop
float SetGravity() - get the gravity value
SetGravity(float) - set the dice gravity (0.0 : never stops -> 1.0 : stops immediately)


DiceControl - the dice display
* sample


Card - two sided item
GetOwner()
SetOwner()
bool IsShowing() - is the front up
SetShowing(bool)
Flip() - turn over (toggle showing)
GetValue()
SetValue()
GetType()
SetType()


CardControl - physical dispay of a card
* sample


Deck - collection of cards
GetOwner()
SetOwner()
Shuffle()
Card GetCard(index)
Push(Card)
Card Pop()
IsEmpty()
GetCount()


DeckControl - physical display of a deck
* sample


Vector2D
x
y

Vector3D
x
y
z


Things likely not get pushed out...

Universe - collection of objects and mapping to 2D space
[TBD but requires gravity, bounding box,


Object3D - just the representation. drawing is up to user.
Vector3D GetPosition()
SetPosition( Vector3D )
Vector3D GetRotation()
SetRotation( Vector3D )
Vector3D GetVelocity()
SetVelocity( Vector3D )
Vector3D GetRotationalVelocity()
SetRotationalVelocity(float) - start spinning velocity
Vector3D GetAcceleration()
SetAcceleration( Vector3D )
Vector3D GetRotationalAccelaration()
SetRotationalAcceleration(float) - start spinning velocity

Saturday, June 14

Testcase Framework

The first step in making the project follow the write test cases first principle requires that I have an easy way to create and maintain the test cases. I think I found what I was looking for... except it isn't in ActionScript.

No big deal. I just have the prerequisite project for the the game toolkit.

    Requirements:
  • Simple way to create unit tests.
  • A clear way to organize and group tests
  • Indication of which tests failed
  • Automated!
  • Timing might be nice
  • Not integration testing -- the samples are for that.

Here is the inspiration: Unit Testing In Python Presentation. I'm sure this is the right thing to be doing and the right approach.

In a very dynamic language like Python, unit tests provide added safety. Unit tests make up for some of the compile time checks that you lose. This quote for the slides in the previous link explains why ASUnit is an important project to help keep my sanity while programming in ActionScript.


A bit of googling later I finally found what I was after: ASUnit

Current Status: 0%

Still in the startup phase. Lots of documentation and decisions to make. I'll probably spend a the entire first weekend making zero progress. The software philosophy of iterative design is fundamental to the way I want to operate. So I expect at least a simple game working by the end of the week.

I just decided that the project will use an MIT license. This means that everything is available freely as long as the copyright and permission notice are included. This fits my idea of eventually getting some benefits from the software myself yet opening the project up to the Open Source community for contributions. I'm not looking for the pot of gold at the end of the rainbow but I write games for a living and want to continue doing that. I hope that this project won't conflict with anything I am doing at work -- completely different genres. However I intend to get permission before I invest too much energy.

The ActionScript editor is much better than using the one in Flash itself. One prime benefit will be that I can include my own syntax for the toolkit into the parser so that it will be color coded properly. Nice!

    Current Needs:
  • ActionScript doc - some way to convert my code into documentation. May have to write my own. See javadoc.
  • Test case tools - some way to simplify all the test cases I need to write. Not sure where to begin on this.
  • Version control software - Likely to use the evaluation copy (2-user version) of Perforce.
  • Bug tracking Software - Perforce can do this with "jobs"
  • Lists of resources for this page

    Completed:
  • Installed SciTE Flash 1.5 - an actionscript editor.
  • First draft of the desired components - this will get documented nearby.

Welcome and Introductions

I just created the Blog because I thought it would be insightful (and useful) to keep track of things as I develop the Flash Game Toolkit (FlaG)

My name is Bob. I'm the lead engineer and currently the only contributor to FlaG. I work at Sony Online Entertainment. The real-life game that I have been working on is PlanetSide.

With this project I hope to learn how to create a large scale Flash actionscript application and to start using better Software Engineering principles, in particular writing test case first. I hope the blog will be insightful and useful.