Archive for the ‘Game Programming and Design’ Category


Short update – this was a great week for independent developers.  Microsoft released their visual studio 2013 for free with the community edition which is much more powerful than the Express version.  Unity is fully integrated with VS2013 and that has been awesome working with an environment I am much more comfortable with.

Another thing that was awesome is that TFS is now available for me to use for source control and I can have up to four others on my project team.

This allows me to have others help out without me having to jump through flaming hoops to get them my source code and then integrate their changes into mine.

Now that all of that has settled down – I have completed the next sub task which was to get an info bar added to the screen which will display the tile information that the mouse hovers over, as well as to be able to draw tile upgrades.

In the screenshot above there is now a hamlet on one of my grassland tiles.  While its still not visually awesome – I am able to obtain some graphics for farms, mines, cities, etc and start working those into the game soon.

My next step is to display the town’s name on the map.


Project Blackwater is a 4x Game combining elements of fantasy lore with civilization and total warfare.  I have played Civ since Civ II, and have always wanted a better tactical combat game to go with it.  It seems that today you can get either the world or the battlefield, but not both.

Blackwater is designed to do both.  Keeping that in mind – I realize not everyone wants to play out all of their battles, so that is being taken into consideration on the design end.


I am using Unity to create the game.  The challenges that I am going to mainly be encountering initially will all revolve around art assets.  As I am a one man developing team and am not really a computer graphics artist, I will have to fill in the blanks as I go.

As the game is hex based, I picked up a copy of GameLogic’s grids scripts for Unity.  They also had for download some basic looking image files for overland tiles.  These look fairly bad right now, but using them I was able to construct a real quick hex grid of terrain types which I can then start using to create the working pieces of the game with.

Beauty will have to be put on hold.


I will be developing the game in 2D using cpu drawn hexes and overlaying sprites on top of them.  This game will look pretty sweet if it was 1993 😉  Once I get the engine knocked out I am going to be adding 3D meshes to work in a 3D version.  That really cannot be something that I worry about at present though.

As you can see from the screenshot, I can draw the hexes as I need and can click on each one.

Stage 2 – Hex meta data and displaying it

The next stage of development is to add some logic to the hexes themselves so that they know what they can do or what resources they hold.  Hexes, much like many 4x games, will hold food resources and productivity resources.  I do not want individual hexes to be selectable unless there is a unit or city on the hex.

This leaves the following work that will need done in stage 2:

  • Add the food and productivity values to a tile object
  • Alter the click event on the hex to not do anything at present (currently it highlights the hex with a white color)
  • Display the hex type and resource information on the screen via a form of tooltip.  I will need to obtain a food icon and a resource icon for this tooltip.

Behind the Scenes

The grid objects that GameLogic ship with their scripts work pretty well.  I did have to create my own type of cell, called an OverlandCell, which inherits from their TileCell object.  This OverlandCell object will be what the sprite cells and 3D mesh cells inherit from to capture the game logic behind it.

GameLogic’s SpriteCell now inherits from OverlandCell.  It will be that object that I add the resource information to.  More than likely I shall use a structure or a “resource object” which I will then plug into the class (as opposed to individual variables that hold the individual resources) for organizational purpose.

Up to this point I’ve created seven class objects to display just what is in the screenshot.  Things will get a bit trickier when I start implementing objects like armies, rivers, cities, etc but we will tackle that when we get to that point.

So I had to take some time to learn about some ways to draw lines and what not in my project.  I found a package called Vectrosity which was being touted as being pretty good so I dropped the money down for it.  

There is, of course, a bit of a learning curve.  However, once I figured out how to get my rectangle drawn I was pretty happy with the end result.



The only issue I see right now is that the reticle may be a bit too “soft” in appearance.  I got the appearance totally by accident.  


I was messing with some different particle effects as up to this point, the rectangle was just a solid white rectangle with ugly join corners.  I found the green/blue soft particle and applied it as the material for my rectangle and boom… it was perfect other than I may need to figure out how to make it glow a little brighter to bring the contrast up.

I will mess with that in the future.  For right now, I can target the object.


One thing I ran into was that after I would fly by the space station, the rectangle would then render itself on my screen anyway without the station.  It would then shrink slowly… basically applying itself in reverse.

To get around that I had to research how Unity knows if an object is being rendered or not onscreen.  Turns out it is very easy.  Note the code in my IF statement…

If DrawTarget is true AND if the renderer object has its isVisible property set to true… draw the reticle.  Otherwise do not. 

Boom… problem solved.

I am about finished with this phase of the project.  I am about ready to start messing around with a backdrop and applying the earth and the moon as this station is set as a moon platform.  



Made some GUI changes this evening.  Added the target panel and put it on the bottom of the screen and consolidated the bearing and engine to the top.

To keep the sun at a constant distance from my ship, I’ve done a couple things.

First, the Star.cs object has a GameObject called PlayerObject attached to it with public scope.  I then reference the player ship here.  From there, I add a second public float called RelativeDistanceFromPlayer.  This is how far I wish to keep the sun object from the ship at all times (the Z plane).

For right now I have set this at 5000.0f, which should push the sun 5000 away from the ship and toward the ship as the ship turns to it or away from it.

if (PlayerObject != null && RelativeDistanceFromPlayer > 0.0f)

//keep the Z axis the relative distance from the player
Vector3 sunPosition = this.transform.position;
sunPosition.Set (PlayerObject.transform.position.x, PlayerObject.transform.position.y, PlayerObject.transform.position.z – RelativeDistanceFromPlayer);
this.transform.position = sunPosition;


All that is left is to add a targeting panel now and Phase III is complete.



Today was fairly productive.  Not only was I able to get a workable sun put into the scene (not 100% crazy about it but it sheds light and looks somewhat ok which is fine at this point), but was able to get a working bearing indicator at the top of the screen going.

How’s It Work?
By default the bearing will align to the sun of a system.  The screen above shows that we are traveling 20 degrees NE.  I haven’t decided if I’m going to keep cardinal directions but for right now, true north in a system will be facing the sun.


The sun needs to be billboarded and stay in relative position to my ship.  This is my next challenge.  To complete Phase III the sun will need to stay relative to the ship.  I can’t travel to it.  That is among other challenges that still need addressed:

  • Sun stay relative to the ship
  • Empty targeting panel which will show current selected items details (distance, type etc)

Once that is complete, will be ready to head for Stage IV, which involves populating the targeting panel and targeting the objects themselves with brackets


Messing around with creating some sunlight in the scene.  Here I am rendering a star object from approximately 1 AU away (the distance from earth to the sun).  I compared some space photographs to get the sizing about right.  The challenge was figuring out lighting.

What you are seeing above is a point-light set over a star sphere and then given two custom lens flares.  The first is a subtle glow, the second is a cold clear effect.  I found those in the asset store for free (search lens flares).

I’m kind of bummed I can’t incorporate a third lens flare in there as there is a pointlight flare I’d like to use that will give it a twinkling look but I’ll revisit that later.  For now we have a sun.

There are two more steps that I have to take now.  The first is to make sure that the sun stays in the same relative position as my ship.  The second is to configure a compass so that it points solar north and shows my bearing (an important feature on all ships I’d think).  I will later allow the compass to be configured to galactic north as well as to compare bearing to a highlighted target.