The Game Plan: Getting Started

Leave a comment Standard

Your game design can run fairly smoothly or it can be a continuous cesspool of hardships and setbacks and pain points. In the next few series of posts I’m going to try and help walk you through the process of getting your game up and off the ground, from what you’re envisioning in your head to an actual working version. So, let’s get started.

1. Get It Out Of Your Head

It’s time you pull out a pencil, pen, or open your laptop to a writing program. First thing’s first, you have to get your game out of your head. Write it down and put it somewhere you can reference it later.

2. Writer’s Block

So if you’ve opened a text editor or you have a pen in your hand you’ve successfully completed step one. Now, what do you write? I like to start with the five W’s:


  • Does your game appeal to a specific age range or interest group or gender or even ethnic background?
  • Will you have a large audience your game will appeal to or a small audience?
  • What are the benefits and downsides of the audience you’ve identified?


  • What kind of game are you trying to make?
  • What programming language best suits this kind of game?
  • Does it fit into a specific genre of game or does it span multiple genres?
  • Does it embody a completely new genre?
  • Can you find other games that are similar to the game you are trying to make? If so, what do these games do well and where do fall short?
  • Are there lots of other games on the market similar to the type of game you’re trying to make?
  • What will your charge for your game?
  • What do other, similar games of this type charge?
  • What are the benefits and downsides of the type of game you’re trying to make?


  • Where does your game take place?
  • What kind of maps or features or environment are unique to your game?
  • What are the benefits and downsides of where your game takes place?


  • When will you have time to work on this game?
  • When can you start this game?
  • When can you fund the development of this game?
  • What are the benefits and downsides of developing this game?


  • Why are you making this game?
  • Why is your game unique?
  • Why will your game stand out from the crowd?
  • Why will people choose to play your game over other similar games?
  • Why will people pay for your game?
  • What are the benefits and downsides of making this game?

3. Make A Design Document

Your design document is a refined version of everything you’ve written down in step 2. Go back and really analyze what your goals for the game are and if what you’ve written down makes sense in the larger picture. Sometimes a good idea you have for one area of the game will conflict or make another part of the game tedious, uninspired or downright frustrating. For a game design document I like to use the following format:

  1. Intro
    • What is the vision for your game and a short description of how the game is played
  2. Audience, Platform & Marketing Strategies
    • Who the game is for, what platforms you’re making it for and what sets your game apart that will make it marketable and different from others
  3. Core Gameplay & Mechanics
    • How the game is played including physics, rules and limitations
  4. Characters
    • What characters are in your game including what they look like, their names and backgrounds and personalities
  5. Story, Themes & Twists
    • If your game has an overarching story then you’ll outline your plot and how the game progresses with the story line
  6. World
    • Describe the world your game is set in, including maps and locations and their purpose or importance
  7. Assets
    • All the different images, music, animations, etc that you will need to have a fully functional game
  8. Technical Specs
    • What language you’re using, how games are loaded/saved, where games are stored, the number of servers you’ll need and anything else relating to the technical setup of your game
  9. Interface
    • What the game interface looks like and how the player will interact with it
  10. Outside References
    • Articles, links, design inspriations, or anything else that you’re using as a reference for the game you’re making
  11. Appendix
    • Code style guidelines, dictionary of terms, and anything else that is important for understanding your design document that may not necessarily relate to your game directly

Once you’ve fully fleshed out your game design by going into depth about the features, physics, economy, weapons, characters and how the game works it’s time to break it down. Start by creating lots of of small, easy tasks you can accomplish in order to see your core game mechanics to completion enough that you could play a simple version of your game without any extra bells and whistles. Set yourself up to do as little as you have to but as much as you need to in order to get a really simplified, yet completed, version of your game.


Why Making A Game Takes the Fun Out of It (and how to fix this)

Comments 4 Standard

I see it all the time, people coming into forums and online communities for games and game developers asking how to make a game or how to get their ultra cool idea that everyone will love and has never been done before off the ground and make it a tangible reality. Let’s get things straight, we love games because they’re fun and entertaining. It drives our creative vision and imagination and offers an escape from the mundane and the boring reality that is our lives. This passion, this drive to express ourselves and have fun is often what leads people to try their hand at making their own games. Many will start this journey but very few will finish it and even fewer will finish it with a successful and positive outcome (and let’s face it, money in your pockets). So why does this happen? Why do so many people start down this path of learning and creativity and adventure for fun that ends up leaving them broken, frustrated and depressed? The reality is that games are a lot of work and the very nature of making a game isn’t even a little bit fun. In many ways it’s the exact opposite of what we’re trying to achieve. So how does this happen and what can we do to fix it? Let’s break it down from the point of view of an Indie game developer whose a one man shop (or small shop) trying to make a game.

Lack of skills

You want to make a game but you’ve never programmed before, you don’t know anything about what’s required to make the type of game you want to create and even if you have those things covered you may not have all the skills you need to make it happen. Just because you can program doesn’t mean you can draw or compose artwork or market your finished product if you ever get that far. As an indie game developer you really have to be a jack of all trades. Think about trying to build a house if you’ve never built a house before. What happens if you only know how to frame the house but not how to do plumbing and electrical and tile work and all the other things that are required to finish the house? You end up with just the shell of a house that is lacking in so many ways you can hardly call it a house. This is one of the biggest problems I see with indie game devs — they lack the skills to accomplish what they’ve set out to do and they’re not prepared to outsource when they need to, which brings me to my next point.

Budget constraints

Making games is inherently expensive. Even if you create your own game framework and develop your own models/artwork, sounds and music you still have to — at a minimum — invest in a computer and dedicate hundreds of hours towards the development of your game. Those hours add up and while you’re developing your game you’re not earning a living that you need to support yourself and/or your family. Yes, that’s right, you still need to eat and buy necessities and support yourself and/or your family which is why even if you do have the funds outsource some of the work you lack the skills for you’re still fighting a losing battle towards my next point.

Time constraints and distractions

Supporting yourself and your family means that you’ll still need a full time job even as you chase the ethereal dream of creating your own game. Your time is precious and what little of it you have left after your regular day job has to be split between your other financial and personal commitments. Your kids need their parents and your house and car need to be maintained and you’ll struggle to find the proper work/life balance amidst all of the chaos that you juggle on a daily basis without adding the complexities of your game into the mix.

Technical problems, bugs, new frameworks and advances

So even if you can overcome all these odds so far you’ll still find yourself stuck hitting roadblocks as your game progresses. Technical problems you didn’t predict or forsee early on (and how could you, you’re still just learning yourself) end up being the bane of your game’s existence. Now you have to go back and re-write and re-factor and debug until you’re so frustrated you could pull all of your hair out and go bald. New frameworks and technological advances will make your second guess yourself or roll back to square one because you really do want to upgrade your SDK and add in the new dynamic system and better bump map texturing because who doesn’t want their game to be using the newest, latest and greatest technology available? No one wants to play a game that doesn’t have the same bells and whistles that their competition does because they took the the extra time/budget/testing cycle hits to go with the greater tech.

Slow progress and scope creep

Ultimately these things combined will drag your game down. What may have started off well and progressing quickly has suddenly slowed to a snail’s pace. Things suddenly feel like they’re never getting done or you have so many issues on your plate that it feels like there’s never an end in sight. Your game has hit a standstill and isn’t advancing like it was in the beginning and this is awfully discouraging and frustrating. The scope of your project has suddenly tripled and your todo list is a never-ending tally of bug fixes and re-factors and speed optimizations that need to be addressed for any chances of your game seeming like it’s something worth playing.

Early demo failures and monotonous repetition

If you’ve made it far enough to put together early demos and alpha access then pat yourself on the back — most people will never make it this far and you’ve just become a member of an elite club that deserves a badge of honor. The only problem is your demo gets horrible reviews, you realize your controls are too hard to use and this puts you into a crazy monotonous cycle of playing a particular part of your game over and over again as you attempt to fine tune it and make it more playable and more fun.

Never good enough

Unfortunately the truth is that your game will never be good enough. Someone will always find something to complain about even if you see some great feedback and helpful critiques that, if implemented, could really take your game to the next level and set you apart from your competition. Your controls will never be 100% perfect, your menu system may be too hard to read or too complex to navigate and you’ll never quash all the bugs that have been reported partly because you can’t re-create them all because your game is being run and tested under hundreds of different environments and hardware and operating systems that you didn’t have access to (and probably never will) as you were developing. If you’ve made it here this might just be the time for you to throw in the towel and say goodbye to all the blood, sweat and tears you succumbed to in order to make it this far.

Overcoming It All

If this has discouraged you against making your own game — good. Making a game isn’t easy and it’s not something for everyone so don’t waste your time early on if you’re not prepared to go through everything I’ve already mentioned and be able to walk away without anything to show for it. However that doesn’t mean you shouldn’t make a game or that it’s impossible to do it either. Where there is a will there’s a way and let me show you how.

  • Map out your game design, features, characters and how the game works. Now create lots of small, easy tasks you can accomplish in order to see your core game mechanics to completion enough that you could play a simple version of your game without any extra bells and whistles. Set yourself up to do as little as you have to but as much as you need to in order to get a completed version of your game.
  • If you lack the skill to do something you have two options. The first is that you resign yourself to taking the time to learn this new skill and the next is that you can outsource the skill to someone who’s already achieved it. You don’t have to be an expert programmer to make a game, just an adequate one. If you’re going to invest time into learning a new skill don’t dwell on it for too long, learn enough that you feel confident you can accomplish the task at hand and then move on. Investing too much time in learning a skill will start you down a path that walks further and further away from working on your game.
  • Sit down and map out all of the expenses you foresee as being necessary to complete your game. Now triple it. If you can’t afford to spend this amount of money into your game then you need to go back to your concept and re-work it until you get a budget that you can work with. If you’re really determined you can look for some outside investors but don’t count on this — ever. Most investors want to see a fully working demo before they’ll even consider opening their pocketbooks and investors will demand more than 50% of whatever profits you make from your game when it’s done.
  • Your time is precious when you have so little of it to devote to your game. Start by mapping out a timeline of your game features/assets and how long you think it will take you to accomplish them. Now double that. Now compare that to how much free time you really have to devote to your game. Will this game take you more than a year to complete? Do you have the dedication to spend more than a year working on a single project? If the answer is no then you need to go back to the drawing board until you’ve come up with a reasonable timeline that you can work with. Keep your game as small as you possibly can by focusing on the core mechanics and leaving out any fluff that you could add at a later date. Now stick to your timeline. If you budget 2 weeks to work on a character and by the end of the second week the character isn’t done don’t dwell on it — either move on to the next item in your list. Don’t adjust your timeline and don’t spend more time that you budgeted on this part of it. Sure, your ultimate goal is to have a working character with great animation but if you can’t ever get a game working with a broken character then who cares if your character’s animation is jerky or unrealistic? Think about the big picture because you can always circle back later.
  • Invest in a good debugger and testing tools. Do whatever you can to automate this process as much as possible because it will give you more time to work on trivial issues when you can quickly address and fix the larger ones. If you run into a bug that makes your game do something funky but it doesn’t prevent the gameplay from continuing table it and work on something else. Try not to get caught up in the more minute issues and focus more on the big picture. You can always circle back and fix bugs later but if you spend all your time bug quashing you’ll end up with a pretty interface or character or scene that doesn’t let interact and play with it. Pick a version of a framework and stick with it, don’t upgrade it unless you absolutely have to. The more you upgrade and update to the latest and greatest the more issues you’ll run into and the more refactoring and scope creep you’ll run into. It’s okay to build a game that isn’t using the latest and greatest version of your frameworks or 3rd party integrations. This will also give you a chance to work with and around the quirks in the version of the framework/software you chose to use instead of having to re-work around these every time you upgrade and re-factor.
  • Get the core mechanics working version of your game finished as early as possible no matter what it looks like or how bad it is. A crappy, ugly, glitching yet working version of your game is better than a pretty, perfectionist, bug free version of your game that isn’t at all playable. Don’t wait until the last minute or the week before it opens to get feedback on what you’re doing. Feedback is a great way to find issues you hadn’t considered and it will give you an idea of what other people think about your game. After all, no one wants to play a game they don’t think is fun. Don’t ignore constructive criticism even if it’s not what you want to hear. That doesn’t mean you have to change or add anything anyone has ever asked you for — it means that you need to take those things into consideration going forward. See past the reviews that focus on your aesthetics — at least initially — because you can always change and fix those later, core mechanics and gameplay are much harder to tackle once you’ve invested lots of time and energy into them.
  • Your game will NEVER be perfect. You will always be tweaking, adding, adjusting and fine tuning it. Instead of wasting your time doing this early on and ending up with something that isn’t a viable product devote that time to your game after you have something you can put out there. Don’t be a perfectionist, no matter how many bugs you quash and features you add or tweak there will always be another bug or problem coming down the pipeline. Try to prioritize the most important ones and tackle those first. Ultimately you want to get something up and working no matter how good or bad it is and then build upon it from there. Rome wasn’t built in a day so don’t expect your game to be. Get a working version up first and foremost and then add on to it and enhance it over time, your customer base won’t hate you for that, rather the opposite — they’ll appreciate your continued efforts to improve upon what you’ve done so far.

Use Play Testing To Reduce Your Game Development Costs

Leave a comment Standard

What Is Play Testing?

This is a technique where you build a working version of your game and play it before you ever release the game to market. So you may be asking yourself, how does this reduce my game development costs if I need a working version of the game before I can play test it? The answer is simple: create your working game in an inexpensive medium. So what if your marketable game is going to have cutting edge graphics or high poly 3D models or even stunning visual effects that require months of complex mathematics and physics and matrices — with play testing you can see how well your core gameplay and mechanics work (or fail) without any of those expensive bells or whistles and in a lot less time.

How Do I Play Test?

I generally break this down into six steps.

1. Define your core game components, mechanics and boundaries

Start by sitting down and thinking about the core components of your game. How does your game work? How could someone play a physical manifestation of your game?

2. Write the game rules

Now that you know all of the components of the game you’ll need to write up a set of rules. Your play testers will use these so they know how they should play your game. If you can’t identify any rules for your game then you’ve found your first problem — you don’t actually have a game yet and it’s time to go back to the drawing board.

3. Gather your materials

Not all games need materials but you probably will even if it’s as simple as a few pencils and some blank sheets of paper. It’s time to visit a local arts and crafts store and buy whatever you think is necessary for someone to play a simplified version of your game — be creative to keep your costs low (ie use paper balls instead of nerf balls). You will need enough materials for at least one person to play your game. If your game is multiplayer you may need to invest a bit more so you can let multiple people play together.

4. Get lots of people to play your game

This is pretty much self explanatory but it’s also a really deep topic. Other than to say the more people who you can get to play the better, I’ll come back to it later.

5. Analyze your results

You can take a lot away from a play testing session. Did your player(s) struggle understanding the rules or sticking to the rules because they weren’t clearly defined or they didn’t make sense. Did your players pick up the general mechanics and components of the game quickly? Even if you have a negative response to both of these areas don’t panic! This is a good indication that your rules need improvement and that other materials or aids might be required (ie tutorials) before your players can really understand what you’re asking them to do.

6. Finding the fun

Ultimately your play testing session boils down to did your player(s) enjoy themselves? Was it so long and complex that they quickly lost interest or was it so fast paced that they finished almost as soon as they started? Where they laughing and becoming immersed in the experience or growing frustrated and angry? Did they feel sufficiently challenged? Some people find asking their play testers questions about their experience helpful and often times will ask for them to fill out a feedback sheet or a survey when they’re done. Personally I prefer just watching people play. Watching someone play your game will give you a huge amount of feedback and target areas in need of improvement all without breaking the bank. Remember that it’s okay to go back to square one and start again if your play testers don’t have a positive response to your game. The best part about negative feedback is that it just saved you from spending lots of time, energy, resources and money on a game no one thinks is fun.

Who Should Be Play Testing Your Game?

Okay so I kind of glazed over step four because I wanted to devote a whole section to it. I always start play testing with my target audience. Your target audience should be the age range and gender you believe your game will most appeal to. For instance, if I was intending to make a game for young children I would keep in mind their computer skills, the types of devices they are most likely to play on, their hand-eye coordination, their cognitive abilities in understanding themes, stereotypes and story development. Each of these would be adjusted based upon what I expect young children would find fun and amusing — loud silly noises, larger buttons, brighter colors, less text to read and rules introduced slowly and over time to build complexity.

Now your target age range and genders should all be play testers — but so should other groups. Don’t limit yourself to only your target audience or your may miss gaining valuable insight to how people play and interpret your game. Although you may be designing a game for young children you may find that your target audience has missed it’s mark when the young children have only negative responses to your play testing sessions while a different group of play testers find your game the perfect mix of fun and challenging entertainment.

There’s also a matter of size to consider. Even if your game is single player, what happens when you ask two people to play it together? This may (or may not) change your game dynamics for the better or lead you in a completely different direction that ends up becoming something much more successful that what you had to start with. In that same vein, push the limits. What happens if you triple the number of players who are playing at a time? This is especially important for multiplayer games where your play testers end up being on a small segment of the number of players who will ultimately be playing your game. You might suddenly find your calculations for resource management fall short when your player base grows exponentially or that the influx of players completely changes the pace and feel of the game — for good or for bad.

So, What Are The Advantages of Play Testing?

  • Testing early makes it easier to discover and fix problems
  • Increasing and decreasing the number of players at a time can help you find new and interesting perspectives and aspects of your game you had not yet considered improving or expounding upon — and they may be the best features of your game
  • You can work in a controlled environment and see how your games is affected by a specific number of players influences game factors such as economy, resource depletion, or competition.
  • Watching people play will help you areas of the game players find confusing or not challenging enough
  • You can find your true target audience, not what you think or feel your target audience should be
  • Players can give you valuable feedback before the game is put out to market
  • Reduced costs of game development, you won’t have to go back and fix features of the game players don’t like when the game is out to market — you’ve already identified those areas through play testing
  • This gives you the ability to go back to square one at any point in time, and then bring your changes back to your play testing groups until you get it right


Game development is expensive so do yourself a favor and make sure you’re spending your money on a game that’s going to help you reap the rewards of all your hard work. Play testing is easy and much cheaper than spending your money on a game that’s only going to flop when it hits the market.

How Do I Get Started Making An Online Game?

Leave a comment Standard

This is something I’ve been asked fairly often. If you’re interested in starting your own online game here’s a few things to get you moving in the right direction.

What game are you going to make?

Let’s not put the cart before the horse. Before you can even consider making an online game you need to decide what kind of game you’re going to make. I don’t care if it’s as simple as tic-tac-toe or hangman or as complex as world of warcraft, you’ll need to sit down and put some serious thought into what you want to accomplish before you set yourself to the task. Take some time to write out all of the things you want your game to do (or not do) and create a design document with an easy to follow checklist — this will allow you to check off all the things features and functionality in your game as you work on it.

What programming language are you going to use?

Take a day or two to look at several different programming languages. Which one will make it easiest for you to accomplish all of the goals and tasks you set down in your design document? Choosing the language you’re most familiar with won’t always be the best choice in the grand scheme of things. If you’re not sure which programming language your game is best suited for then try joining a programming forum and getting some honest feedback from senior programmers and developers who can help steer you in the right direction.

Can you afford an online game?

Now that you have a design document and you know what programming language you’re going to use it’s time to get down to facts and figures. How many servers will you need to get your game up and running and what will that cost you? How will you pay for your domain name or any specific software or artwork you’ll need to get your game where you want it to be? Pull up some kind of spreadsheet software and track down the prices for everything you need and add it all up. What will it cost you monthly and yearly? If you’re short on cash you can try to develop via a local machine however this won’t always give you the same experience, environment and the same range of problems as a live setup will. In addition, some programming languages/games require multiple servers in order to work properly so developing locally isn’t always an option.

How long will it take you to develop your online game?

Once you’ve figure out prices it’s time to consider how long it will take you to create your game. This will help you understand what your development costs are before your game is even up and running. There’s no easy way to figure out how long it will take you to make your game, however, you can break up your game design document with estimates (and DEADLINES!!!) on how much time you want to spend on each feature. Try to stick to those and you’ll be more successful in getting your game up and running on a timeline you can afford.

Do you have enough time and money available to dedicate to an online game?

Now you know what it will cost you and you have an idea of how long it will take you to complete your game. This is the make it or break it point. Can you afford the financial burden of getting your game developed and open to the public? What happens if it doesn’t bring in any money? Can you afford sustaining your game (or sadly closing it) if it doesn’t live up to it’s expectations? What happens if you go past your deadline and your game isn’t done yet? What will you do? Do you have enough time to set aside for the development of your game and stick to your deadlines? Will you have time to devote to your game after it’s done to answer emails, manage content, fix bugs and add new features? If the answer to any of these questions is no then you’re not ready to make this game. Shove it in a file — please don’t throw it away and waste your hard work or time — and come back to it again in the future. Go back to the first step and start over again. You can design a new game or the same game over and over again until you can answer every single one of these question with a yes. That means you’re ready to start.

Get setup and start, don’t procrastinate.

When I say you’re ready to start I mean it. Don’t put it aside another second, pull out your wallet to rent some server space or build your local development environment and get started. No excuses. The longer you wait and the more you put it off again and again the less of a chance there is of anything ever getting done. It might be hard and it may take a whole lot of blood, sweat and tears but your efforts will be rewarded with a finished product — whatever that may be.

Start small and simple.

There’s nothing wrong with starting small and keeping things simple. Most working, successful ideas and concepts start out that way. Over time you can refine and re-work the idea until it becomes larger and more complex. Let your game follow the same example. Start with anything on your list that’s simple and you can finish quickly. As you finish these small, simple tasks and features of the game you’ll get a greater feeling of accomplishment and it will encourage you continue to working towards the larger and more complex parts of your game. It will also help you stay focused and stick to your deadlines.

Push through the pain!

When all hope seems lost keep going, don’t stop. Even if your code is horrible or your have hundreds of bugs that you can’t fix don’t let it prevent you from completing your game. Nothing is or ever will be perfect. Instead strive to do a little bit better next time, and a little bit better the time after that. Rome wasn’t built in a day and neither will your game or your programming skills.

If at first you don’t succeed… don’t be afraid to close the game and try again.

So at this point your game should be finished and open to the public. Even if you advertise the heck out of it not every game will be a success or work out quite the way you wanted it to. Some people may laugh at it, criticize the graphics, or even tell you it’s repetitive, boring or it’s all been done before. Don’t let anything stop you from taking everything you’ve learned so far from going back to step one to try, try, try again. Whether you close your game or go through a few more iterations to add new features, fix problems and make it better, it will be GUARANTEED to fail in some way, shape or form. Nothing in life is set in stone — if something doesn’t work change it over and over again until it gets the job done and then exceeds your expectations. Every time you make a game or improve upon an existing one you’ll learn more, become a better programmer and game designer, and take another further step down the path of having the next big hit game on the Internet.

PHP Tutorial: 2 Player Tic-Tac-Toe Game (no database required)

Comments 13 Standard

In the first part of my games tutorial series we created a PHP Hangman game and then in the second installment we converted Hangman to use AJAX. Now it’s time to follow the same approach, only with Tic Tac Toe.

The Beauty of Classes

One of the things I like about classes is how easy it is to use and reuse them without writing a lot of code to go with it. So to start our Tic Tac Toe game we’re going to copy all the files from our original PHP Hangman game. We won’t need to change anything in the game class but we will need to make some modifications to the other class. First we’ll remove all references to letters, then we’ll remove any functions we don’t need anymore. Finally we change the main functions to display a Tic Tac Toe board instead of our hangman pictures, and finish it off by changing the logic behind how you win a game and how you make a move in the game.

Our new Tic Tac Toe game will need a player (or turn) variable so we know whose turn it is to place an X or an O. Then we’re going to add another variable to keep track of how many guesses have been made — that makes it easier to figure out if there’s a tie game instead of looping through the whole array each time someone guesses. We’ll also need a new array called Board to store all of the X and O’s placed on our game board.

The Index File

We’re going to keep things as short and easy as possible. The only changes we have to make to our index file is to load a tic tac toe game instead of a hangman game. Then we change the page title and we’re nearly done!

* File: index.php
* Author:, LLC
* Created: 1.31.2012
* License: Public GNU
* Description: PHP/MySQL Version of 2 Player Tic Tac Toe

//this will store their information as they refresh the page

//if they haven't started a game yet let's load one
if (!$_SESSION['game']['tictactoe'])
    $_SESSION['game']['tictactoe'] = new tictactoe();

        <title>Tic Tac Toe</title>
        <link rel="stylesheet" type="text/css" href="inc/style.css" />
        <div id="content">
        <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
        <h2>Let's Play Tic Tac Toe!</h2>

The Updated Class File

Here’s the class file with our updated game logic. Can you see how similar it is to our hangman class file? What’s changed and what looks the same?

* File: oop/class.tictactoe.php
* Author:, LLC
* Created: 1.31.2012
* License: Public GNU
* Description: tic tac toe game

class tictactoe extends game
    var $player = "X";            //whose turn is
    var $board = array();        //the tic tac toe board
    var $totalMoves = 0;        //how many moves have been made so far        

    * Purpose: default constructor
    * Preconditions: none
    * Postconditions: parent object started
    function tictactoe()
        * instantiate the parent game class so this class
        * inherits all of the game class's attributes 
        * and methods

    * Purpose: start a new tic tac toe game
    * Preconditions: maximum number of guesses
    * Postconditions: game is ready to be displayed
    function newGame()
        //setup the game

        //reset the player
        $this->player = "X";
        $this->totalMoves = 0;

        //clear out the board
        $this->board = array();

    * Purpose: run the game until it's tied or someone has won
    * Preconditions: all $_POST content
    * Postconditions: game is in play
    function playGame($postdata)
        if (!$this->isOver() && $postdata['move'])

        //player pressed the button to start a new game
        if ($_POST['newgame'])

        //display the game

    * Purpose: display the game interface
    * Preconditions: none
    * Postconditions: start a game or keep playing the current game
    function displayGame()

        //while the game isn't over
        if (!$this->isOver())
            echo "<div id=\"board\">";

            for ($x = 0; $x < 3; $x++)
                for ($y = 0; $y < 3; $y++)
                    echo "<div class=\"board_cell\">";

                    //check to see if that position is already filled
                    if ($this->board[$x][$y])
                        echo "<img src=\"images/{$this->board[$x][$y]}.jpg\" alt=\"{$this->board[$x][$y]}\" title=\"{$this->board[$x][$y]}\" />";
                        //let them choose to put an x or o there
                        echo "<select name=\"{$x}_{$y}\">
                                <option value=\"\"></option>
                                <option value=\"{$this->player}\">{$this->player}</option>

                    echo "</div>";

                echo "<div class=\"break\"></div>";

            echo "
                <p align=\"center\">
                    <input type=\"submit\" name=\"move\" value=\"Take Turn\" /><br/>
                    <b>It's player {$this->player}'s turn.</b></p>

            //someone won the game or there was a tie
            if ($this->isOver() != "Tie")
                echo successMsg("Congratulations player " . $this->isOver() . ", you've won the game!");
            else if ($this->isOver() == "Tie")
                echo errorMsg("Whoops! Looks like you've had a tie game. Want to try again?");


            echo "<p align=\"center\"><input type=\"submit\" name=\"newgame\" value=\"New Game\" /></p>";

    * Purpose: trying to place an X or O on the board
    * Preconditions: the position they want to make their move
    * Postconditions: the game data is updated
    function move($postdata)

        if ($this->isOver())

        //remove duplicate entries on the board    
        $postdata = array_unique($postdata);

        foreach ($postdata as $key => $value)
            if ($value == $this->player)
                //update the board in that position with the player's X or O 
                $coords = explode("_", $key);
                $this->board[$coords[0]][$coords[1]] = $this->player;

                //change the turn to the next player
                if ($this->player == "X")
                    $this->player = "O";
                    $this->player = "X";


        if ($this->isOver())

    * Purpose: check for a winner
    * Preconditions: none
    * Postconditions: return the winner if found
    function isOver()

        //top row
        if ($this->board[0][0] && $this->board[0][0] == $this->board[0][1] && $this->board[0][1] == $this->board[0][2])
            return $this->board[0][0];

        //middle row
        if ($this->board[1][0] && $this->board[1][0] == $this->board[1][1] && $this->board[1][1] == $this->board[1][2])
            return $this->board[1][0];

        //bottom row
        if ($this->board[2][0] && $this->board[2][0] == $this->board[2][1] && $this->board[2][1] == $this->board[2][2])
            return $this->board[2][0];

        //first column
        if ($this->board[0][0] && $this->board[0][0] == $this->board[1][0] && $this->board[1][0] == $this->board[2][0])
            return $this->board[0][0];

        //second column
        if ($this->board[0][1] && $this->board[0][1] == $this->board[1][1] && $this->board[1][1] == $this->board[2][1])
            return $this->board[0][1];

        //third column
        if ($this->board[0][2] && $this->board[0][2] == $this->board[1][2] && $this->board[1][2] == $this->board[2][2])
            return $this->board[0][2];

        //diagonal 1
        if ($this->board[0][0] && $this->board[0][0] == $this->board[1][1] && $this->board[1][1] == $this->board[2][2])
            return $this->board[0][0];

        //diagonal 2
        if ($this->board[0][2] && $this->board[0][2] == $this->board[1][1] && $this->board[1][1] == $this->board[2][0])
            return $this->board[0][2];

        if ($this->totalMoves >= 9)
            return "Tie";

Try the working example or Download the source code.

Learn how to create an AJAX version of this game.

How Much Does It Cost To Create A Flash MMO?

Comment 1 Standard

Are you thinking about making a flash MMO? Want to know what it costs? Then you’re in the right place. I’ve been working on an MMO for the past two years and I thought I would share for anyone who is considering making their own. There are a lot of expenses I didn’t think about or plan for so maybe this will help you budget for your game’s future.

Flash Server

These range from about $500 to over $25,000. The cost depends on if you buy a commercial one, how many users are on the license, and how many developer seats you need. I chose a middle of the line, out of the box, software called SmartFoxServer 2X. It has many of the features I need/want for my flash MMO already built into it therefore saving me development time. It’s about middle of the line in terms of price and has been used successfully by large multiplayer games (Club Penguin, YoVille, PetPet Park). An unlimited user/developer license is a one time fee of $5,500 (and yes, some servers charge yearly fees or a % of profits).

Domain Names

This is probably one of the things you’ll overlook. Many games only buy a .com domain name when in reality you should have multiple variations on the name, .nets, .orgs, and other domain extensions. This helps ensure someone looking for your website can find it. A domain averages about $20 a year per domain and I have 5 of them, so $100 a year in domain names.

Web & Database Servers

While you probably won’t overlook this you certainly won’t plan for as many as you really need. For added speed you should cluster your servers and keep all your databases running on their own, separate server. You want top of the line servers to support the amount of traffic you’ll generate. Expect to pay over $300 a month for every two servers up and running. Some places offer packaged deals so take advantage of that if you can.

Graphic Artists

Unless you’re an artist yourself you’ll have to spend some big bucks to have someone start generating the art for your game. The price of graphics will vary depending on the size, DPI, detail and quality of the artist’s skill. It will also vary depending on how many images and artists you need. For fastest turnout you’ll need at least three or four artists and trying to hire artists with similar graphic styles is a must for a cohesive looking game. Expect to spend at least $5,000 a year per artist, or more if your budget allows.


Every good flash game needs animated graphics. Not only do you need artists you need animators too. Many of the freelance animators I’ve found are willing to be paid per frames on an animation. Costs per frame vary from $5 – $25 a frame. Expect your animations to have at least 8 or more frames per direction/action. So for a single walk animation, that has 4 different directions (north, south, east, west) you’ll have 4 animations * 8 frames each * $5-25 a frame for a total of $160 – $800 an animation sequence. Chances are your game will have more than one animated character or graphics.


Whether your program it yourself or hire someone to do it for you programming is a large part of any game. There are a few tools out there to help if you want a quick “out of the box” type approach like OpenSpace and other game engines but these will cost you a small fortune. OpenSpace runs about $4,500 a license. Hiring a programmer, on the other hand, will cost you anywhere from $25 – $75 an hour and the amount of work they can do depends on their skills, speed, and turn around times. I do most of my own programming for my games but I’ve hired outside programmers for a few smaller pieces to save some time. Expect to pay out at least 4+ hours of work each time you use a freelance programmer at their hourly rate.

Game Designers

If you’re not the brains behind the design of your game then consulting a designer may help your game from “flopping” before hit the market. An experienced game designer can quickly point out obvious flaws in your economy, level/questing/rewards systems, and more. Usually you can find someone on a forum to bounce ideas off of but that also means the potential for Intellectual Property (IP) theft and possibly opening yourself up to outside competition before your game has even hit the market. I would recommend hiring an experienced game designer and having them sign a Non-Disclosure Agreement (NDA) before you give them any access to your game’s inner workings. Expect to shell out a couple hundred bucks for a consult but it’s well worth it.

Level Designers

If you game has multiple levels you may want to consider a level designer, or level design software. This makes it easy to implement new areas of the game and can possibly leave you free to do other things while your level designer slaves away at the more mundane stuff. Even though my game doesn’t have levels this is an expense you may want to consider if yours does. Having customized software developed for your game (or buying some) and/or hiring a level designer is another chunk of change out of your pocket.


You might have a fighting game but that doesn’t mean you won’t need a writer. Even if it’s things as simple as a user interface (UI), instructions, or start menu or little road signs a writer can help you use language that passes the Flesch Kincaid Readability Test and other readability tests. Did you even know these existed? A writer can also help you check for grammatical errors, succinctness, third person passive voice, and many common writing mistakes. For instance, does your children’s game use words that children in your target age group won’t understand? Hiring a writer to come up with all the text in your game is more expensive than hiring someone to edit it. Expect to pay a few hundred for a writer and prices for an editor vary based on word counts.

Background Music

Sure you can go the Facebook games route and have one background song that drives people nuts because it loops over and over again. Or you could purchase main stream music and/or have music composed specifically for your game. Prices vary drastically depending on your choices here. Custom music typically costs based on the length of the song. Quotes I’ve had for a one minute song are typically over $600 for a full license. Royalty free music costs twice as much as mainstream music and usually has other license limitations that must be followed but once you’ve paid for it it’s yours — even if it’s not unique. Using main stream music means you need to get a license from the BMI or the ASACP. While this might seem like the cheapest option at first (heck you can download a ton of songs for only .99 a piece) it’s also the most expensive ones. The BMI and ASACP charge depending on the number of daily listeners, number of song plays, and whether or not your users can select the song they want to listen to. On top of that they typically take a % fee of your yearly revenues.

Sound Effects

Most people remember the background music and forget the sound effects. A fighting game just isn’t the same without the punching and kicking sounds. While these are small sound files you’ll find that they add up fast. The better quality the sound effect the more it will cost. You may be able to save money by recording your own sound effects but that also means you’ll have to budget for buying sound equipment or paying for some sound studio time. Expect that your sound effects will cost anywhere from $5 – $25 each.

Language Filter Software

If your MMO is geared towards children you may want to consider purchasing language filter software. This may or may not be more expensive than writing your own language filters depending on the nature of your game. Third party language filter software typically specializes in stripping other suggestive/violent language which may also cause problems with children, as well as a bad language filter.

Marketing & Advertising

Most of your budget will probably be spent here. Unless people know about your game there’s no way they’ll visit and try it out. Online advertisement is probably your best bet and your costs will vary depending on what kind of advertising service you use. Pay Per Click (PPC) in my experience yields the best results. Pay Per View (PPV) may be more costly depending on the type of exposure you want your game to receive unless you’re using a fairly high bid on PPC advertising.

Newspaper and magazine advertising is also expensive. Expect to pay as much as $1,500+ for one large ad to run in one issue or as little as $200 a month to run a small (really small!!!) color ad. The cost depends on the magazine you advertise in and how much it’s in circulation. You can typically get a cost break if you decide to advertise in the magazine for the whole year.

TV and Radio advertising is even more expensive than print advertising. The costs are at least double and depends on the length of the commercial you’re running, the time slot it’s running in, and whether or not the station is creating the commercial for you.

Customer Support

Despite your best efforts your game will bring in a slew of emails. If you expect to answer all of these yourself you better have a programmer working for you. Sometimes I receive as many as 80 emails a day. There just aren’t enough hours in the day to answer all your email and program/manage your game. Hiring someone to answer email for you is an easy solution but it will cost you as well.

Payment APIs

While payment APIs like Paypal and 2Checkout are great sources of revenue they also cut into your profits. Expect that any payment API you use to process payments in your game will take 2-5% of each transaction you’re generating. If your game uses micro-transactions make sure you check with your payment API to see if they support specialized plans for such cases — this will save you some money.

SSL Certificates

If you want to seamlessly integrate payment APIs into your game you’ll need to have SSL certificates in place. SSL certificates are a yearly fee and who you purchase them from makes a difference in their safety assurance ratings and encryption levels/techniques. Expect to spend anywhere from $100 – $800 for one of these.

Traffic Reporting

Sure it seems mundane but you’ll want to know how long your members are playing, where they play the most, and how active they are on the website. With a flash game it’s harder to track these things because a lot of the code runs client side. There are several good traffic reporting APIs available for flash software that will save you time of creating something yourself. In addition resources to compute the traffic aren’t done on your servers, freeing them up for your members to use.

Site Maintenance

You might design your game to pretty much run itself but there will always be some type of maintenance involved. While this may not cost you anything if you’re programming the game yourself it also means money out of your pocket while you’re fixing things instead of adding new features, maps, characters, items, quests or events.

ML Text Based Game: Fantasy Quest

Comments 2 Standard

Haha I just found this old game I wrote in ML for a programming languages class in college. It takes about 20 minutes to play. Maybe it’ll be useful to someone out there?


  First, text descriptions of all the places in
  the game.
  'You find yourself in a pleasant valley, with a trail ahead.').
  'You are on a path, with ravines on both sides.').
  'You are teetering on the edge of a cliff.').
  'There is a fork in the path.').
  'You are in a maze of twisty trails, all alike.').
  'You see a large locked gate before you.').
  'You wake up with an aching head. Finally you manage to look around. You are in a small dungeon 

room. The walls are slimy and damp.').
  'The wall appears slimy.').
  'You see a small window above you, but there is little light coming through.').
  'The sound of water can be heard.').
  'The wall is slimy to the touch.').
description(dungeondoor, 'A guard walks by and grins at you with broken teeth.').
description(alley1, 'You find yourself in a rotting, fetid alley.').
description(alley2, 'The smell grows fainter. You see shorter buildings and people ahead').
description(town(0), 'You find yourself in town outside of the alley.').
description(town(1), 'You find yourself on a fairly busy street.').
description(town(2), 'A colorful marketplace looms ahead.').
description(town(3), 'You wander past the marketplace and towards the service district').
description(town(4), 'A weaver tries to get you to buy and other hawkers preach about their wares').
description(town(5), 'The streets grow narrow.').
description(town(6), 'A blacksmith sits before his forge. He asks you if you\'ve seen his missing 

horseshoe and offers a reward if you find it.').
description(town(7), 'You can see the alley in the distance ahead of you.').
description(town(8), 'The marketplace is full of many exotic fruits and vegtables').
description(town(9), 'Past the market place houses line the streets.').
description(town(10), 'Houses grow sparce and delaphidated out here.').
description(town(11), 'Small boys play in sewage.').
description(town(12), 'A drunken man staggers towards you. You see the tavern ahead.').
description(town(13), 'You wander out of town and into the countryside.').
description(tavern, 'You enter the tavern you were in last night. The barkeep look as you oddly.').

  report prints the description of your current
report :-
  write(Y), nl.

  These connect predicates establish the map.
  The meaning of connect(X,Dir,Y) is that if you
  are at X and you move in direction Dir, you
  get to Y.  Recognized directions are
  forward, right, and left.
connect(valley,forward,path). %outside of the town
connect(maze(0),left,maze(1)). %the maze
connect(dungeon(0),forward,dungeon(1)). %the dungeon
connect(alley(1),forward,alley(2)). %the alley outside the dungeon
connect(town(0),right,town(1)). %the town
connect(tavern,forward,town(12)). %tavern always takes you back to
connect(tavern,right,town(12)).   %town no matter where you turn

  Don't move past the gate if its locked
move(Dir) :-
  at(locked, Loc),
  at(locked, Loc),

  move(Dir) moves you in direction Dir, then
  prints the description of your new location.
move(Dir) :-

  But if the argument was not a legal direction,
  print an error message and don't move.
move(_) :-
  write('You can\'t go that way.\n'),

  Shorthand for moves.
forward :- move(forward).
left :- move(left).
right :- move(right).

  Displays a message if there is an item at this location
item :-
  isat(Item, Loc),
  at(you, Loc),
  write('there is '),
  write(' on the ground!\n'). 

  But if there is no item in the same place,
  nothing happens.

  Picks up the item at that location
pickup :-
  at(you, Loc), /* you are at this location */
  isat(Item, Loc), /* the item is at this location */
  assert(has(you, Item)), /* you pick up the item */
  retractall(isat(Item, Loc)), /* remove this item from that location */
  write('You picked up the '),
  write('! \n').

  Or there is nothing there
pickup :-
  write('There is nothing here!\n').

  Drop the item you're carrying
drop :-
  at(you, Loc),
  has(you, Item),
  assert(isat(Item, Loc)),
  retract(has(you, Item)),
  write('You dropped the '),

  Or they don't have an item to drop
drop :-
  write('You are not carrying any items!\n').

  You have a sword and the ogre attacks, you kill it!
ogre :-
  has(you, sword),
  write('An ogre attacks you! You slice off his head just before he can suck your brains out!\n').

  If you and the ogre are at the same place, and
  you don't have a sword then it
  kills you.
ogre :-
  write('An ogre attacks you and sucks your brain out through '),
  write('your eye sockets. Your body lies broken on the ground.\n'),

  But if you and the ogre are not in the same place,
  nothing happens.

  They have a coin and are at the dungeon door
guard :-
  at(you, dungeondoor),
  has(you, coin),
  write('"You there!" you yell at the guard.\n'),
  write('The guard\'s smile fades. "What do you want?" comes his grim reply. \n'),
  write('"I think I\'ve found something!" you say, flashing the coin. "Open the door."\n'),
  write('The guard\'s brows furrowed through the slats in the door window. Finally he grumbled '),
  write('and keys jingled as he toyed with his belt. The door opened with a creak and he pushed'),
  write('his bulk through.\n With one hand you '),
  write('punch the guard in the face, knocking him out and escaping the dungeon. \n'),

  You approach the guard and don't have a coin
guard :-
  at(you, dungeondoor),
  write('"You\'re going to hang tomorrow pig." The guard says, his spitle hitting you in the eye. 

Slowly he moves off. You wonder if he\'s a bit daft and move off.\n\n'),

  Not at the guard, nothing happens.

  If you have a horseshoe the blacksmith gives you a sword!
blacksmith :-
  at(you, town(6)),
  has(you, horseshoe),
  write('"You found it!" The black smith exclaims when you show him his lost horseshoe. "Here is 

your reward." He hands you a fine crafted sword.\n'),
  retract(has(you, horseshoe)), % he takes the horseshoe back
  assert(has(you, sword)). %you take your reward
  You don't have the horseshoe, the blacksmith says nothing.

  You have the coin still, and you walk into the tavern and buy a drink
tavern :-
  at(you, tavern),
  has(you, coin),
  write('"Give me a drink." You tell the bartender, ignoring his weary looks, and handing over the 

coin you found in the dungeon.\n'),
  retract(has(you, coin)). % you give him the coin

  You don't have the coin so you leave without a drink.

  They walk through the gate with the key

treasure :-
  has(you, key),
  write('The key you carry is hit by lightening and you die.\n'),
  write('You were so close!\n'),
  If you and the treasure are at the same place and they
  don't have a key then they win.
treasure :-
  write('You find a beaten old chest. Curious you wander over to open it...'),
  write('Colin\'s decapitated head rolls out at you, his eyes empty and staring.\n'),
  But if you and the treasure are not in the same
  place, nothing happens.

  If you are at the cliff, you fall off and die.
cliff :-
  write('You fall off and die.\n'),
  But if you are not at the cliff nothing happens.

  Have the key with you to open the gate
locked :-
  has(you, key),
  retract(at(locked, Loc)), /* unlock the gate */
  write('You unlocked the gate with your key.\n').
 At the gate but don't have a key
locked :-
  write('The gate is locked!\n').
  Not at the gate, nothing happens

  Main loop.  Stop if player won or lost.
main :-
  write('You wake up screaming in bed! Good thing it was all just a dream!!\n').
  Main loop.  Not done, so get a move from the user
  and make it.  Then run all our special behaviors.
  Then repeat.
main :-
  write('\nNext move -- '),

  This is the starting point for the game.  We
  assert the initial conditions, print an initial
  report, then start the main loop.
go :-
  retractall(at(_,_)), % clean up from previous runs
  retractall(has(_,_)), % remove all items you had before
  retractall(isat(_,_)), % remove empty locations of old items
  assert(at(locked, gate)),
  assert(at(lockeddoor, dungeondoor)),
  assert(isat(key, path)),
  assert(isat(coin, dungeon(3))),
  assert(isat(horseshoe, town(1))),
  write('\n\n Your name is James Pattern. Last night your friend Colin asked you to the Inn for a 

drink. He talked excitedly of treasure on a mountain top and ogres out to get him. You laugh at him 

good naturedly and think he had a bit too much to drink.\n On your way home later that night you 

hear the scuffling of feet. You spin but see nothing in the dark alley behind you. You continue on 

until something sharp hits you over the head.... You wake up with an aching head and a groan. 

Finally you manage to look around.\n\n'),
  write('Legal moves are left, right, forward, pickup, and drop.\n'),
  write('End each move with a period.\n\n'),


The main loop of this program is located at the very bottom of the script. It starts out by removing all of the locations, item locations, and items the player had on their character before they started playing. Once that has been done it sets up the game by placing all the items and obstacles in the appropriate places. After the game is setup its ready for the user to begin playing. It introduces them to the game by writing text to the screen to detail where the player is.

Legal Moves

Movement: Forward, Left, Right – This moves the character on the game map. To do this, the program first calls the move(Dir) and then checks the game map to see if there are any connections between the player’s current position and a positing direction they are trying to move. If there is a position available it retracts the players old location and asserts their new location to the new position on the map. If a player has entered a movement that is not connected to another part of the map then the game notifies them that they cannot move that direction.

Pickup – This move allows players to pick up items they will encounter as they move through the game map. A player can pick up as many items as they like. Once a player has picked up an item it will remain with them as they navigate the map until they decide to drop it. The pickup code first checks to see if there is an item at the same location the character is located. If there is, the game retracts the item from its location and asserts that the player now has that item in their possession. If the player tries call pickup and there is no item at that location it gives them an error message.

Drop – This allows the players to drop items they have picked up in the game. A player can drop as many items as they have. Once they don’t have any more items it will notify them. However, a player cannot specify which item they mean to pickup or drop. In order to drop an item, the code first checks to see if they have any items. If they have an item it retracts the item as being in their possession and then asserts that the item is now available at the location where it has been dropped. This way if they character was to return to that location at a later time they could again pick up the item.

Item Notification

In order for a player to notice that there are items around the map an item call was put into the code. This checks to see if there are any items at that particular location and then lists any items that it finds. This way the player is notified of the item being available for them to pickup as they play.


You were at the tavern having drinks with a friend. He tells you that he was trying to find treasure but was chased away by an ogre. You have a few drinks with him and then laugh it off and leave. As you’re leaving someone hits you over the head.

Dungeon & Coin – You wake up in a dungeon that is patrolled by a guard. In order to escape from the dungeon you must first find a coin in your cell. Once you have the coin you can go up to the door of the cell. You tell the guard you found something great and flash the coin to catch his interest. He, being a dull witted fellow, falls for it and opens the door. You knock him out and are free.

Blacksmith & Horseshoe – Beyond the dungeon you find yourself in an alley. Outside of the alley you wander back into town. Along the way you stumble upon an expensive looking horseshoe and decide (or not) to pick it up. As you continue around town you’ll find a blacksmith whose looking for a horseshoe he lost and is offering a great reward for it. If you have the horseshoe the blacksmith gives you your reward: a sword. The horseshoe is retracted from your possession and a sword is added to them.

Tavern & Coin – As you continue through town you may eventually wander back into the tavern you met your friend at the night before. If you happen to still have a coin you will buy yourself a drink, otherwise you’ll leave dejectedly.

Gate & Key – As you continue out of town you’ll find yourself in a valley along a path. On the path you will find a key and decide (or not) to pick it up. You will need this key in order to unlock a gate that lies at the base of a mountaintop. Without this key you cannot pass through the gate. However, once the gate is unlocked all is not clear. You must first drop the key before passing through otherwise you’ll be struck by lightning.

Ogre & Sword – Outside of the town you may find yourself stuck in an endless maze. Somewhere hidden in that maze lies an evil ogre waiting to suck your brains out. If you happen to have a sword with you, all is fair and well as you cut off its head before it can touch you. If you weren’t so lucky as to help the blacksmith out you will find yourself dead and buried.

Cliffside – There are other treacherous obstacles outside of the town. If you don’t watch your step you can fall down the cliff and die!

Treasure – Beyond the gate, and the treacherous lightning attracting key you will find the treasure your friend only dreamed about.

Game Over – That’s it! I hope you’ll play!