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.

 

Space Warfare: Infinite – Dev Log – Modeling ships, Base classes and Explosion Debris

I’ve been busy since the last Dev Log, but sometime its hard to tell what to update folks on. Cleaning up code is super useful for the game, but doesn’t make for screenshots. As the base ship class gets more and more cleaned up and unifies the player and AI scripts, some cool things will happen. More ship variety, AI that can use and switch between different weapon systems on their ship to match their situation, the ability to target a Friendly, press a button and hop into that ships cockpit while AI takes over yours… (yeah thats a big one…). Almost there….

I’ve been fooling around with Blender, but need to take a few online courses on UV Mapping because I am failing or at least asking ‘this has got to be easier’. I guess art assets could be a good reason for a kickstarter in the future if I can’t get the game to look right.

screen_83.59546

A semi-ok blender model of a fighter. not the best….

I did have great success in modeling debris from exploding ships. Basically just rectangular twisted scraps of metal. Thats about my skill level. But it looks cool!!

screen_86.20336

changed the zoom out for the player explosion so you can see it and take it in for a few seconds.

Space Warfare: Infinite – Dev Log: New UI Stuff and Mission Scripting

It’s hard to remember exactly what I’ve added from update to update and I hope to make more regular blog posts to keep track. Over the last week I’ve been doing more under the hood work as well as some random visual stuff to go along.

screen_20.81269

Point Defense Turrets

One major addition is point defense turrets (unique 3D model pending – for everything in the game really) that targets missiles and does a pretty ok job destroying them. The idea is that big slow moving nuke missiles fired off during capital ship battles will get knocked out of the sky — unless some ace fighter pilots can get in there and save take out those turrets! (We’ve got to justify fighter craft existence in some way right?) The code for my turret targeting had to be modified so that they could be choose to target something other than ships. This will probably come in handy one day when we want stuff to shoot bases or asteroids or cargo.

On a side note – My test model of a cap ship is a basic wall of turrets and no energy limits or management has been implemented yet, but I am sure in the future ships will not be impossible walls of laser cannons. I have some thoughts on how that would work in the future. I figure I will make ships in a component type way where you need segments to hold various things like power cores, munition bays, barracks etc. The segments will be physical chunks of the capital ship increasing the size and mass. Bigger can be heavy on fire power, but they are going to have blind spots and attack vectors that small fighters can exploit.

screen_207.0476

The turrets shooting the purple lasers are Point Defense turret. That explosion was once a slow moving nuke.

Comms! 

As you can see from the above picture, I am also working on adding some elements that will allow me to start messing around with story elements and missions.  Without comms, it’s tough to present any story or mission. The communications box will just pop in and then disappear so it’s not always interfering with view. Additionally, I am working on a Freespace 2 style ‘command’ scheme both to communicate with your fleet members and to answer back to other folks who contact you over the comm. At the moment my # keys are used for weapon equips and other usable systems, but I am going to have a comm key that enables a ‘comm’ mode for using numbered menus.

Missions! Scenarios! 

Once comms were in, I needed something to control sending comms messages. I’ll be using XML files to build missions or scenarios that will load and play out when you enter a sector or trigger something. I am thinking of them as missions and scenarios, because the story arcs will be framed more as missions, but if you are free roam and not following the main story, the game might load up various scenarios unfolding in the system you jump to so there is always something to do. So far its not too complex – we can spawn new ships and tell the player stuff.

http---makeagif.com--media-1-12-2015-prnLZoSpeaking of spawn new ships – I thought just randomly dropping ships in wasn’t cool so I gave them a warp in effect. Most fighters would probably warp in while inside a carrier, but this will do for now. I am looking forward to having a whole fleet warp in in front of a player.

UI

UI has also been worked on. The left side info box has been cleaned up a little and now works with the weapon select feature. Shows you what weapons are equipped and how much ammo they have left. Additionally the center reticul now has the energy bar, the hull hp bar and an armor bar. I also tried dropping a model of your targeted ship in the enemy info box, but I couldn’t get it to feel just right and then my game crashed. I may end up taking screenshots of the different ship models and just make sprites for them in the UI. Behind the scenes I also have a working sector map that updates positions in real time. I plan to convert it one day to something usable like another way to give orders – certainly it will be one of the ways to do that as a Captain on a cap ship.

screen_13.27957

 

Hull, Armor, Shields 

Armor was another thing I’ve added. It’s minor at the moment, but eventually it will play a big role in balance. There will be different classes of armor plate and corresponding classes of ordinance. A Class 1 projectile will lose about 25% of its expected damage against a Class 2 armor. Class 3 would reduce it to 50% and a Class 5 would basically just shrug it off with no damage. Super armored battleships might not even worry about attacks from fighters or lower class weapons. A bomber or heavy fighter with a higher armor class would have a real advantage in a dogfight against ill outfitted pirates. As for shields, I am not planning on having them on smaller ships. If you’ve been following my game dev tales, you know that I like explosions. Shield technology severely hinders the explosions:minutes ratio. Fighters and their brethren must blow up a lot. Also, I get bored when a dog fight against one enemy takes forever. Why build a high-tech spacefaring fighter jet that can’t take down its prey quickly? All fights should be quick and dangerous so shields are out for the small fries. Fly a capital ship and you can manage shields to your hearts content.

 

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…

Dev Log for Space Warfare: Infinite – Beam Weapons are awesome

Still working on capital ship weaponry and it’s fun! I’m actually doing a lot of clean up under the hood since my general programming process is get something working that I can play with on the screen as fast as possible and worry about making the code better later. I am in a make the code better phase because capital ships are far more involved than fighters and they are forcing me to break out some of the systems I just hard coded into my fighter scripts so that after I am done, I’ll be able to iterate more ships, turrets, weapons, other objects faster.

dontmesswbeams

Capital ship with one beam weapon lays waste to a fighter wing…

BEAM WEAPONS!

One example of this current decoupling is beam weapons – a totally different style of ‘projectile’ that still works with the components I built. The main turret I made last weekend just fires off regular cannon projectiles which are the same things that the fighters shoot. It’s been my standard projectile along with missiles for a long time. Standard cannon projectiles do 1 damage to the hull (armor and shields haven’t been implemented yet…) and missiles do a bunch more. The beam weapons are set to 1000. They cut through anything and can destroy multiple ships in one hit. I’ll probably dial it back but its fun to watch the thing just vaporize fighters like gnats. I envision this level strength weapon to be a capital ship attack weapon so the turret will probably track slower and generally just target other big ships. I might also make a short range faster tracking anti-fighter beam to punish players who get to close. The beam weapon definitely makes a cap ship something to fear.

On the technical side – I used a line renderer with a collider for the beam and I hacked together a lense flare and light at the origin of the beam. I might add another lense flare type thing to places it hits stuff so that it looks like a weld torch. Might be a cool effect that is different from the regular sparks and stuff of other weapon collisions.

Space Warfare: Infinite – Screenshots gallery galore

Here are some of the latest screenshots of Space Warfare: Infinite! Still WIP and still in pre-alpha, but it’s also still a lot of fun!

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.

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.