It’s been a bit of gap since my last post and that’s not for want of doing gamedev! I’ve been working on completing a Web Developer program over the last 6 months so I generally have not had much head space to work in Unity and C#. I have become a better programmer, however, and hope that I can apply some of the things I’ve learned to my gamedev sideprojects.
(Sorry if I am talking too quietly on video – everyone was asleep in my house!)
Recently I been working on Data Structures and Sorting Algorithms and it made me think back to my pathfinding problems I was working on last fall. Getting a better understanding of algorithms made me want to tackle A* and see if I could create a version adapted to a 3D space game without grinding the framerate to a halt. If I can get it to work, I can get my AI to navigate the giant Ember ships during dogfights much more convincingly. One challenge is the A* complexity increases as you add a 3rd dimension since you go from testing 8 neighbor nodes per pass to testing 26! Not to mention the vast playing field makes the grid huge!
A couple things I am doing- AI ships will still do some Raycasting to see if they just have a clear shot to their target. If they get too close to an obstacle and its in the way they ask the A* pathfinder to find a path.
I plan to add a way to check if the path brings the ship to an open shot to the target early thus they can abandon the path. Also I could figure out a test that determines if a pathfinding can end at an early node because that node has line of sight. This will cut down on lots of searches when an AI is just jumping around one asteroid. I also want to add a way to cancel a path if the target moves into the open, etc.
Additionally, I may tap Unity’s job system to let a new thread handle the pathfinding to keep the program from stuttering as it calculates. I figure paths could be generated async with far enough lead time that the ship wont crash.
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!)
Welcome to the first in hopefully a series on making a space game. For some time I’ve been thinking of creating blog posts and videos about how I am creating Space Warfare: Infinite and creating a resource for other aspiring developers. I’ve been messing around with programming games since I was 11, but I am completely self taught so I never feel like an expert enough to really tell people how to do stuff in this world. However, I do lots of research and have been collecting lots of resources. So while I might post some vids / tuts on how I did things, I also want to share some places I found helpful. Below are a number of videos on how to model sci-fi scenes, space ships, and other related things. I am storing them here for myself and my own work as well as for you!
Blocking out – Design Videos – Not Blender Specific
The video above does not use Blender, but watching how he designs and his commentary is really cool for your process. No matter what software is used or what language, you can always learn from people who know what they are doing and then try to apply that learning to your own world. So don’t only look at Blender or Unity tutorials when you can apply overall concepts.
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!
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 freeze frame gif from my game Space Warfare: Infinite
A shot of the flak cannons on the Battle Star Galactica
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.
I’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.
I’ve decided to do a series of Youtube Let’s Plays of games that I enjoy playing that I also draw inspiration from. I plan to show off some of the game’s features and discuss the things I am working on in Space Warfare: Infinite. So, first up is a game I’ve been playing a lot of – Angels Fall First. This game has been in development for awhile, and I’ve always been inspired by their Space, Air, and Ground combat. They cover both space sim combat and first person shooter combat. You feel like you are in a big war every time you play. I love the feel of the game when you touch down in a warzone and I think the ship models and locations are pretty cool. I definitely look to some of their fighter models for inspiration. I also love being able to run around inside the big ships.