Bulletpattern Game design, Flash and Unity development


Input Queues for Better Controls

Note: Input queueing is a basic technique of controls, which may seems like it doesn't warrant a write-up, but it's come up in three separate projects over the past few months, so I felt compelled to write up an article I can easily point to for an explanation.


What constitutes "good controls" in a video game can be many nuanced bits of code handling of inputs that aggregate into one hard-to-describe system. However, one easy measure is, "I hit a button and the game did what that button is supposed to do". Sometimes even when coding controls "correctly", players will hit buttons and what they expected to happen doesn't happen at all.

The Culprit? Finite State Machines

A cornerstone of game programming is the finite state machine (FSM). FSMs organize game code into a set number of states where only one state can be active at a time. FSMs must transition to a different state to perform different actions and specific actions can be taken at the beginning and/or end of these transitions. If you are unfamiliar with FSMs, there is a great deal of information elsewhere.

FSMs are excellent for organizing AI but are also often used for character controller code. While state machines are wonderful for compartmentalizing code, they are the primary reason for needing input queues.

The compartmentalizing of control inputs is definitely an advantage of finite state machines – an input cannot be accepted unless a character is in a certain state. However, players cannot always tell what state a character is in. Or they cannot tell the moment a transition from one state to another occurs. Or maybe they cannot react quickly to a state change.

Imagine this scenario for a controllable character:

  • Our character has two states: running and jumping.
  • The code will not accept a "jump" input if the character is already jumping, only in the running state.

Now imagine your player is jumping and wants to jump again the instant they land. However, the player hits the jump button 1 frame before landing on the ground and entering the running state. No jump occurs. Due to your correctly functioning FSM, that input will be ignored.

In a fast-paced, 60 fps game, will your player say to themselves, "Oh, maybe I hit the button 16 milliseconds too early"? Or will they say, "This game has garbage controls"? I think any game developer knows the answer to this.


Enter input queues.

Here is a simple ruleset for an input queue

  • Inputs go input a single-slot queue
  • An input in the queue expires after [aNumber] of milliseconds (this must be tweaked for need & feel)
  • Anytime an input is taken from the queue, the queue is cleared
  • When the FSM transitions to a new state, the input queue is checked and if there is a viable input, the action for that state is instantly executed.

Now let's look at our above example with a input queue where inputs have a 33 millisecond expiration time. Our player can hit jump 2 frames too early and the jump will still occur as quickly as possible. Our player will feel like the controls are more responsive and won't feel the need to mash buttons.

Where I have been seeing the need for input queues recently is in combat systems that have multiple attack types. For example, players will have:

  1. A basic attack that can chain into itself for combinations
  2. A super attack.

The player will hit basic attack a few times and then super but their super input gets lost because they hit the button during the final few frames of animation of the basic attack. An input queue makes the attacks flow seamlessly into one another even when a player's timing it a bit off.


Finite state machines are one of the best tools in the game programmer's toolbox but a strict implementation without input queues can lead to controls feeling like they are losing inputs. More complex input queues can be created, like using multiple input slots with FIFO (first in, first out) execution. You can also make separate queues for different inputs types, like moving and attacking.

Some players will never even notice because they just mash buttons like crazy but more deliberate players will notice this issue instantly and, quite rightly, become frustrated with your game.


Filed under: Uncategorized No Comments

Code game for kid’s birthday party – Gravity Falls

Party Time

My daughter turned 9 this past week and she wanted a Gravity Falls themed birthday party. For some unknown reason, we continue to torture ourselves by hosting the birthday party at our house. At least this gives me the opportunity to make a Gravity Falls-style puzzle game for my birthday girl.

If you haven't seen Gravity Falls. it's like X-Files meets Twin Peaks for kids. It's a great show and is rich with cryptids, mystery, and secret codes. I took it upon myself to make a scavenger hunt/code breaking adventure for my daughter and her friends. It was a bit last-minute thrown together but I think it turned out pretty good.

Threat from Bill

Bill Cypher is the big bad of Gravity Falls. He left a threatening note taped to the outside of the back porch door. I left it there and waited for someone to notice it.

Contained in the envelope was a threat from Bill on a notecard and and other notecard with holes in it.

The kids needed to align the two cards to find the next puzzle. This took some direction as their immediate instinct was to start Googling the solution to the puzzle. Once I put them off of that, they started looking throughout the house for some kind of hint. I had to tell them multiple times they had everything they needed to solve the puzzle. They finally got it.


Cipher Time

Taped to wall of the bathtub behind the shower curtain was the next clue.

There was also the Masonic cypher key along with this. When making the puzzle, my plan was to tie using Google and making the kids find they cypher key themselves. You see, one of the main characters of Gravity Falls is named "Dipper" but that's his nickname. His real name is "Mason", which is a bit of trivia my daughter is very proud of knowing. I wanted her to search for a cypher key using "Dipper's real name" but there were too many variations of the masonic cypher on the internet. I couldn't risk them getting a different one than I used, so I had to provide the correct key.

Cryptid Hunt

The message says "MONSTERS IN THE BACKYARD". The five bars at the top represent how many to find. The count of how many to find took them a while to figure out. They had fun hunting in the yard for the figures.

The five cryptids were found. I had to point out Bigfoot, as his brown color and where I placed him made him incredibly difficult to find.

Each cryptid had a letter written on the bottom. They kids had to unscramble the letters and find the word "shell". A large, pink, conch shell is one of my daughter's prize possessions, so she knew immediately where to look.


Shell Game

Inside the conch shell was a long strip of paper with a code on each side. One was a seemingly random set of letters, the other side had another Masonic code.

The code says, "USE PAPER TOWEL ROLL". This was accidentally more difficult than I meant it to be. I didn't take into account the code can be "read" from any direction! So they had a few false starts on the code. When turning it the right way, a real word appeared and they were off to find a paper towel roll, which I had placed among the party supplies. Of course, at first they overlooked the provided tube and attempted to just unroll a full roll of paper towels to get at the tube 🙂

Finally some smart cookie figured out to wrap the strip around the paper towel roll and the finally code was revealed, "LOOK UNDER THE MAT - YOU WIN"!


The End

Bill had a final note admitting defeat under the back door mat. He was there the whole time!

I have to admit the end was little anti-climatic. The kids already had tons of treats, so I couldn't think of a good prize to put at the end. While I put all this together pretty last minute, the kids really enjoyed the hunt. It was a nice break to get the kids to stop eating candy, get outside, and use their smarts.


Filed under: Uncategorized 1 Comment

Scripting MOBA AI

I have recently gone back to our MOBA, Adventure Time Battle Party and it reminded me about how I wanted to write up a post about the AI. There were a number of important lessons we learned and I wanted to share them.


Ground Rules

We didn't have much time to pursue, what I would consider, strong AI on this project. However, I love working with AI so I made time on weekends to work on this. So to be economical, our explicit goal for AI in Battle Party was "don't be dumb", which is very different from "be smart". Also, my approach to AI is rooted in "make it fun" more than an academic approach to AI, where you might be trying to emulate an algorithm or advanced behavior.

Also, AI was an aspect a number of our team wanted to learn. To keep things simple, I set up and simple state-based AI system and wrote a number of tools for newbie AI scripters to use.

One thing that's important to me is: don't cheat. I try as much as possible to not leverage any data a real player would not have. I don't want to rely on letting the computer know every last detail of a player's state or inputs and make decisions based on that knowledge. There are times when the CPU overhead of certain checks are just too expensive, and in that case, I allow myself to cheat.


The "Danger" Measurement

The backbone of the system was a collection of systems that produced a "danger" value. This produced a simple integer that allowed the scripters to make decisions. This system took into account:

  • The number of alive players
  • The number of nearby ("nearby" being 1.5 screens IIRC) enemy players
  • The number of unaccounted players on the mini-map
  • The number of nearby enemy minions
  • How far ally/enemy minions are pushed. This was a +/- value depending on where the minions were pushed relative to the mid-point of the map.
  • A queue of when the AI sees a player use powers. This is a good example of not cheating. Instead of looking at the player cooldowns, when the AI sees an onscreen player use a power, it lowers the danger value by a specific value for a certain time. Higher value powers lower the danger value more.
  • The powers currently available to the AI
  • Player/AI health values
  • Player/AI buffs
  • Being close to an ally/enemy tower
  • Some other items as well.


Basic States

The basics were patrol, attack, and flee. Since the more danger there was, the more an AI champ would flee, the back and forth between and attack and flee states created some good dive in/dive out behaviors and some pretty good kiting. If the danger value got too high, the AI would flee to allies, health pick-ups, towers, or the base. If the AI had a power that created movement, it would use this power to run away if pursued (i.e. in a flee state and a champion was close).

If the AI didn't have a champ to attack, it would push minions, help allies, capture altars, patrol, or do special actions. more on social actions later.


Listen for Events

Loads of events can trigger a decision to change the state – taking damage, a tower being attacked, the base being attacked, an ally champion being attacked, the danger value changing significantly, altars being open or captured, etc. Many events. Lots.


Special Actions

In my experience, I have found you can throw in 95% of random behaviors and 5% of really smart decisions and player's will think your AI is a genius. With this in mind, I did a couple of one-off, hard-scripted behaviors to use occasionally.

  • Tower Dive – Very rarely, when the danger rating was very low and a player was hiding under a tower, the AI would tower dive. During this brief time, it would just go HAM and ignore the danger rating and try to kill the player.
  • Ambush – If the Ai had nothing better to do, it would hide in the brush for a time and wait for players.
  • Dodge – If the player used an aimed power and the AI had a power that could be used to dodge, it would do so.


Other Tools

I wrote a number of tools to facilitate other scripters. Things such as "do I have a clear shot to my target?" This mean you could fire a projectile without being blocked by minions. There was a similar check that informed the danger rating on the AI, "does the player have a clear shot to me?

There were quite a few utilities like "find closest safe point", "are targets in range of my powers", etc.


Leading the Target

One of the biggest lessons we learned was about the value of trying to lead the target when aiming powers. Every scripture's first instinct was to try to predict player movement and fire where the player would be in the future. This might be good for a game where player velocity cannot be changed instantly, like FPS or racing game, but in a MOBA a player can "juke" (i.e. dodge) in any direction instantly, so the value of prediction is greatly decreased. Experienced players will nearly always dodge. We found that it's statistically more likely to hit player just aiming randomly in a radius around the player than trying to lead their current movement.



The AI turned out pretty good considered the limited resources we had. Quite a few people got to try their hand at scripting AI and they only needed to worry about strategies around the character's power set, instead of learning about managing behaviors states & calculating distances.

Filed under: Uncategorized No Comments

Multiplayer Ranking Systems vs. Declining Population

The Problem

A solid ranking system is required for a healthy, competitive online game. You want same-skill players to be facing each other – you want your newbies playing and your veterans playing veterans.

A good skill system will allow high-skilled players to quickly rise in the ranks and only face like-skilled opponents. You want these good players away from the lower-skilled players as quickly as possible.

The more granular the system you have, the better matched players will be. Having numerous ranks gives players goals to work towards and the more goals the better.

But what happens a couple years after release and your game's population dwindles? You may still have a small, but dedicated, set of players who can no longer find matches due to your ranking system. What was previously a great feature of your game has become a detriment that will kill your game's community all the faster.

This unfortunately affects the players at the top ranks the most. These are your most passionate players and they are already in the smallest population pool. They will be punished the most with the longest matchmaking times.


A Solution(?)

A system that adjusted the number of searchable tiers separately from actual ranks would be better to offset population reduction. These searchable ranks would  shrink and grow depending on average concurrent users.

In our previous game, we had 4 ranks and 14 sub-ranks. We did matchmaking between ranks, and then allowed to expand to more ranks after a set time. Five minutes per rank, if I recall correctly. This means a high-rank player might have to wait for 15 minutes to search the entire player base for a match.

What would be better is something along the lines of:

  • Player population high = Matchmake as 4 ranks
  • Player population low = Matchmake as 1 rank

And some couple gray areas in between. This would mean when the game is healthy there are loads of ranks and similar skill matches, but as population dwindles you sacrifice skill-matching for getting games started at all. I think this is a sound trade-off.

Filed under: Uncategorized No Comments

On copying games (re: Battle Party)

"Why did you copy that other game? Don't you want to make something new and original?"

Of course (nearly) all game developers want to make something new and original but there are a great many factors that inform a team's decision on what game to make. I want to give my perspective on the decisions that may go into making an "in-genre" game. I hope I can change a few minds that think when a game is influenced by another game, that the developers are not just creatively bankrupt or making a "cash grab".

We are fans

This might be a surprise, but most game developers are game players too. We are fans of all the same games every one else is playing. You know when you sit around with your friends playing a game and say, "I like Game XYZ, but I would LOVE this game if it had this and that"? Well, game developers have those same conversations and we (sometimes) get to do something about it! We can make the game we would love to play.

For Battle Party, the team liked LoL, DOTA, and other MOBAs. However, we are filthy casuals and find the standard MOBA formula too complicated, too toxic, and find the games take way too long to play. We wanted to make a MOBA for people like us.


Existing Team & Tech

OK, so maybe you want to make a FPS with a grappling hook or, in our case, a super streamlined "Arcade MOBA". What existing game engines or code base do you have already? What does the current team have experience or expertise making? Do all of these things line up?

Our team had a lot of experience with 1) multiplayer competitive games and 2) Diablo-style isometric games – a perfect fit for making a MOBA.


Business Goals

Now you have the game you want to make and the team to make it, but does it align with your parent company's goals? Is anyone going to give you time and funds to make it?

In our case, CN needed a competitive online game with global appeal. A game where we could roll out new character-specific content over a long period of time.

We had been wanting to make our take on MOBAs for a long time and the opportunity finally presented itself. We had the right design for the business goals, we had the team and tech, it was a perfect fit!



Game deadlines almost always slip. However when making games for a television company, there is a lot on the line. There are episodes of shows being produced, commercials being made, worldwide marketing plans being created – the game has to go out on time. The is no wiggle room, not a single day.

Here is where the risk of something new is a huge gamble. We have to ask ourselves, "Can we make a game that's new & innovative, in a year, with this team, that's good, on time and in budget? Can you 100% guarantee that?" There is absolutely no way you can guarantee that.

I have worked directly on 50+ games and consulted on 100+ more and I have seen how many times something truly unique, something that sounds really exciting on paper, ends up either a) taking way longer to "find the fun" than you imagined or b) turned out being bad in development, no matter how much work you put into it.



The next time you see a "copy" of game, consider that it might be the game the team was really excited about making. Maybe they had the right skills and tech already in place so they could worry about the fun part of development – making the game fun and not having to worry about making it just work. Maybe their parent company's needs aligned perfectly with something they were passionate about. And maybe they had 6 months to make it.



Better Game UI

I work on quite a few games a year and over time this has added up to hundreds of games. During this time I have seen the same UI mistakes over and over again. I want to share a simple improvement we make to improve game UI. I will be using fake examples as to not call anyone out.

Main screen

First, let's look at an example main game screen.


This is functional but it could be much better. I get why developers do this – it's easy & flexible. A developer can create a single button asset with a dynamic textbox and dynamically place the buttons. The number of buttons can easily grow and updating copy for changes and localization is easy.

It can be more than just ease of development too. Sometimes UI designers come from web or app design backgrounds or a game studio leans on their website designers for UI design. However, the rules for good game UI are very different than web/app UI. The core concept that differs is that web/app interface does not seek to suggest what users should do, game UI should do this blatantly.

To make better UI, ask the question, "What do you want players to do?"

Do you want players to hit HIGH SCORES just as much as you want them to hit PLAY? No, of course not. Once you have your answer, you have an idea of what element should have dominance. The best thing to change is the size of the desired action input. This will work regardless of language, icons clarity, or color blindness. The larger size also draws players' attention best. You could also change the color or shape.


There are numerous ways other to improve this. You can add icons for people who cannot read (i.e. kids) or non-english speakers to clearly delineate the "neutral" buttons.

This isn't too much more work. Instead of one dynamic text button, you make two – a neutral button and a call-to-action button. On screens with no clear call to action, using all neutral buttons is acceptable. You can expand this concepts with a call-to-action button, a neutral button, and a "back" button, when you have numerous screens that flow back and forth.

Now let's look at UI issues on the "Level End" and "Pause" screens. I am lumping these together because they usually have the same issues.


Level End or Pause screens

Here is what I see too often. Again, this is a fake example.


Again, a call-to-action is needed – what do want players to do?


If you are too pressed for time to make two buttons instead of one, at least arrange buttons "in order of call-to-action", in this case, home, level menu, restart, play/continue.



Find what you want your players to do and make that the dominant interactive element! Making 2 buttons is not that much harder than making one and the clarity it provides players is worth it.

Filed under: Uncategorized No Comments

Adventure Time Battle Party is out




Filed under: Uncategorized 3 Comments

Adventure Time Battle Party beta!


Oh my Glob, you guys! The Adventure Time Battle Party MOBA is in closed beta. You can get in on that sweet gaming action!

Join the party now!


You can play all day Thursdays, or throw down with the devs during our scheduled play tests, Thursday nights from 8-10 EST!

Join our discussion on Reddit - http://www.reddit.com/r/battleparty/


Filed under: Uncategorized 13 Comments

FusionFall Heroes – Marceline sketches

While going through some old files, I found some sketches I did for Marceline in FusionFall Heroes. These were attack animation concepts. Some of them made into the game, some didn't.



Filed under: Uncategorized 18 Comments

First boss last

I am currently working on an iOS game in my "free time" (haha, I don't really have any), mostly to learn what it takes to make a mobile game. My day job is making PC games but I feel it's my duty as a developer to stay informed of the current trends, and mobile games are surely the trend right now.

My goal was to learn the ins and out of the iOS platform, and what sort of unseen challenges mobile development can bring. In my experience I have discovered developing certain types of games, or developing certain platforms, can have large unseen challenges which must be taken into account when designing or managing a project. While I certainly learned many things about iOS development, I also have learned a very important design & development lesson. A lesson I am hoping I don't forget about when I start my next project.

That lesson is this, when you first start on your game, you are at your weakest. You don't have the hang of the development pipeline quite yet, maybe your art style or technique is 100% refined or maybe you don't have a full roadmap for the game. However, when developing a game, you often start at the beginning. You start at level 1, and then develop to the end. This means your later game content will be of greater quality than your early game content.

The problem is,of course,  more people interact with your early game content than your late game content. If you early game content isn't the best it can be, players won't ever make it to your late game content!

In my current project I have definitely fallen into this trap. My first boss fight is pretty terrible. It's confusing and doesn't build properly on the skills players have built up to that point. The other boss fights are pretty nice! Especially the last boss but who is ever going to get there when the first real payoff moment for players is so weak?

So my new rule is – do your first boss last. This is when you will be at your best and you can give your best to players.

Filed under: Uncategorized 2 Comments