Unity 2D space shooter – gameplay / gamedev video update – update 9

New planet graphics and the minigun firing

I’ve been spending sparse bits of my time in the evenings fixing bugs, and adding new features to the 2D space shmup project. For now it is really just a case of getting the “platform” ready. Once that is done, I’ll have all the bits and pieces I need to create the game/storyline I have in mind. This blog post will hopefully serve as a gamedev and features showcase on the latest developments!

New planet graphics and the minigun firing

New planet graphics and the minigun firing

 

chaingun in action

Quick animation test of the new chaingun weapon

 

new-sprite-samples

Some new sprites

 

With that said, I do have a video update to show today! I’ve been working on tons of new features (and fixes) since my last blog post. Here is the latest gameplay video, with a non-exhaustive list of just some of the fixes and new features following that.

 

 

  • 2-player local co-op with gamepad support
  • New weapons: Chaingun, and spray. Tweaked/improved the look of the other existing types.
  • New animations and sound to fit the new weapons. For example the minigun spins up and down, and has matching sound effects.
  • New enemy types – For example, segmented worm waves (think strings of enemies worm across the screen – break a section off by shooting them to pieces)
  • Enemy wave fixes – some wave patterns weren’t working 100% For example incorrect numbers spawned in triangle waves, and some wave numbers were not tracked correctly. All fixed now
  • New bullet system implemented. It is a lot easier for me to customise and tweak player guns/bullets now
  • Camera shake effects
  • New sounds/praises/bonus when destroying complete waves
  • Nukes that destroy everything on screen
  • Player damage fire/debris based on health
  • More enemy customisation options – for example specify their wave spawn height in terms of ratio of the screen height – 0.0 to 1.0, or choose finer grained detail like how close worm segments follow each other.
  • Health pickups
  • Enemy health bug fix – sometimes enemies would become invulnerable
  • New planet sprites and planet spawning options for aesthetics – you can control planet scale, as well as their rotation and speed settings now. Although they are just eye candy, they are fun to add to levels.
  • Menu and GUI tweaks
  • 2D ordering bugs fixed
  • Star particle system ordering issue fixed
  • New audio system implemented. The second custom asset I am using now – SoundManager Pro 3 (the other one I use is DF GUI)
  • A bunch of new ambient sounds and effects for the game added – thank you to freesound
  • Lots of other tweaks and bug fixes…

There is still a lot more to work on before the framework is ready for actual game development. Watch this space and be sure to subscribe to my Youtube channel, or to this blog top-right corner of this page for future news, gameplay and development updates 🙂

Unity 2D space shooter – a real GUI and menu system – update 8

in-game-ui-3

The search for a Unity 3D GUI system to fit my needs

in-game-ui-3

Up until now, I had not yet shown off any GUI work, and for a good reason too! The game had been using the built-in GUI that Unity 3D version 4.3 offers, which as many of you know has not been the greatest, or easiest to to use. A few months back I invested in Daikon Forge GUI for Unity 3D whilst it was on special on the asset store. This is the only third-party asset/plugin I have actually invested in and plugged into the game.

There was a small bit of a learning curve at first, but there are a bunch of tutorials over at the Daikon Forge UI site that get you going on the basics.

I used the template game menu UI that comes with the examples to get me going on my own menu UI, so much of it is heavily pillaged from the examples, however there is a lot of customisation and extra coding I have thrown in myself to customise the menu system to the way I want it. The in-game UI you see in the screenshot above is all my own work based on what I learnt from fiddling with the menu template examples. I am also in the process of slowly replacing all of the sprites in the menu UI to those of my own creation, as I don’t want to be using any example assets when the game is finally ready.

Progress visuals

Here are some screenshots of some of the menu and game UI for now. These are all very rough cut versions at the moment, so do note that there is still much more refinement to go in.

Title screen

main-title-screen

Main menu

main-menu-screen

Campaign level selection screen

campaign-selector-screen

Custom game selection screen

custom-random-level-screen

In game UI elements for a two player local co-op game

PS if you’re wondering, player2 died before taking these screenshots 🙁

in-game-ui-4

 in-game-ui-2 

Daikon Forge UI vs Others

In my opinion, Daikon Forge UI seems to offer the best value for money in terms of custom GUI systems for Unity. We have not yet had Unity 3D 4.5 release (which seems to be holding back a fairly impressive looking GUI system with it), so for now DF is in my opinion the best for my use case. Even after watching the Unity 4.6 GUI release videos, I actually can’t see a feature set there that beats Daikon Forge’s. I have found DF to offer some excellent built in features like property binding, various tween and animation curve options, sprite atlas options and much more. I’ll have to wait and see, but I’m skeptical of Unity 4.6’s GUI feature set scope at this moment in time.

I have already been using the handy tween and tween group features on the menu screens that slide in/out when navigating around, as well as for hover effects on select-able menu items.

Other valuable tools to fit into your game dev toolbelt

texturepacker-logo

I have been using the excellent TexturePacker from Codeandweb for all my game and UI sprite editing needs, as well as for use in editing my sprite atlases used with Daikon Forge. Daikon Forge UI offers good integration with TexturePacker – its as simple as exporting your spritesheet in TexturePacker, and using the DF UI option to import a TexturePacker spritesheet. No more than 5 clicks and you’re pretty much done. The workflow I have been using with TexturePacker has been invaluable to me when working on my menu and game UI elements – so if you are looking for a decent spritesheet editor with tons of features, I haven’t been able to find anything else that beats TexturePacker. One other very useful feature I almost forgot to mention is it’s command line utility for controlling your texture/sprite workflows – very useful when you are constantly changing and testing new graphics!

 

Unity 2D space shooter – object pooling and other progress – update 7

I am writing this blog post from an apartment in Girne, enjoying a week off of work (the day job!) with my wife in Northern Cyprus. We spent the day today on a boat trip cruising around the coast, swimming at various points along the way and enjoying the sun. Being off of work of course also allows me time to work on the game in my own spare time, so I thought I would do a quick post detailing progress on the project this evening. One of the major improvements and milestones I have reached recently is the addition of object pooling to the game. For anyone working on any decent kind of bullet hell / shoot-em-up game, this design pattern is a must if you wish to maintain decent performance. I started off the project not using object pooling, and soon started noticing small performance hiccups when instantiating and destroying some object types. My guess is that this was either to do with memory allocation during the expensive game loop creating large groups of enemies, or when the GC was cleaning up objects that were being destroyed.

Enemies are now pulled from an object pool to keep performance up

Enemies are now pulled from an object pool to keep performance up

Well, I’m happy to say that I have finished work on an object pooling system. Whilst fairly basic, it does a good enough job, and allows for dynamic expansion if the objects that are pooled at the start of each game are not enough during gameplay. Bullets, projectiles, enemies, and other objects of which there are usually many, are pooled, and the system ensures they are disabled when “destroyed” and returned again when needed. Apart from object pooling, the following is a high-level list of what else I have been working on:

  • Level system, allowing the user/player to create and edit levels via XML configuration files – each level that is created is listed in the game menu to play. Everything is customisable – from the enemy types, wave sizes, properties, pickups that are dropped, to the cosmetic stuff like space junk and asteroids that fly around. Previously, the game started with just a single level, of which I have been testing all game elements in.
  • Menu UI – I am using Daikon Forge for the GUI parts of the game. I picked this up on special, and must say it has been well worth the money I paid, even if I had bought it at the normal price. I have been using a daikon forge example menu, but am heavily modifying it for my own use, especially for the next feature…
  • Custom games – giving the user the option of starting a custom, randomised level – the player can select parameters for each system in a game of which to randomise, then play this level. My idea is that this will be an “endless” mode. Players choose size ranges for things like enemy count per enemy wave, pickups to drop, cosmetic stuff to use in the level etc…
  • Bug fixes – some enemy projectile bugs came up recently due to the fact that I was now re-using objects rather than destroying and re-instantiating them. Some of the bug fixes I have been working on relate to this.

My aims at the moment are the following:

  • Continue work on the GUI elements in the game
  • Introduce new projectile systems for enemies and player alike
  • Start developing a single-player campaign using the new “level system”
  • Possibly add dialogue and a bit of cutscene interaction to the single-player levels

Here are a couple more screenshots showing a bit of level variation which is now possible via XML configuration. level-screenshot3 level-screenshot2

Unity 2D space shooter – new enemy graphics and animation – update 6

Before I forget, I need to write a bit about some new enemy graphics and animation I recently added to the game. I have been using some of Dan Cook’s excellent artwork for enemies in the game (I used the same stuff for Cosmosis), but in some cases have been bootstrapping his stuff to create unique enemies, or improve on them.

For example, most enemy bosses in the game are a combination of bits and pieces I found in Dan’s “Iron Plague” collection. For the player’s ship in this game, I used one base sprite, but have been developing new ship “parts” that bolt on to this, improving the look, or to be used as new weapons or other modules.

The newest enemy I added recently is a prime example of developing new artwork to create unique enemies. Here is the base sprite I used from Dan’s collection for this enemy:

canister-original

I used the base piece and changed it quite a bit, using my trusty Wacom bamboo tablet and a few small brushes in PS. I created a bunch of frames for the base piece animation, and used the four corner pieces as “weapon bay doors”. Using the animation system, I created a simple transitioning effect to open/close the door panels. When the panels open, the enemy fires three projectiles in sucession at the player.

The new sprites:

new-enemy-spritesheet

Here is the resulting enemy animation, including firing of projectiles at the player:

enemy15-animation-ex

 

Unity 2D space shooter – progress and gameplay showcase – update 5

I managed to get a fair amount of work done on my 2D space shmup project this weekend (apart from DIY around the house and other bits and pieces that have been waiting to get done for ages!) So this blog post is update number five on my progress so far.

space-shmup-updatescreen1

Firing the arc laser whilst taking incoming plasma fire from these pod-like swarming enemies

 

For anyone who has not seen the previous updates, I am working on a 2D space shooter /shmup/bullet hell game I’ve been developing with the help of the Unity2D engine. The original game I created is called “Cosmosis” and is out for iOS on the app store. However, that is an aging project I created a few years ago using cocos2d-iphone, and this is a brand new project, built from the ground up with better code, better graphics, and many more features and gameplay attributes 🙂

 

 

I wanted to also point out that I have been making as much of this game as editable and customisable to the user as possible! Everything that appears in a level, from the enemies, to their spawn patterns, the starfields and other space junk that fly around, plus all of their properties are editable to the user via XML! This means you can essentially create your own enemies/levels, and customise the way they look. My ultimate goal is going to be to include a level editor too. At the moment I am having issues with XML on mobile devices. i.e. Android and iOS. I’ll have to think of a way around this, as currently the only way I’ve been able to get the XML into the game to play on these devices is via the Internet – i.e. downloading it at runtime. Anyway, enough of that, and lets take a look at the new stuff:

Here are some of the new features that you may notice in the gameplay video I have:

  • Shield and shield hit effects + shield level that can recharge after taking a break from being hit
  • Missile defense node array that jump around shooting down incoming missiles
  • New enemies and animations on some – for example the pod-like enemies near the beginning of the video that swarm out, open a series of compartments up, and fire red plasma at the player
  • New enemy spawn patterns
  • Arc laser weapon
  • Swing arm mounted rocket weapon
  • Energy system to power missile defense nodes
  • Basic menu and some new GUI graphics
  • Built in console to issue commands in-game (the console is thanks to https://github.com/mikelovesrobots/unity3d-console)
space-shmup-updatescreen2-boss

Fighting a mini-boss who is armed with homing missiles and a plasma cannon.

 

I hope this update is looking better than before! There is still lots more to do, and many more ideas I still have to implement into the core game. After that, it’ll be setting up various levels and an actual “game” to play. If you have any comments, feedback, suggestions or ideas, please feel free to drop them in a comment 🙂

Unity 2D space shooter update – defense systems

In my opinion, players need some sort of defense systems in any kind of bullet hell / shmup type game. Sometimes the action can get a little too much, and it becomes very difficult to avoid getting hit by projectiles. I have recently been testing homing missiles launched from enemy ships in the game, and sometimes there are tons on screen tracking and hitting the player at any one point in time.

deflectorshield_defense_lasers

I decided it was time to add some defensive systems to my 2D space shooter game (I still need to think of a name!). Over the last few weeks, I have now implemented two defense systems (amongst other development):

  • A deflector shield that absorbs impacts/detonations from enemy missiles – based on a simple “energy field” shader effect I found, and then modified to move the effect to the location of the hit. A shield charge GUI bar element is used to track the strength of shields (Daikon Forge is used here). If the player doesn’t take any hits for 3 seconds, the shields start charging up again.
  • Missile defense laser nodes on the player. These work on the basis that one defense node has one pulsing beam laser. Ideally, each node will be attached when collected from an enemy drop, and the more defense nodes the player has, the more missile shoot-down capability he/she will gain. You can see 3 x defense nodes in play in the GIF animation above – a short, pulsing red laser. They start firing at random incoming missiles when the missiles get in range of the player, and subtract “fuel” from each missile object. When a missile runs out of fuel, it detonates, so in effect, the laser defense nodes shoot down enemy missiles 🙂

I’ll probably capture some cleaner, lengthier video of the above two defense systems in play if anyone is interested in better footage, or gaining a better view of how they look and work. Just drop a comment on this post.

Cheers!

New Unity3D space skybox completed – Starfield Space Skybox

Having a thorough appreciation and enjoyment of sci-fi / space themed games means that creating “spacey” skybox assets for Unity is quite an enjoyable process for me. I currently have four or five different skybox assets on the Unity asset store, and I believe this one comes in as my sixth. This one is currently awaiting review by the asset store team, so as soon as it is ready, I will update this post. Note, that I do offer the option to purchase this asset direct, so feel free to get in touch if you wish to go that route instead of waiting.

Here is a quick look at a couple of still shots of the scenery you can experience when using this new “Starfield” Unity3D space skybox asset in your games or projects:

starfield_space_screenshot3

Unity3D skybox - starfield space

Of course you can also take a quick look around in an actual demo (Unity web plugin download required):

Starfield space skybox demo

That’s it for this update – for more skybox variations and themes, please take a look at my Unity asset store listing here. Note that in some cases it is also cheaper to purchase direct depending on your currency – check the links on this site at the top menu for more asset purchasing options 🙂

Lastly, here is a free wallpaper download of the above scene for anyone who would like to use this on their desktop (1920×1200).

Unity 2D space shooter update – adding a laser weapon

I recently had a nice, month long holiday in South Africa. Apart from affording me some well deserved downtime and a “castaway-like” beard, this meant I was also able to get quite a lot done on my re-working of “Cosmosis” (my original iPhone/iOS app) using the Unity engine. This time the game will be developed for just about every platform out there – one of the best features of the Unity engine! Being a re-write from the ground up, this has meant I have also been adding a lot of new features and new systems to my Unity 2D space shooter (shmup) project.

This post covers the work I did on a new weapon – the “arc laser”. Here is a quick demo of a short burst fire on the laser:

arc laser demo

 

Currently, once the laser is picked up, you get around 10 seconds worth of firing out of it. After this it runs out and you switch back to your primary cannon fire (or your primary cannon fire plus rockets if you had previously collected that weapon). The laser also features a small animation on the player’s ship, which is the laser arc cannon mount point, which pops out as you start firing. This needs a little bit of tweaking as the position is slightly out at the moment.

Here is how I achieved the laser effect for anyone interested:

  • Two line renderers, one with a small transparent PNG texture with a gradient going from light to darker blue. Each line renderer is attached to a gameobject on the player’s ship
  • The primary beam line renderer has two points, and a 2D collider. When the beam fires, in code I set each point of the line renderer according to the player’s position, and a point off screen. I also activate the collider which is disabled by default.
  • The secondary line renderer is what I use to achieve the arcing effect. This has around 20 points, which I manipulate using the Mathf.Sin function. (See further below).
  • When firing, a float value is tracked, and the deltatime from the game’s update loop is subtracted from this to determine how much more “ammo” your laser has. Once it runs out, the line renderers are disabled and the weapon removed.
  • Taking your finger off the trigger so to speak also results in the line renderers and the collider being disabled (along with the sound effect for the laser).
  • Damage is applied to enemies when the laser’s collider hits them. Of course, damage needs to be incremental, rather than once off like other projectile weapons are, so a timer is used to damage enemies based on how much time they spend colliding with the laser beam.

Here is the basic code I use to manipulate the points on the arcing laser beam, giving them the animated effect you see above:

for (int i = 1; i < laserSegmentLength; i++)
{
	var pos = new Vector3(i * 1.2f, Mathf.Sin (i + Time.time * Random.Range (0.5f, 1.3f)), 0f);
	laserLineRendererArc.SetPosition(i, pos);
}

 

Well, that covers the laser weapon update. There are plenty more changes that have been made recently, so I’ll have to cover those off in another post!

Creating a basic 2D runner game with Unity – GGJ14 solo session

Being quite busy at work meant that I didn’t really have any time to prepare a team or attend the Global Game Jam (14) this year, so I decided to “unofficially” participate from home. I used Unity3D (Unity2D to be precise) as my engine of choice, and created a very basic runner game. Being a solo effort, this of course meant I did the coding and artwork myself.

The tools involved were the following:

  • Unity and C# scripting
  • Photoshop
  • Wacom Bamboo
  • For the main character (a knight), I downloaded this asset from gsanimator.com

This video is a time lapse of the 8-10 hours I spent on the project. I didn’t manage to finish, so there is still more to do, but I have the following basics done:

  • Runner with basic jump/double jump controls. Character speeds up the longer time goes on for, making it more and more difficult
  • Box obstacles that drop and get in the way
  • End game is when you fall off the edge of the screen
  • Bullet time like effect every now and then – game slowly turns to slow motion, and fades to black – as the darkness hits, the landscape turns to a post-apocalyptic scene – idea being that more dangerous obstacles come down in this mode. After this, the time slowly speeds up again, and the landscape turns back to normal.
  • Managed to create some custom artwork – two different backdrops for the scrolling parallax background, some debris, etc… The knight character was found for free on gsanimator.com


If anyone is interested in source or how I achieved a certain effect, please just drop a comment below.

Unity 2D space shooter – retractable wing animation

Cosmosis, the original shmup for iOS

I created my first 2D space shooter (shmup) called Cosmosis in Objective-C using cocos2d-iphone a few years back. The game didn’t feature much with regard to individual sprite animation though. Since recently getting acquainted with Unity3D, I decided to recreate Cosmosis using this excellent tool. This decision was even easier after seeing the 2D features of Unity launch a few months back.

Being quite well into re-development of my shmup, this post covers a small update. I have been working on a new feature (when compared with the original Cosmosis game), specifically retracting and extending wings that can fire “dumb” rockets.

Unity and the 2D toolset for animation

Having had to learn to use Unity’s animation and state machine system, I must say it is very comprehensive. I still have much to learn, but so far I have managed to grasp some of the basics of the system.

The base player ship and gun mount are graphics courtesy of Dan Cook (lostgarden.com). I didn’t have the retracting and extending wings, so I created these myself using Photoshop. This was a simple case of drawing the basic shape with the polygon selection tool, followed by adding a few layers for detail. Using the brush tool, I added the content and colour. I was also careful to match the colours to the original player ship graphic.

The original player graphic with a gun mounted is show below on the left. On the right is the player with newly created wings/rocketpods extended.

original-player-with-gunmount       player-swingarms

 

Finally, here is the animation system in action. When the fire button is pressed the wings extend and fire rockets. Let go of the fire button, and the wings retract again. You will also notice the small gun mount in the middle of the player’s ship. This has a short recoil animation which loops when the player is using the primary “gun” weapon. The primary gun fires a simple blue coloured projectile.

rocket-fire-animation