In preparation for submitting my game, Piggy Chase, for Magfest, I’ve been doing a bunch of work on the game. I’ve fixed some of the AI bugs (like animals floating up in the air on hills?!) and changed the control scheme to be more user friendly. Additionally, I added two new levels! I am hoping to have 10 levels — so only 6 more to go before I go for a release.
Now I have a tutorial level, a farm level, a city level, and a snow level. The farm level has the animals dodging tractors while the city involves lots of traffic. The Snow level has bad snow man that patrol perilously narrow ice platforms. I also have a Bowser’s Castle-style level in the works with lava and spikes–but it’s not ready yet so it isn’t in the video.
At the moment it’s basically a deceptively simple looking happy silly animal frogger game that actually is a pretty hard timing/reflex based game underneath. It’s pretty unfair and unbalanced right now and I think one would have to be really skilled to get all the animals to survive in the end. Part of me thinks I should scale back the difficulty or add in lives to allow players to sort of pick up where they die. I could also have animals respawn, so if you are really into completing a level you could go back and get everyone. I was also thinking about puzzle elements beyond the maze and timing elements, but I don’t want to spoil the formula that I have so far.
Ever since this summer I’ve been struggle to make my AI better. I have Behavior Trees in and really easy to debug logic now, but the path finding has become an issue. The AI stumbled across the age old robotics problem of escaping a concave obstacle. I added a big derelict alien space craft that is integral to the story and a super cool set piece to fight around and explore, but the AI acts like an idiot ramming itself into the structure with the current avoidance AI. The current avoidance works ok for smaller obstacles but when things go on for miles in one direction, path finding seems to be necessary. So, off to AI school I go again.
I looked into the new dynamic navmesh for Unity and its ability to be created on surfaces that don’t necessarily have to be horizontal. I thought I came up with a good hack, but it still doesn’t always work, and the dynamic building of individual navmeshes for lots of ships is going to be a problem when battles scale up. In the video below the agent doesn’t change its angle much, even tho I programmed it to do it and it was doing it a week ago… A great demonstration of how hacky and unreliable it is. It was an exciting idea tho, especially given all the off the shelf stuff you can use with the navmesh like steering and formations. Too bad..
Since I don’t really like how the navmesh system fails a lot and building the navmesh over and over is necessary and slow because you need to keep orienting the plane in different directions so the ship can move in 3D, I decided to start looking into other stuff. 3D A* was an obvious place to go, but A* is not super fast-especially in 3D over great distances. So, I am looking at a Jump Point A* where you can have a mesh of nodes, but you don’t have to traverse symetrical nodes and you can jump to ones where you need to make a decision. I am thinking of it as like a line of site type thing. If you don’t have a direct shot to the target, traverse through nav nodes that connect to create a clear path.
Currently I am working on ways of generating efficient node maps of my levels. I am thinking of using non-uniform cubes represented by a bounds object at runtime. When baking the navmesh info, the cube might start very big like 1km in volume and if it detects a collider within it, it will break into small cubes that test for colliders until you have some areas with finer navmesh data. This way the empty areas of the map would have fewer navnodes to traverse, but when a ship gets in close to an object they need to path find around the nav data will be more refined. This of course sounds great on paper, but I need to make sure I can generate such a thing without locking up Unity or making the player wait an hour for the next scene to load. If it works I think I can add some very cinematic dog fights and ship battles with the small craft dodging and weaving in and out of complex space stations or between capital ships.
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…)
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!
April has been a busy month! I’ve been putting in a lot of hours bringing the game back to demo level with the new graphics and the new code spurred on by some good pressure due to awesome interview with Fists of Heaven and a video chat with ThatCooperFellow. In retrospect, the whole year has been rather busy if I think back on it…. here are some things I’ve been up to…
Lasers, missiles, explosions!
Since last year, I’ve:
rewritten a lot of the ship components – making the engines and maneuvering more realistic and customizable to work on all different ships,
made more complex AI with goal setting and steering,
implemented some moving origin capabilities to make the battlefields more expansive and allow for some seamless travel – still WIP,
created the beginnings of a procedural galaxy generator that builds different galaxies and nebula and plots planet locations as well as assigning star types, planet types-based on distance from the star etc- and other details,
created some new nebula types that can be randomized and colorized for more variation
created and found some procedural substance textures for planets that work with Unity5 lighting and can be randomized for variation through the galaxy generator
built a few new HDR space skyboxes
made new cap ship models that should lend themselves to part swapping to make more type variations (more to come),
new beam weapons and missiles,
more complex turret AI that takes orders from its main ship AI to focus fire, target certain types or even fire at any targets of opportunity,
more complex explosions that have multiple stages for bigger ships (still wip but already looking pretty cool)
implemented a new radar and target tracking system connected it to the AI
targeting now seamless allows for targeting whole ships or component pieces
targeting all based on factions and classes instead of unity tags – more complex relationships and more advanced decision making for AI
there is a new mission / battle editor that I worked on over the summer too – something I need to start revisiting soon.
Here is a recent video of some of the dogfighting action (hoping to get a cap ship video up soon too!)
All week – during my snow days! – I have been working on procedurally generating the galaxy for Space Warfare – Infinite. I have been researching a lot on the old Elite as well as my Traveler RPG core rule book to help inspire me through it. I’m also using some complicated math to generate the galaxy shape. Essentially the galaxy generates and determines what sort of stars are Red, White, Yellow or Blue as well as their sizes. Then it determines how many planets they have. When you investigate an individual star system, the game runs some code to figure out what planets are their and what their characteristics are.
Here I’ve got the stars being generate and each star is a star system with a number of generated planets. The big grid sphere is my work on picking areas for various factions to control so in the one pick there is a blue faction and a yellow faction. The control spreads just out of the sphere to directly linked systems. The control zone is within a certain radius of the home star. Faction areas will name their systems with their own naming conventions – either different influences for human factions or alien languages for those factions. Also from here I can catalog the resources from each planet and determine the strength of the factions to give them bases and fleets etc. Taking over a new system would mean adding to that strength later in the game.
On the top left you can see my simple read out of planet info for the selected star. It’s not super formatted for the players yet. I just wanted to get the info out so I could see what was happening.
I still have to work on nebula regions and adding more detail to the star systems like asteroid fields and things. Once those are in, the galaxy generator will be hooked up to the actual game engine and generate the star system the player is in on the fly. Then players will be able to FTL jump to other systems as well. Below is a shot of the Galaxy map projected on the UI so the player can pick a place to jump to.
Over the last few weeks I’ve been trying to limit my programming time to focus on 3D modeling. I find switching between Unity and Blender to be difficult, so just working on making stuff in Blender has helped my productivity in creating new art assets for the game.
Sketching and modeling in Blender.
I have a list of space ships that need to be made and I’ve been working through it. I am almost ‘done’ one faction’s main ships. I still need to model a new fighter–and I might do a 3D cockpit while I am at it. Keep in mind nothing is really done. Everything is WIP. I’ve haven’t quite gotten my skills yet for painting textures and generating bump maps so there is still more work to be done. Also, as time goes on, these early models might need to be redone if I get better.
A new battlecruiser – 1 kilometer of destruction.
Above is the battlecruiser. Its basically the battleship class of the space fleet. For some reason I can’t use battleship. The ISC ships are going to be more boxy like current military ships and tanks. The other faction will have more sloped / angular plates on their ships.
Huge carrier ship capable of launching fighters and corvettes from those two bays in the front.
This is the carrier ship. It will have some point defense turrets on it, but other than that it will rely on its fleet and fighter squadrons to defend it. The carrier is also big enough to launch corvettes which will be used as anti-fighter type ships.
The corvette. A ‘small’ ship.
The corvette is the latest model I’ve made. Its meant to take on small missions and has weapons geared more towards fighter management or hit and runs on capital ships. The ship is fast but would probably get eaten up if it tried to go head to head with ships of the line.
The Destroyer-class. This ship is 500m long. Its got around 8 turrets mean for engaging other cap ships and point defense. It has a deck mounted rail gun and an internal beam weapon.
The Destroyer will be the workhorse of the fleet. The cruiser is a force to be reckoned with but these destroyers will pack a punch. A couple destroyers can take out a cruiser pretty fast.
Very early space station.
After these, I plan to remake the fighter and then start on the enemy faction. I also have dreadnoughts on my list as well. They’d probably be 2km. Additionally, I started messing with Space Stations.
Here is a video where I talk about the ships and compare their sizes…
At the beginning of the week I was lucky enough to be on the Space Game Junkie Podcast! The hosts of the podcast have a website devoted to all types of new and old space video games. (Space Warfare: Infinite even has its own wiki page on their site!) If you are looking for a new game to play, they have 99 episodes covering all sorts of games as well as video reviews of games. Its a big source of information and inspiration for me, so it was great to be on the show and chat with hosts about making space games.
All in all, the podcast was a lot of fun! I still think my voice sounds weird and I need to work on my elevator pitch about the game, but it was totally cool to see some people who really love space games play the game I am making. I also got some good feedback for things to fix like FPS controls confuse people when the shift key changes the controls…. the A/D key might be a slide instead of roll or at least I should add a slide/strafe feature since folks are expecting it after Elite, the targeting needs to be fixed because its confusing and not super responsive (I’ve already fixed the targeting subcomponents issues)–I need to add arrow indicators or make the offscreen target box larger and brighter so folks can track the closest target. I’ve got a few movies and games to check out as well.
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.
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.
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.
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.
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.
Sometimes it feels like not much has happened in the last week or two, but actually if I reflect back, Space Warfare: Infinite has made some pretty good progress.
One of the key features of the ultimate vision of the game is in. It needs to be refined and tested, but the core functionality is there. (Meaning you can do it, but sometimes the game breaks…) You can now switch between ships in your fleet! You can be flying along fighting in your tiny fighter and then press a key and swap to a big capital ship destroyer. Fire off a few beam blasts and jump into another ship. The ship you left will keep flying and fighting as the AI takes over.
The ultimate idea is that you can choose to effect the outcome of the battle in all different capacities and see the battle from all different perspectives. Eventually you will be able to give some basic tactics at the beginning of the battle to each ship in your fleet and then during the fight you can issue commands – currently just in the Comm menu– but probably eventually in a little more RTS-ish like a holographic command screen on a command ship.
Capital Ship Control!
Another thing that wasn’t possible a week ago was capital ships doing anything other than sitting in one place and firing from their turrets. While that was cool, its not very practical for a giant flying behemoth covered in guns to sit in one place while fighter ships dance circles around its turrets. So now the AI is hooked up — cap ship specific AI maneuvers are still a work in progress — so the capital ships will fly around and slowly chasing things and try to hit them with the ‘big dumb guns’ on their bow while their turrets focus on whatever catches their attention.
Capital ships helped add a new feature to ships and AI – the idea of types and classes. Now AI can look for enemies in their own class size and choose to only attack those. What this means is that if a I set a big capital ship like a Destroyer to only attack other ‘Large’ class ships, it will not try to chase fighters and instead will try to aim its big guns at other big less nimble targets. The turrets currently run on their own AI so they do whatever they’ve been set to do. Fighter turrets look for fighters, anti-cap turrets aim at big ships, point defense targets incoming missiles. Eventually AI and the player will be able to command turrets to attack selected targets or get all turrets to focus fire. This will truly be the way to take down the bigger ships faster. The big ships have an absurd amount of armour and hull strength, but don’t actually last long when hit with powerful guns. Fighter cannons take more rounds than most fighters have and thats with every round hitting only one side of the armor.
Cameras and Controls
So not only do Capital Ships fly on their own, but now the player can control one too. At the moment this means you can fly it around, roll it so the turrets have a good angle to pick up targets, point it in a direction and fire a giant plasma cannon or a beam weapon from the front. Eventually more controls will come — like commanding all the turrets, launching fighters from carriers, commanding other ships from a bridge, launching nukes, managing shields and power.
Additionally, the capital ship controls made the need for new cameras to be added. Trying to fly a kilometer long skyscraper through a combat situation from a first-person or even a third-person perspective is somewhat difficult. A middle mouse button orbital camera was added so that you could get views from various angles around the ship as well as zoom out to see what is around. I’ve also added an FPS mouse look that puts you in the middle of your ship / or your cockpit on the fighter and allows you to look around and behind you. I am mapping these to the F1-12 keys like in Privateer and Wing Commander games. I have a bunch of directions plus the orbit and mouse look setup in there. The functionality is there, but I am still working to make it better.
I also upgraded to Unity 5 because I keep looking at the graphics advances, the new physics engine, and the frame rate boosts and just needed to make the jump. I thought the move would fix a turret issue I had where my turrets were spinning my ships – but I think the way I finally fixed it probably worked in Unity 4.6 as well. My problem involved wanted to have turrets (and other future stuff) be able to take their own damage and be targeted and destroyed. The turrets move but are children of another big damageable rigidbody thing as well. But I needed a collider and a rigidbody on the turrets so that hits would register on them. Every time I did this the turret or turrets would spin the ship, fly off the ship into space, stay on the ship but turn on their sides. Anyway, rumor has it you didn’t need a rigidbody on a collider in Unity 5, but that doesn’t seem to be true. I understand that now moving a static collider doesn’t result in a penalty, but I guess it wasn’t the same as my problem. Anyway, I figured out that if I turned my colliders into triggers on the turrets, they’d stop messing with my ships, stay in place and take damage. I don’t know if this is best practice but it works! I need to make sure other triggers are not included on the collision layer mask for projectiles, but other than that it works!
So while Unity 5 didn’t really solve my issue, it did speed up the game. I seem to be able to get more stuff going on the screen than before while still getting a decent FPS.
One downside was most of my scripts lost their inspector set variables and the UI doesn’t know where any of its components are. I’ve been slowly fixing it all, but things are a little scrappier at the moment. A few above screenshots have white boxes where UI is supposed to be, that was the most noticeable Unity 5 upgrade effect! It slowed work on other stuff down for sure. I am hoping tho that now that I am up and running with Unity 5, I can make use of the new shader and its better use of threading to keep the game fast and furious.
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…