Making a Space Game with Unity and Blender: Modeling Space ships and Sci-Fi Interiors

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!

Blender Specific Videos

Space Ship Creation in Blender Tutorials

Hull Plate Tutorial from Daniel Brown on Vimeo.

Interiors, etc

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.

Reference and Idea Videos

Blender Artists Giant Spaceship Thread…

Random Spacey Stuff

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

 

New Ship Mesh, New Version Uploaded of Space Wars

New ship meshes, missiles, distant planets, space jump gates to nowhere! I uploaded a new version.

Updates:

  • New mesh designs for the enemy fighters. I think that look pretty cool. Not too original but I am excited to get the hang of it. Really this mesh is probably the mesh of the player ship or at least human style fighters. Alien races will have more interesting looks.
  • Targeted Missiles: Center mouse or left cmd key (left alt on PC? not sure) to lock on. And then Right click or option button since I just realized that it wont work in a browser game… mash some keys to see what does what i suppose – to launch missile
  • Capital Ship: Its just a place holder experiment. It has turrets that can be destroyed. The rest of the ship cannot. Will be working on a 3D mesh for cap ships and turrets so we can get rid of giant rectangles.
  • Distant Planet background: Now the planets are set in a 3D sky box of sorts using a camera trick. Unlike normal sky boxes, you can actually move closer to the planets — when you get close enough it  will one day ask if you want to land… not yet. I think you end up flying through the planet at the moment, but it will take longer than most attention spans to do this.
  • Jump Gate: Spinning blueish particle thing. I am working on this concept, probably will oneday look more like a nebula cloud or something. Anyway now it jumps you to another scene in which I think controls are messed up and everything is broken – yay!

Anyway, not a huge amount of progress really. The AI still stinks and there isn’t really a game or mission or anything but turrets and bad guys that attack and the satisfying feeling of watching the enemy explode when they get hit by a missile is nice.

Todo Shortlist:

  1. AI Choosing Targets Script – move away from just focusing on the player will allow NPC friendlies and we can set up real battles.
  2. Friendly ships, non-combatants (helpless space miners being chased by pirates?)
  3. AI Behaviors – Patrol points, search and destroy, defend, attack, flee, tactical moves, etc. Expect a few of these soon.
  4. Working jumps to other sectors. Will just take some time to figure out how to make it work.
  5. Ship meshes – more and probably more component based so we can build and modify them in game. Front middle and back portions that you can swap. Cap ships will probably be built out of lots of middles parts. Also had some ship model ideas:
    – Porcupine Class – two top mounted missile launch boxes with semi-guided missiles – fires like 6 from each box
    – ECM Class – creates interference over a set radius that shows up on radar like additional ships – masking actual ship locations
    – Capital Ship with Launch Bay for Fighters
  6. More weapons –
    – Energy weapons that are strong but get weaker over distance
    – Classes of projectile weapons – light, medium, heavy, capital
    – Different Missile Types:
    – Dumbfire – they fire straight at what you point them at – good for slow moving / stationary targets
    – Targeted – initial lock-on followed by dumbfire behavior
    – Seeking – lock on that must reacquire target after a certain turn radius – can get confused by counter measures
    – Guided – lock on and chases target – most accurate

Modeling 3D Space Ships in Blender

I spent part of the morning playing around with Blender. I made a smallish space ship model that looks better than the flying rectangles I am currently using. I will play around some more until I have something cool. The plan is to have a good enemy model and a good capital ship model sometime soon.

The trick to Blender is watching lots of Youtube videos. I have a couple books, but watching someone model something really helps. There are not alot of helpful tutorials out there on using Blender to model machines and vehicles. People focus on sculpting characters. Getting the right info for what I am trying to do has been difficult. My biggest barrier (other than how complicated Blender is) was that I needed to understand how to use a Mirror modifier so that I could make symmetrical ships. BornCG has very helpful tutorials on Blender and one is about the Mirror modifier. Now I know how to do that! You can see the results above.

Screen Shot 2013-12-07 at 3.44.43 PM

Block Art Capital  Ship – see I need to learn 3d modeling

Game update: Planning on uploading a new version soon. Not sure how much longer the game will work ok in the browser. Seems to be ok so far. Recent updates have included –

  • missiles that lock on and chase target,
  • a giant capital ship over a km long with turrets that track and destroy the player,
  • a 3d skybox set up removing the ability to crash into a planet,
  • jump gate that takes you to a new level albeit with a lot of bugs…