very handy GameTimer library

I put all the game timer code I use up on GitHub.  It’s super useful for doing stuff like speeding up gameplay, slowing down gameplay, hit pause, etc.

I’ve found that Timers in games are very hierarchical.  You’ve got the main clock, which is basically run off the cpu clock or whatever and never stops.  You’ve got a game clock which can be paused, or if the game is kinda sluggish or frantic you can tweak the speed this clock runs at.  Then you’ve got all the clocks that run off that, including character clocks, particle engine, physics clocks, etc.  If these are run hierarchically, when you pause the main game clock all the ones underneath it pause too.

Also when playing a network game, can send those clocks from the server to all clients, and all the players will instantly be synched up. Very neat trick!

Anyway, this is the way I do it. From readme:

A bunch of timer objects that can be used for time effects like hiererchical time, slowdown, speedup, hitpause, etc.
The most important thing is that these timers can be used hierarchically. You can pass one gameclock into the update function of another one, which updates based on that dude's time. So the timer chain might look something like this:
MainTime
|
GameTime
/ | \
Character1Time ParticleEngineTime Character2Time
So like the MainTime is a GameTimer.GameClock and is updated first from the XNA GameTime object. This one always runs at realtime, so you don't want to pause or slow it down. Can problably run HUD or menu transitions off this clock.
The GameTime is also a GameTimer.GameClock and would be used to run the gameplay itself. This one can be paused for the Pause menu, or slowed down/sped up if the game play speed needs to be changed. Since all the clocks below this one are updated off it, they will also pause/slowdown/speedup.
Under that, you could have the ParticleEngine running off it's own clock separate form the player characters. That way when the players are punching the snot out of each other, you can add some hit pause to add crunch and the particles will still be flying around.
Idunno, that's just example how I use it in my fighting games. I also send these timers over the network to sync up the server & clients.
Cheers!

Advertisements

Designing the Wedding Video Game

Screenshot of game being played!

Screenshot of game being played!

Yo, so I got married this weekend and had a huge badass wedding.  One of the things that was cool was there was a custom video game I made for the reception.  It was like a really simple fighting game, with the whole bridal party beating each other up.   There were a bunch of little touches in there to personalize it, and it turned out really great.  For example the bride attacked with her bouquet , or there were two best men, so I combined them into a two-headed monster that threw the heads to attack.  There were a few design challenges though to make a game like this…

Gameplay needed to be simple… like, really REALLY simple.   This was a game designed for people to walk in, pick up and play a match, say “wow that was cool” and then probably never see it again.  It had to be IMMEDIATELY obvious what every button and control did.  People wouldn’t play this game long enough to learn any complicated or hidden attacks, so somehow the game play needed to have incredibly simple controls, yet somehow avoid shallow gameplay.

I only wanted to use the face buttons on the controller because some people coming to the wedding haven’t picked up a controller since Asteroids on the Atari.  Holding a controller and pressing both buttons and triggers is actually a lot harder than some people realize!  There was a “quick” button, the player could press while holding direction to do different fast attacks (like in Smash Brothers).  There was a “strong” button that was similar but did much more damage, but had longer startup and recovery.  There was a “fireball” button, when the player pressed it would throw a fireball in whatever direction the player was holding.   This move had REALLY long startup and recovery.  Last there was a “defense” button, which did various block, dodge, and air dashes.  In hindsight that was too many moves attached to one button, it should have been simplified.  Last thing about the controls, the game needed to support both the L thumbstick and the dpad… if it only supported one or the other, the player would pick up the controller and have 50/50 chance to use the incorrect one which could cause confusion.

There was going to be a lot of people at this wedding, and if they had to wait in line to play the game they would just wander off and do something else.  The “player throughput” had to be fast enough that people could get a solid game in without it feeling too long, then shuffle through a new set of players.  I’ve found that a good length of time for a game like this is about 3 minutes.  I had to design the animation speed, attack damage, and player health to target that time goal.  Even if the players had a really good defensive game, I added a 3:00 timer that ended the game and chose a winner at the end.  Also making the game 4-player really helped throughput.  As a result, there was almost never a line to play the game, but if there was an empty controller available people didn’t feel hesitant to pick it up since the game was so short.

Since most players would honestly only play once, they needed to be able to pick it up and make it do something that looked cool without a lot of effort.  I tweaked the fighting engine so that any quick or strong attack could combo into another quick or strong attack.  This was the players could have a really simple “close” game that looked cool.  To counter the simplicity of the combo engine, attacks had a cumulative knockback effect that threw the other player farther every time they were hit in a combo.  Also the player could aim & throw a projectile with one button press, so there was a simple long range option to counter players who favored the button mashing.  To counter the long range game, the player had a whole bunch of movement options to dodge.  The player could block or “roll through” projectiles on the ground with the defense button, or 8-way air dash using the defense button + direction.

Also, this game had a hard hard HARD deadline, with no option for slippage… it had to be done in time for the wedding or else there was no point to do it!  To hit this deadline, I had a few different strategies.  First I reused a TON of code from Pajamorama, including the animation engine, menu code, and fighting engine.  I did some heavy modification to the animation engine so I could reuse animations between characters, which saved a lot of time.  I also created a whole tool chain for editing the characters in the fighting engine.  It was 100x quicker to spend time writing solid set of WSIWYG tools, than to skip it and edit text files.

If I could do it again, the only thing I would change was there were too many options mapped to the defense button… People didn’t realize they had so many defensive options, didn’t utilize them correctly, so most games ended up favoring aggressive rushdown players.  I’d change it so that button did an omni-directional block, and the character would airdash in whatever direction the player tapped while in the air.  In fact by the end of the night some of my more knowledgable gamer buddies were calling me out on the lack of defensive options 😉

So taking all that into account, how did the game play?  It was fast and fun!  It was like a Smash game with 4 player at once, contained in a square board like a traditional 2d fighter, but they could fly or shoot in any direction.  The character were bouncing around off the walls like billiard balls, flying in figure 8’s, and throwing projectiles all over the screen!  Everybody could play it, recognized they knew the characters, and had a total blast!

If anybody wants a bespoke video game for an upcoming wedding, hit me up on Facebook or twitter!  Cheers!

Projectile-Projectile collision in fighting games

Had an interesting question come up the other day about fireballs in 2d fighting games, and specifically what happens when fireballs collide with each other.  Here’s the scenario:

Two players are facing off from across the board.  Both players throw projectiles at the same time.

The two projectiles collide in the middle of the room and cancel each other out.  Both players are back to the same situation.

OR…

The projectiles DON’T collide and pass through each other.  Now each player has to react to the other character’s fireball.

Some games do option 1, some do option 2.  Option 1 sounds like it might be more interesting because the extra defensive capability of the fireball can be used to balance long ranged vs close ranged characters.  Option 2 sounds like it might be more interesting because it adds another level of complexity if the characters have different speeds/strengths of projectile.

Option 1 seems like a bad idea because all these fireballs cancelling each other out will slow down the pace of the game.  Option 2 seems like a bad idea because if one character has a better ranged attack in a matchup, it makes sense to play “spammy”.

Maybe it would be fun if a game used a combination of the two?  Like some characters have projectiles that will block other one, or some characters have projectiles that will pass through other ones?  Maybe a EX fireball always blasts through a regular fireball, but a super always blasts through an EX?

Anyway, I thought this was an interesting game design question.  Chime in on the comments if you have any thoughts/feedback/examples about projectile-projectile collision in fighting games.  Cheers!

Pajamorama: Advanced combo techniques

Hey yall!  Here’s some details about the combo engine in Pajamorama.  You may have noticed it is really easy to do combos, but when you really know what you’re doing you can do some cool stuff.  You’re gonna need to know all this info if you ever run into me online 😉  If you’ve ever played fighting games before some of these concepts might be familiar, but I’ll try to break it down for new players.

 

So basically, here’s the easy way to do combos in Pajamorama:  Once you hit another character with an attack, start mashing all your attack buttons.  Pajamorama is smart enough to parse through all that input and find something cool for your character to do 🙂  Nearly every other fighting game out there requires precise timing and input strings, but Pajamorama is made to be super easy, so I took all that stuff out.

 

So a low level explanation of how that works: whenever the player enters an attack on the controller, it is put into a list in memory.  Every attack in the game has a time gap at the end called a “recovery phase” where the character is no longer attacking or doing anything.  If the attack missed, this is an excellent opportunity for other players to counter attack.  If the attack connected with another character, once the character enters the recovery phase the game will go to that list in memory and check if any attacks in there can be comboed into.   If it finds one, it will “cancel” the recovery phase and go straight into the new attack.  This lets you hit other players with several attacks before they can hit you back.

 

That was super technical!  If you didn’t quite understand that, don’t worry, here’s the part that will make you a better player.  All the characters have the same combo chain.  Any attack can be cancelled into an attack further down the chain:

Quick(X)

Strong(A)

Down+Quick(X)

Down+Strong(A)

Forward+Quick(X)

Forward+Strong(A)

Up+Quick(X)

Up+Strong(A)

Special(Y)

Down+Special(Y)

Forward+Special(Y)

Up+Special(Y)

 

The combo chain is a bit different for each character though.  Most characters can’t combo throws (usually forward+strong), and some characters have special stances that have their own combo chains.  Also the special attacks might be ordered differently between characters.  Usually the character’s projectile attack is at the end of the combo chain.

If that stuff looks too complicated, just try to mash those buttons as fast as possible when an attack hits and you should be able to figure out some comobos by watching what your character does.

Hope this helps your pajamorama skills!  Next I’ll break down each character and their strategies, starting with Apple.

Have a Pajamoramally weekend!  Cheers!

Pajamorama Basics

Hey yall!  So Pajamorama has been out for a few days now, and people have mentioned that there is no in game tutorial explaining all the details of gameplay.  When I was developing Pajamorama, I thought to myself “This game is super easy, I don’t need to put in a tutorial.”  Well, the feedback is in, and I was wrong 😦  I’ll try to dig into some of the details of gameplay, starting with the basics like controls and the combo engine, moving into character strategies and more advanced tactics.

 

First, the goal of this game is to knock the other characters off the board.  You do this by hitting them with attacks or throwing them, which adds to the damage % up in the HUD.  The higher the damage, the farther the character will fly when they are hit.  This might sound familiar, it is very similar to how the smash series of fighting games works.  One of the differences between Pajamorama and Smash is that characters have many more movement options in the air, making recovery much easier.  In fact, if you get knocked underneath the board, every character has at least one attack move that adds enough upwards velocity to pop back up through the floor.

 

Next I’ll explain the controls, which are super easy.  All moves are a direction on the d-pad or left thumbstick, plus one of the face buttons.  The button scheme is as follows:

X: quick attack

A: strong attack

Y: special attack

B: defense

Each attack button has four different attacks:  button with no directional input, forward+button, down+button, and up+button.

All characters have a throw using forward+strong (A).

To block, hold down the defense (B) button with no direction held.  The only way to damage a blocking character is to throw them.

All characters have a forward dodge move that can be used to escape attacks, using forward+defense (B) button.

 

Hopefully these basics will help you out!   Tomorrow I’ll cover the details of the combo engine of Pajamorama.

Cheers!