Space Warfare: Infinite – Dev Log – Capital Ship Battles, Ship Switching, New Cameras, Unity 5

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.

screen_41.14206

Ship Switching

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.

screen_99.05984

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.

screen_42.9131

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.

screen_152.8223

Unity 5

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.

screen_32.11617

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.

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 – Dev Log – All about Scanners and Target Damage

This past week I’ve been working on unifying the ship code and it is just about done. Now the player and AI ship code is shared completely with added scripts for the extra player functions like input and UI things.

screen_110.5652

The shared code means that now enemies can use all the components like different weapons and specials. This means more varied ships (of course I need new ship models) with different fighting styles. I also want to redesign the AI to incorporate the ability to switch to different weapons for different situations or employ countermeasures to stop missiles. I am getting close to feeling pretty good about the player systems (by no means done) to go back to focusing on AI and mission scripting so those are going to be the next big push. That and some interchangeable component based cap ship models since they will be needed if I am going to create any type of campaign that is worthy of the game title. According to my giant list of To Do’s on Trello, I am 23% done (with the list…) but included in the list are a functioning Battle Editor, ‘complex AI’ and an energy management system. So yeah, almost done!

Scanners

I’ve also been revamping the ‘radar’ system – I am calling it a scanner now in game.

The scanners will have some nice game play effects. An asteroid or debris field will make the Visual Scanner pretty tough to track enemies while it should be fine in open space. Chaff could be launched to further distort a Visual Scanner. The EM and Heat scanners can come into play in more dense areas, but stealth ships or ships trying to be stealthy might try to mask their EM or Heat by running cold or creating anomalies. A ship might jam an EM scanner with lots of waves. Of course the most lowly fighter probably won’t have the advanced scanners unless the player upgrades. The Smart scanner is the magic radar that tells you what everything is and ignores unimportant stuff.

screen_47.10722

I envision Scanner / ECM ships like the Raptors in Battlestar Galactica doing scans and blocking them. Possibly being in a wing with one would give you a scanner buff while you were close by allowing you access to scanners beyond visual that you couldn’t get alone. Additionally, some stealth ships may need to be targeted manually. Currently ship targets can be cycled through with the E key (Next Enemy Target) or C key (Closest Enemy). If a target is undetectable by scanners, you should have to get it in your crosshairs and then manually target it with the R key (Right in Front of Me Target Key). After manually targeted, the stealth ship will be added to the list of targets to cycle through… I also imagine some stealth missions where the player tries to get some surveillance by drifting undetected. Could be awesome.

targetinfo

Target Cam / Info

I’ve also added a target camera and changed the UI in that area. The stock Unity sample assets box just isn’t really meshing what I need to display there. I sort of like the angled-ness of the boxes, but they are a little limiting with what I want to display. For now I may opt for a flat UI until I build cockpits or other assets UI assets that make everything look cool. I’m more programmer than artist and my dreams for the game sort of extend beyond the art I can create for it at the moment. In the meantime, I am going to build all the cool functionality and drop the art on it when I can.

screen_155.0834

Don’t worry, it’s not really 2FPS!

Targeted Damage, Armor and Hull Damage 

You might also notice the little rectangle with a grey outline and a red inside. There is also one next to the crosshair. These are currently the armor and hull status system. Ships can now be damaged on the sides, the front and the back. If any one side’s armor goes down to zero, the hull is exposed on that side. Too much hull damage = boom! This adds some strategy to fights, you can make sure to favor one side if its damaged and keep it away from the enemy. If you lost all the armor in the front of the ship, you won’t want to play chicken with the enemy on a straight joust. Eventually some of the ship components like guns and radars will also have models stuck to the outside of the ship model. These will also be able to take damage. You can get your scanners knocked out or your engines.