Friday, March 28, 2014

Warriors, Archers and a Logo!

Well, there are times where being a student, working for a company, and working on private projects can be a little too much. The past two weeks were exactly that. Since I can't clone myself (yet), I had to leave my projects aside and focus on the others.

But, I didn't leave them completely, I just haven't found the time to post anything about them. So, what happened since last time?

  1. Warriors! And Archers! At first I wanted to finish the warriors indepently, but I figured it would be best to generelise the code for them to the most part. This way I can develop new "fighting" units much faster. Both of them are nearly finished, only the "shoot arrows" part on the archer side is missing.
  2. The Logo! As I said (several times) before, I'm a programmer, not a designer. Nevertheless I think I did a pretty decent Job! 

What do you think?

So, what to expect for the next days? Well, I hope that I finally find the time to make a video about the warrior (and Archer now). 

Thanks for reading!

Tuesday, March 11, 2014

PlayMaker on SALE!

Just a quick info, PlayMaker for Unity is on Sale in the AssetStore, only 31.59$ instead of 90.25$!
So, I recommend you get it now, you won't regret it! I need this tool almost every day, and some of my upcoming tutorials will also feature it!

Get it here: AssetStore

Tonight I'll upload the video with the warrior-update.

Till then, thanks for reading!

Monday, March 10, 2014

The warrior is here!

Another step towards finishing this game has been done!
Today, after hours of struggling with the GUI, which was appearing wrong, and I have to admit I still don't have any idea why, I finally finished the warrior. There won't be a video till tomorrow, because I will head to bed now, but as a little sneak peek, here's a picture:

The concept for him is pretty similiar to the worker, I didn't even had to change the major parts of the scripts. Some time during the next week I'll add a video (tutorial) explaining how the Units in this game do what they do, how the most parts of the code is reusable and so on. Maybe, and thats a big MAYBE, I'll even publish parts of the code-framework of the game, so that everyone could make something similiar.
We'll see. 

Good night everyone, thanks for reading.

Saturday, March 8, 2014

Use the KGFMapSystem for Fog of War

As promised yesterday, here a little explanation of how to use the Fog of War from the KGFMapSystem (which is on sale currently) that is only displayed on the MiniMap, in your game.
This is extremly usefull for TopDown-View games, like PocketCrusades.

The first thing you need to do is set up the KGFMapSystem. If you do not know how to do so, take a look here: KGF-Support.

Now, when you have everything set up, be sure to check the Fog Of War option in the settings.
Thats how it looks for me:

You can change the resolution depending on the size of your world.

Now, create a new Script called FowCreator.cs! Thats where we will instantiate layers that are visible for the "Game"- Camera. These will get the same texture assigned as the FogOfWar plane for the minimap.

Here's the script:

Thanks to Brainswitch Machina and Alexandre Ouellet for pointing out some improvements!

using UnityEngine;
using System.Collections;

public class FowCreator : MonoBehaviour {
 private GameObject[] layers;
 public float[] heights;
 private bool isCreated = false;
 // Use this for initialization
 void DoCreate () {
  isCreated = true;
  int layers_to_use = heights.Length;
  layers = new GameObject[layers_to_use];
  GameObject pre = GameObject.Find("fog_of_war");
  Vector3 apos = pre.transform.position;
  //apos.y = heights[0];
  //pre.transform.position = apos;
  //pre.layer = 0;
  for(int i = 0; i < layers_to_use; i++)
   layers[i] = (GameObject)GameObject.Instantiate(pre);
   apos = layers[i].transform.position;
   apos.y = heights[i];
   layers[i].transform.position = apos;
   layers[i].layer = 11;
 void Awake() {
 IEnumerator findLayer()
  GameObject ag = GameObject.Find("fog_of_war");
  while(ag == null)
   //Dont call find with string too often, this will slow the rest down
   yield return new WaitForSeconds(0.1f);
   ag = GameObject.Find("fog_of_war");

Now, in the editor assign some testing values. Depending on your "world" you'll need different ones.

Choose how many layers you want. The higher, the better it looks, however, at great computing costs. Since I develop for mobile devices, I just use one. The element values themselves are the height of the layers. The highest should be higher than anything visible for the camera.

That's it. Tomorrow I'll make a brief demo on the Warriors, be sure to check it out.

Thanks for reading.

Friday, March 7, 2014

My top 5 Assets from the AssetStore!

If I had to name one reason why I love Unity, the first thing that'd come to my mind is the AssetStore.

Let's be honest with ourselves, none of us is perfect in everything. I mean, I'm a programmer, and a, well let's say not the worst, 2D-Designer. However there simply are things I'm not good enough to create myself. So, in order to still create good looking games, you need someone who can do this for you, and thanks to the AssetStore, that's pretty cheap nowadays. Also there are enough situations where you just go: I could work 50 hours creating this, or I'll just spend 20$ for pretty much exactly what I want. Well, what you gonna do?

Over the last Year I bought quite a number of Assets there, so here's my top 5! I'll focus on "programming" stuff, because these are things you need in most projects. I bought a lot of models too, but these where pretty "project specific".

#5: Pool, Target, Constrain Bundle

The targeter in this package works fast and efficient, I could not have done it better myself. And the pooling is great, no more lagging when instantiating objects!

#4 Mesh Baker 2

I used this extensively for Empires-Rising, and without it, the game wouldn't even run on high-end Desktop machines! Merging together different Meshes with different textures into one saves you alot of draw-calls, and this thing makes it so easy!

#3  KGFMapSystem (minimap)

The best minimap system I have found so far. Tons of settings, different designs, you name it! It also includes fog of war, but only for the map itself. However, with a little tweaking I made a quite decent World-Fow out of it. I'll post how you can do that yourself this weekend.

#2 NGUI: Next-Gen UI

Did I mention that I love Unity? Well I do! BUT, the integrated GUI System sucks! Tons of drawcalls, it's slow, no editor, so you have to code everything "blind". It's just sad, Unity deserves better. And thats what NGUI is for! WYSIWYG design in the editor, TONS of settings, fast and efficient, and dozens of precreated tweens. It's all there! The price is a bit high, but I got it when it was a 24 hour-sale for 40 bucks, and I'm sure it will be there soon again.

#1 Playmaker

If you know this thing, and haven't bought it, you are an idiot. Ok, that sounds a bit harsh, but it's the truth! It reduces the time I'm working on small things like "selectors" (i.e. selecting a unit or building), raycasts for different things and so on by HOURS! Also, you can combine it with NGUI, which makes these both tools even better.

Thats it! Thanks for reading!

Monday, March 3, 2014

Here we go! Demo-Video!

Here it is, a little preview of the game!

It's not even close to finished, but I think you can see in which direction this is going. 

I have to apologize for the bad audio quality, the microphone I used was, well, shitty.
I'll arrange a better one for the next video, which will be uploaded in the next few days,
showing the barracks and the first warriors.

Thanks for watching!

Menu, Units, Some Buildings - DEMO VIDEO TODAY!

It has been some time since my last post, so today I'll upload a video showing the current state of the project.

 What has happened:

1) Menu
I finished the menu, where you choose if you want to play locally, online, buy stuff, or change the settings.

2) Units
The workers are FINISHED. You can send them around, let them build and repair buildings, or let them mine for gold. They even push each other around while doing so. I have to say, I'm very pleased with how they turned out. And, on the basis of their scripts I will create the other units (warriors and heros), so they won't be too much work.

3) Buildings
The state of the buildings is as follows:

  1. Townhall: Finished
  2. Farm: Finished
  3. Barracks: 50%
  4. Tower: 10%
  5. Altar: 10%

So, this evening I'll present the first InGame demo.

See you in a few hours,

Thanks for reading.