Piggy Chase Mobile Game Side Project!

Sometimes you need a break from hardcore space combat simulation programming. As you might be able to tell from browsing Badger Head Games, while our roots can probably be traced back to the love of space games in many styles, I also like to create fun silly games as well. Over the summer I began working on a game that would star a pig – mostly because my son likes pigs and other farm animals. For awhile only a pig lived on Old McDonald’s farm when my son sang the song. Anyway, I had an idea for a ‘pig game’ that I thought would be great on mobile and I could build with some art I already had and some pretty simple programming. (haha simple programming…)

screen_44.43432

Here is a sample video of my new side project game Piggy Chase. It’s a low poly-isometric frogger / marble madness / pacman like game with farm animals and crazy tractors. The goal is to help the pig and other farm animals escape the farm. More levels and hopefully cool stuff before release on PC / iOS / Android. I just demoed this for people to play at District Arcade in Washington, DC this last weekend. Players had a lot of fun!

Laser Star – 3D Voxel Space Shoot ‘Em Up for the #indiesvsgames GameJam

Great productive game jam weekend! I really enjoyed making and playing Laser Star. The theme was ‘arcade’ and I think I captured that! It has a lot of challenge and style for something made over the course of three days (while still managing to hang with friends most of Friday night, and most of the day on Saturday.)

Premise: Galaga vs. Voxel Art Games vs. Infinite Runner

PLAY!

Play it here…  (WebGL version but it doesn’t have the score board)

Play in on GameJolt (compete for the top score and vote for me in the gamejam – uses FLASH….)

Screen Shot 2015-07-20 at 11.44.20 AM

An homage to Galaga with style that reflects some of today’s games. Obviously the graphics are made using the same tools as Crossy Road and its millions of copycats. The perspective of the game was shifted to an above and behind the ship which gives it an infinite runner feel. The alien patterns are inspired by Galaga, but I never did get to creating a large block formation where the enemy can be hit easier…

Screen Shot 2015-07-20 at 11.43.15 AM

Features:

The game is infinite as far as I can tell, I set it up to continue indefinitely and increase in speed for later iterations. Stage types will cycle as the speed increases.

There are about 7 stages with different make ups of enemies. There is an asteroid stage as well.

There are a number of enemies with unique patterns and abilities.

There are power ups which increase your lasers.

There are extra life bonuses for high score milestones up to 1,000,000 points.

Sounds were all made in BFXR.

3D models were all made in Qbicle.

Gameplay Video:

Dev Log: Space Warfare: Infinite – New Game Modes, Gameplay Video for Capital Ship Battle and Patrol

This last week I’ve been polishing up the current build and sending it out to some testers to try it out. Also, on Tuesday I will be on the Space Game Junkie Podcast at about 10PM EST. Check it out! I’ve been a fan of the show and have really used them as a resource for inspiration and ideas.

screen_231.5574

Some of the major additions have been getting the Battle Editor up and running and adding an Instant Action mode which currently house some missions as well as a place to load player created battles. The game will also eventually include Dynamic Campaigns with a story line of the unfolding war as well as branching mission paths depending on the completion/failure of objectives.

screen_165.9012

After that I’m going to work on a Free Play mode where the player can visit the many star systems of the game to trade, take missions, fight and explore. I am hoping to figure out a way for the Battle Editor to add content to all three game modes – Players should be able to build their own campaigns and scripted missions, as well as make Instant Action battles and build missions / locations for the Free Play mode.

Screen Shot 2015-03-15 at 9.25.52 PM

I recorded a video of playing the Capital Ship battle in Instant Action as well as a patrol mission.

Beyond the menu system, the battle editor saving and loading systems, and a lot of testing, I also added some other features. juskelis – maker of Starfire – offered to do a little alpha testing and had me make some tweaks to the roll of the ship as well offer the ability to invert the mouse. I also added warning messages for when power is low, armor is critical and when you take hull damage. I think it helps give the player some awareness about how much trouble they are in. Someday the console in the cockpit will spark etc.

screen_200.2657

Another thing I tweaked – the player can now swap through all the ships in their fleet and control them. Before it was designated ones, but after all the refactoring, the switching ships works for anything now. It could also work for turrets, but I disabled that for now as I don’t have a control interface for turrets yet-they are run by AI. I want to add more control eventually since it’ll be more fun to have it when flying the cap ships.

As for next steps, I guess I’d like to hear what Space Game Junkies think I should add and just keep plugging away. The power management system is still just a fraction complete – I want to add reactor components to ships and hook up the energy draws to them to balance ships. Then I want to create a custom load out screen so the player can select their weaponry. Particularly for the Instant missions as well as to be used on some campaign missions. After that, I really want to add a Frigate, Corvette and Battleship to the ship list. I have some ideas for some sick battles. I want to work in formations for all ship types as well. Currently ships don’t play nice when you have them form up. So I want to work on that. Oh and add more AI stuff since thats not complete yet either – maneuvers are their, but currently enemies just pick from them randomly. I want them to make some interesting choices.

Space Warfare: Infinite – Dev Log – AI Dogfighting Maneuvers and Launch Tube

Part of last week and into the weekend has seen a lot of time devoted to reworking the AI. I also wanted to add some new visual elements and while I did not get around to modelling a bunch of capital ships, I did model a launch tube for the player to fly out of.

Launch Tube

launchtube

The launch tube is really just a mock up. It will get modeled in Blender someday in a more fleshed out way, but I wanted to add a more cinematic feel to the game play. It works! I have a whole idea for the first mission of the game and it will involve a FPS style run through the ship to the launch bay and then getting shot out into space. I won’t spoil too much, but lets just say my influences are books like The Lost Fleet, Old Man’s War, Armor and Starship Troopers. They all give a similar feel of a first battle against a superior force. I think it will be a rewarding intro if I can pull it off.

AI

I’ve been reworking the AI from a Switch/Case (I know, terrible) to a class based approach like the one on the Unify Wiki and the one described in Unity 4.x AI Programming — but with my own twist.

Screen Shot 2015-02-08 at 9.19.02 AM

I am starting with what they explain, but I am working on making it more modular so that I don’t have to write an base AIScript for every pilot style. I want to be able to drop behaviors and maneuvers onto a ship and have it fly a certain way. I am getting there. I’ve built a maneuver component that has the ship fly a pattern, the pattern is imported into the AI State at runtime. It’s still not exactly where I want, but it’s starting to work pretty well.

Once I perfect the way the pilots pull in the patterns, I will also be building in better decision making for the AI. I’ll build in which patterns are best for different situations offensive and defensive. Additionally I will be adding in cooperative moves and player commands to get assistance from wingmen. I’ve also got plans to start making AI adhere to the same targeting situations at the players so the player can lose an enemy etc.

screen_47.04968

After the dogfighting is passable, I will start working on getting the capital ships moving. They need to move differently than the fighters and small craft, but currently they just sit there and hope their turrets have something to aim at. It will be real cool when those things start to move.

Space Warfare: Infinite – New Gameplay Videos with shields, new weapons, explosions!

Sadly, I die far too fast to show a lot off in these videos but if you look closely you will see the capital ship’s shields and two of its turrets blowing up any incoming missiles. I’ve also added some of the new weapon features to the UI so you can see what guns are selected and watch me flip between them. There is also ammo values now which will probably make a lone fighter long for a carrier to go back to reload on–it’s coming!

 

I’ve been working on setting up base classes for ships and weapons which is sorta why there are lots of new projectiles and guns to choose from. I also worked on making the cap ship blow up in a cool way and might use the explosion scripts for all the explosions. I sort of simulated delayed subsequent explosions. I need to make the ship come apart next instead of just disappear tho… I’ve got a list of about 48 todos still to work on before… before I make another list…

Developer Log: Space Warfare: Infinite – Capital Ships and Turrets

I spent the weekend putting together a capital ship and its turrets. Its still a work in progress, but it is fun to have to play around with.

screen_20.71244

Capital Ship!
I built the capital ship model using Pro Builder. I’m still a true amatuer at modelling, but I am working on it. The ship is a carrier-type with a big fighter bay on the side. It’s about a kilometer in length, but you can only really tell if you put a 3rd person character on it and walked around. It seems like the trick is to put bunches of detail panels and sloped surfaces on it so it doesn’t look like a flying cube. I am using games

like Freespace 2 as a reference since the ships were boxy but people still liked them. Once I get some nice models together, I will explore real texturing. The current carrier isn’t going to be in the finished game – at least not the model in its current form. The main goal was to get something giant to fly around and fight against that had a killer amount of turrets. Ta -da !

screen_50.51213

Having the cap ship, tho, gives me lots of directions to go. It’s be cool to have the player fly out of a fighter bay tunnel at the start of a battle. I have an idea for smaller gun boats that would be a much smaller cap ship with a big gun and a pd. They’s have less armor, but would be a bit more maneuverable than big stuff. They’d be used in groups to attack big

ger Battleships by attacking from different angles and things to overwhelm defenses. Going one-on-one with a battleship would be a big problem since a big gun might take it out in one hit, but a group could score a bunch of hits while a big gun can only focus fire on one target.

I want to get AI together that will allow the cap ship to maneuver. Once that happens, a second capital ship so that they can fight each other. The current one would have to have AI that would make it find an average waypoint in the middle of the action so it can get in there and mix it up with fighters. Or, it will need AI that can chart a course along the side of another cap to do a flyby. If all caps follow the current gun load out a dive and attack would be a good strategy since a caps guns are on top mostly, so getting under the enemy will offer a passing attack while not getting exposed to the bigger guns on top.

Also there will be at least one cap ship with a giant trench in the middle leading to some sort of highly explosive power core. It will be the only cap ship that a fighter might be able to take out on their own.

Turrets!
The turrets rotate and look up and down to target enemies. Currently they are sort of Point Defense guns, but I am also going to add anti-capital ship guns, beam weapons and missiles. The model for the turret is really for a big anti-cap gun.

screen_112.2582

My basic thoughts are that all guns on a cap ship should be on a turret since the ship can maneuver as simply as a fighter. Big anti-cap ship guns will rotate slowest, but pack a big punch. Currently, if a fighter is unlucky enough to get hit by a anti-cap projectile its instant explosion.  Big guns will prioritize other big ships that aren’t zipping around. Point Defense (PD) guns will track and take out fighters and missiles that get too close. Currently each turret has its own targeting AI. I hope to also add a targeting list function for some guns like PD and high-fire rate missile launchers so that they can move briskly between many targets. In a combat mission against Capital Ships, the main goal of fighters is to take out the PDs and other guns to make way for missiles to take out the ship. I am thinking some classes of cap ship will have strong enough armor that standard cannons on fighters won’t do any damage at all.

Fixing the Unity Constantly Turning or Spinning Player / Camera Problem

If your players are reporting that they keep spinning in your game and can’t stop, there might be an issue with the joystick inputs on their end that makes it impossible for you to find the bug. However… you can program to solve it if you make enabling Joysticks optional.

Here is a player video of the bug!

The best way to solve this from the programmer end is to write your input scripts to deal with it. Currently, your game (by default) accepts Horizontal and Vertical Axis info from the keyboard or a joystick. They are labeled the same in the Input Manager… That way you can write code like:

float translation = Input.GetAxis(“Vertical”) * speed;
float rotation = Input.GetAxis(“Horizontal”) * rotationSpeed;

And it won’t matter if the player is using a keyboard or a joystick. Unfortunately when a player has something going on with their joystick stuff (virtual joysticks seem to cause issues), the Axis gets all wonky… Players report spinning around that won’t stop.

BUT… If you change the name of your second set of Horizontal and Vertical Axes in the Input Manager (the ones that correspond to the joysticks) to something like HorizontalJoy and VerticalJoy then they won’t interfere for your keyboard-only using player. You could then add a toggle on your Controls or Pause menu to enable Joystick controls.

then you might write code like this:

if( !joystick )
{
//if joysticks aren’t enabled – just track keyboard axis

float translation = Input.GetAxis(“Vertical”) * speed;
float rotation = Input.GetAxis(“Horizontal”) * rotationSpeed;
} else

{

float translation = Input.GetAxis(“VerticalJoy”) * speed;
float rotation = Input.GetAxis(“HorizontalJoy”) * rotationSpeed;
}

Below is a screenshot of the input manager – notice the second set of Horizontal and Vertical Axis are called HorizontalJ and VerticalJ. Do something like that and write code to allow for joy support if you want to give your user the option and the bug should be fixed on your end and the users. This also means joys won’t really be tracked unless you write code to watch the specific axis as stated above. This solution worked for my testers.

Screen Shot 2014-12-01 at 7.08.51 PM

Dev Log: Space Warfare Infinite – New AI tricks, missiles for everyone! and Unity3D Bloom findings

screen_78.26921Over the past week I’ve been having a lot of fun with Space Wars, while also researching and reading about AI. (I also got a little sidetracked by trying to perfect the bloom image effect….)

AI

AI can make a game like Space Warfare pretty exciting. I plan on having some multiplayer aspects once I get the major systems together, but the focus of the game is really a single player experience at this point. Since that is the case, cool AI pilots who behave in interesting manners is important. My actual AI code at this point needs to be refactored because it is a big mess, but the things its doing already even without a really nice organized OO state machine are pretty fun. I plan in the future to build out more of a Playmaker-esque state machine for these guys but it’ll take some focus. Because of the behaviors of the AI, the game is becoming pretty fun to watch. It has the enemies turn and loop and barrel roll to escape or ambush each other.

Current states include Chase, Attack, Reposition / Flee. Within those states the ships are able to barrel roll in reaction to being hit as well as change target focus. My idea is that I want to have some base states like Attack and then have a bunch of maneuvers that can be employed by the pilots depending on their style/personality/status. I am looking into multiple temporary short range ‘waypoints’ to create maneuvers so that AI can do looks or spiral at another ship instead of go in a straight line.

Some of my research to me to the above really cool video from Star Citizen (disclaimer: I am one man, Star Citizen will always be cooler than my game…). It hints how they are thinking about AI and displays some quick shots of the Ai engine. I can’t afford to hire that Ai company but I like some of their approaches. One of the things they really focus on is collision avoidance which made me think – oh man I don’t have anything to collide with yet other than really small ships better get to work on that! Unity’s Nav Mesh seems out because its a 2D plane and not a big open space. I’m heading towards a raycasting set up for individual ships. I forsee it being a little costly so I might have to add some collision radius objects that trigger the raycast steering only when necessary. One video that seems to explain the basics is here: http://vimeo.com/9304844. Sadly the author seems to have disappeared from the internet and never continued the series.

Missiles

I’ve also implemented missiles into the game. They are basically have perfect tracting to the only way to not get hit is to accelerate long enough that they can’t catch up or have them hit or get hit by something. I am working on a few countermeasures like a ‘chaff’ like drop and perhaps flares. I know chaff is for radar, but I might make it a dual purpose item in this game. It just drops a bunch of chunks of metal behind the ship that can clog an enemy radar with blips or set off a guided missile if a chunk collides with it. The other balancing option I will add is the length of time the guidance system works. This will give the player the ability to outrun then dodge a missile over a range if the guidance cuts out early, but is still a threat if the ship remains on the same course.

When I have add the ability to upgrade, ships could by better missiles with longer range guidance systems to make them harder to shake. As it stands now, unless your opponent launches a missile from too far away, the likely outcome is an explosion. Its so likely that for the above video I needed to disable missiles just to show you the Ai fighting without immediately creaming each other with missiles. Also I wouldn’t be able to stay in one place and film for my that 10 seconds before getting hit myself.

Missiles are a powerful weapon. But I always feel they are underpowered in games. Perhaps I should make it a little more random – 10% chance of surviving a missile? Perhaps its time to add shields!? Also individual parts of ships might mean less instant kills if its not a direct hit.

Bloom

On the Bloom front… well the game is shiny now! Look at the before and after!

 

screen_306.4306

Before…

screen_11.3738

After…

Things I’ve learned so far… some Unity image effects may be added after every camera is rendered. This means that no matter what camera you add an effect to, everything is gonna get the effect. The bloom happened on all my cameras no matter what my order was or culling set ups were. I’ve tried it all…. If someone out there reads this and finds out a way to make my findings untrue, I would love to see the solution! Comment, twitter, email me!

The main problem I’ve had is that the really nice Space for Unity scenes were getting over exposed and washed out so that you couldn’t enjoy the scenery. Since the main thing I wanted blooming were the trails and lasers, I ended up really brightening the particle materials they were using and then turning up the ‘threshold’ setting on bloom so that everything doesn’t wash out. It sort of works. I like more glowing than less so I am happy where I am with the look. Sometimes I feel like almost Bloom alone makes the Unity Pro license worth it — just the cool factor.

Dev Log: Space Warfare Infinite Updates -Bloom and Ai

I know I should be working on my November game, but the prospect of being able to devote more time to Space Wars (As well as finding a real game name for it – Space Warfare Infinite?) has been too tempting! I will get back to my monthly project soon, but  in the mean time lets talk updates to Spacewars.

Bloom –

Bloom is all the rage. It’s the main reason to get Unity Pro from what I can tell. That and the profiler. But lighting effects take your game and put it in the pro category – at least with the looks. I’ve been trying a bunch of different post-processing effects, but standard bloom seems to be the best for making space object look interesting and making laser flash and glow. The battle now just seems more alive! The downside is that brighter backgrounds glow too much and look too bright. At the moment I am just letting it slide. I fooled around with the camera render orders and such but could never get the bloom to only effect lasers. So far it doesn’t seem possible for me. (I did see someone wrote a shader that keeps bloom from rendering on something. I might do something like that someday to fix the nebulas and other stuff I don’t want to glow).

screen_11.3738

Ai –

I’ve also been futzing with the Ai. I really want to write behaviors and more decision making. The current Ai chooses a random target from a list of enemies and then blindly charges. When in range they start firing. The other behaviors include: if they get hit a couple time in rapid succession, they will find a random waypoint to run off to; if they are attacking for more than a few seconds they will find a new way point to back off and then go back to it; if they get hit by a ship that is not their target a few times, they will switch targets and defend themselves.

Last night I changed a few things that annoyed me. First I added a lead object to each ship so that ai will aim just before the target thus leading their shots. Works well for moving objects.

I want to build a behavior where the Ai does flybys or other maneuvers that make sense. As I step towards that, I removed their ability to stop. It looked super dumb to see ships just floating in space taking shots. I just have them thrust at all times now. I also dropped their rotation speed from 20 to 1 which makes them curve a little more when flying – looks more natural. No more turning to the player in a blink! I also want to add a behavior when they are too close for more than a few seconds, find a nearby waypoint to go to before attacking again — the ai seems to get in close and then circle the target without being able to aim shots. They need to be able to get a new attack vector. The movement makes the game much cooler looking. Everything circling around with trails.

Ai Behaviors I am hoping to put in:

  • Rush pass / loop: Ship flies by target attacking as they pass then pulls up and executes loops to do another run on same strike vector
  • Flanking loop to hit target from side Circle to get around and behind target Go to waypoint
  • Patrol series of waypoints
  • Follow / Protect target
  • Follow / Copy target (attack its targets) Stand still – cap ships will prob do this alot Kamakazi ramming
  • Strafe side – get up to speed then rotate to aim guns at target let inertia carry ship along side target while unloading weapons… (currently not possible in way game handles ship flight… but this might be an effective attack for fighters against a cap ships PDS)
  • Preferred targets – weakest, injured, toughest, untouched, ranged, fighter, cap, midrange, auxilery, stationary, slowest, low shields, low armor, high shields, high armor, no ‘type’ gun, specific ship
  • Scanning / Sight Range- how far should awareness go? Should be increased by auxiliary scanning ships in fleet.
  • Use specialized component – Scanner Jammer, EMP, Cloaking,