Embers of Empire Update – AI Dynamic Navmesh / A Star Experiments

screen_12.08077

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.

Space Warfare: Infinite April Developer Log

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!

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,screen_7.920277
  • 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.screen_46.13708

Here is a recent video of some of the dogfighting action (hoping to get a cap ship video up soon too!)

AI Attacks GIF

I’ve been doing a lot of work on the AI this week. They are getting smart! I’ve got an FSM that uses steering behaviors now linking to a Goal processing AI so that each AI can determine goals and the steps to carry them out (or follow orders from other AI who commanded them!) Here is a gif of the AI attacking! No real complex thinking in that one tho!

 

View post on imgur.com

My Space Game Explosion and Space Battle Gifs Page

I am creating a page of Space Game Explosion gifs because every Monday I try to post one to Twitter. I thought it might be fun to have them all in one place on Badger Head Games. I like checking out how games and movies show explosions as I build them into Space Warfare: Infinite. Check back on this space for updates and more GIFs.

A few nice explosions in Freespace 2.

A few nice explosions in Freespace 2.

 

A freeze frame gif from my game Space WArfare: Infinite

A freeze frame gif from my game Space Warfare: Infinite

 

A shot of the flak cannons on the Battle Star Galactica

A shot of the flak cannons on the Battle Star Galactica

 

The Millennium Falcon taking out a TIE Fighter

The Millennium Falcon taking out a TIE Fighter

 

Developer Log – Building my own galaxy

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.

screen_16.33853

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. 

screen_54.12553On 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. screen_67.16019

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.

screen_67.58907

Dev Log: Bigger System Maps, New Procedural Generation Work

screen_121.3082I’ve spent most of my time lately reworking the way the game builds the galaxy, solar systems and local regions where the combat takes place. Just about got floating origin working so that the game can support battles over a solar system without having to jump between points of interest in separate zones. Also worked it out so planets and other big objects can be approached and not be background. Space stations or entire fleets could be on the other side of a big object and the system will handle switching everything from 3d skybox to real stuff to interact with. Also I am messing around with some art like this space station mock up. Its not a final piece, just something I through together to see wh
at it looks like in game.

Developer Log #2 – Creating a Mission Editor for Space Warfare: Infinite

I’ve been hacking away at a less fun and visually unimpressive part of the game idea for Space Warfare: Infinite — the Editor. The mission editor will hopefully be one thing to help set the game apart. As a gamer, the one thing I’ve always loved is being able to create my own game maps and play them. I made my own text adventures, had 3D Studio, I made stuff with the DEU – Doom Editing Utility, tried my hand making Unreal Tournament levels, made my own Starcraft maps. My hope is that this will be a feature that will attract an audience. I call it a Mission Editor, but the scope is going to be more than that. When its complete the player or me (I plan on using this to build the entire campaign mode of the game….) will be able to create simple battles, missions with objectives that range from patrol and fight pirates to a scripted battle between two giant fleets complete with dialogue and cutscenes.

Screen Shot 2015-07-07 at 9.15.31 PM

Features I am currently coding:

  • Place ships, stations and other objects on a 3D map.
  • Select a setting including naming the sector, adding planets, nebula/other background art, asteroids. Setting space dust/nebular clouds.
  • Place nav points and waypoints.
  • Trigger and Event Scripting – Trigger events like spawning new ships, winning a mission when ships are destroyed / navpoints reached, displaying a comm message etc.
  • Mission set up – Briefings, objectives, Debriefing, Success / Failure
  • Camera control for cinematic cut scenes
  • Campaign Editor – Connect missions together into a full game sequence – with ability to connect missions based on success / failure or other triggers

Currently, I have the XML backend working pretty well. You can move around the 3D map, place and manipulate ships. I have mission set up in and saving to a file. I have extendable menus for objects to place on the map as well as extendable lists of events and triggers. I am in the process of solidifying the events and triggers stuff and getting it to save to the XML. After that I am gonna jump back into the engine and make sure it plays nice and decodes some sample missions. I also have a mock up of the setting editor…

Planned / Stretch Features:

  • Ship yard editor – Customize, edit existing ships or other objects. Change default load-outs etc. Build new ships from component parts and add them to the game for user-created campaigns. (Customizing ship data will be available in xml no matter what… ). Something like this will be useful for my own dev so I might make something like this part of the initial tool set. At least to set up different specialized ships so I don’t have to dig through XML files.
    Unity is tough to mod for. I am looking at way to import user generated models for ships etc, but at the moment the moment it’s looking complicated. I have some ideas, but I can’t focus on it just now. On the flip side, modeling component based ships is already happening so adding a build-your-own based on my already modeled ship pieces might be simpler. I might even add some Star Trek / Star Wars -inspired hull styles etc, so that players can design their own styles.
  • System Map Editor – Like the campaign editor but missions would stand in as maps, they would be connected by triggers like reaching a nav point in a warp to bring you to the connected map.

 

Developer Log #1- Modeling The Fleet in Space Warfare: Infinite

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.

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.

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.

screen_64.67316

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.

screen_67.37792

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-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.

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…

Space Warfare: Infinite on the Space Game Junkie Podcast!

screen_140.1852

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.

Here is the link to the Space Game Junkie Podcast featuring Space Warfare: Infinite…  (for the younger audience of this blog – some of the hosts on the podcast let a few curse words slip so perhaps make sure that it’s ok with your parents to listen if you are still living with your parents… )

screen_322.5109

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.