It sure has been a while, hasn't it? I ended up getting the job I mentioned in one of my last posts, and that has kept me really busy. I even got sent across the country for a couple weeks! Things are finally settling down to where I have been able to start working on game development again. Here's what I've been up to!
Winds of Commerce
I took a look at what I had previously made for Winds of Commerce, and taking what I have learned since I put it on hold, I think if I want to continue on with that I will end up remaking it from scratch. There is a lot of code that I am not happy with, and going forward I think it would be more work trying to build the new code from the existing code base than it would be start over and have a better design of the whole thing. This is especially true for when I would need to add enemy AI. The existing code is not very modular, and it would just be adding to the disorganization to continue on with this code base. In the end I'm going to shelve the game until a later date. I may create it in a different engine, since UDK is not really suited for running what essentially is a 2D game. There is a lot of overhead that isn't being utilized.New Project
I was playing Sonny a couple weeks ago and thought that something like that might be an interesting game type to try and make. I spent about a week designing the base combat system (since that game style is almost solely combat) and I got a system I was happy with. I haven't been able to test it in a real life situation, so it might have to be overhauled once I get a chance to test it. Basically you have four base stats that six other stats are derived from. The six derived stats are what are used in combat to determine your effectiveness. There are also boons and skills that can affect different aspects of combat.Given what I decided to do with Winds of Commerce, I sat down and looked at some of my options for game engines. I wanted to stay with a language I was already familiar with so that left m with either Flash (AS3), UDK (Unrealscript), Construct2 (Visual Scripting), or C#. I immediately ruled out UDK, for the same reason I don't think it was a good choice for Winds of Commerce. I also ruled out Construct2 because I think setting something up with the all the features I want, while doable, would be overly complicated using Construct2. That left me either using Flash, or finding a game engine that uses C#. I was leaning more towards C# since I use it at work and have gotten used to some of the features it has, and working in Visual Studio. I found that the Unity game engine supports Java, C#, and Boo script. Unity has a lot of built in support for doing 2D games, including sprite sheet handling, layers, and a pretty cool animation state editor. I could also do all of my code development directly from Visual Studio and utilize the power that it offers with Intellisense and refactoring, among others. To me, this made the decision easy since Unity offers almost everything that Flash offers, with most of them being better than Flash.
I plan on going through documenting the process I'm going through. I'll save that for another post since this one is getting a bit long.
Complimentary Code Bit
To wrap things up here is some code I am using. For drawing the GUI elements you have to provide a rectangle to tell it where and how big to draw the GUI element. It didn't make much sense to me to have all of that be calculated every frame since mine won't be moving at all. To make this easier I created a small class to create the rectangle for me, as well as store other data as I need to. It is essentially a glorified Rectangle class, but it allows me a bit more flexibility, plus I can add any other fields I want associated with a particular GUI control, such as an image or particular GUI Skin.Here is the class:
public class Control { private int x = 0; private int y = 0; private int width = 0; private int height = 0; private int bottom, top, left, right; private Rect rectangle; public int X { get {return x;} } public int Y { get { return y; } } public int Width { get { return width; } } public int Height { get { return height; } } public int Bottom { get { return bottom; } } public int Top { get { return top; } } public int Left { get { return left; } } public int Right { get { return right; } } public Rect Rectangle { get { return rectangle; } } public Control(int newW, int newH) { width = newW; height = newH; UpdateBounds(); } public Control(int newX, int newY, int newW, int newH) { x = newX; y = newY; width = newW; height = newH; UpdateBounds(); } private void UpdateBounds() { left = x; top = y; bottom = top + height; right = left + width; rectangle = new Rect(x, y, width, height); } public void SetWidth(int newW) { width = newW; UpdateBounds(); } public void SetHeight(int newH) { height = newH; UpdateBounds(); } public void SetX(int newX) { x = newX; UpdateBounds(); } public void SetY(int newY) { y = newY; UpdateBounds(); } }
Here is how you would initialize a Control:
private void InitializeBackground() { panBackground = new Control(800, 800); panBackground.SetX((Screen.width / 2) - (panBackground.Width / 2)); panBackground.SetY((Screen.height / 2) - (panBackground.Height / 2)); }
And here is how you would use it in the OnGUI method to create a button:
public void OnGUI() { GUI.Box(panBackground.Rectangle, GUIContent.none); }
Thanks for reading!