Thursday, November 13, 2014

Hero Brawler Game Prototype

About two months back I revived a game I developed a few years back called Death Arena, making various improvements, integrating it with Facebook, implementing various new gameplay features and getting it ready for deployment on the iStore. It's pretty much ready to go but I feel the need to do one last pass and see if there is anything else that can be improved before putting it out there.



Screenshots of Death Arena


However, the last phase of any project is often the most cumbersome and I started feeling a bit burnt out on it and decided I needed a break. This is how I justified allowing myself the twisted pleasure of working on an entirely new project when I had a 99.9% complete one waiting to go (and others on hold!). Admittedly, I felt a pang of guilt as I wrote this paragraph.

Anyway, I shall now cease this mincing of words and get to the point. I began experimenting with other game ideas for my next project. I experimented with transforming my PC-based real-time strategy game, Zyrtuul, into an iPad game, but it was a bit of a daunting task so I decided to hold off on that.



This is Zyrtuul. Attempting to simplify it so that it works on iPad (rather than PC) turned out to be a bit too complicated for my liking.


I toyed with several other game ideas before developing a two week long addiction to the iPad version of the game Injustice. Injustice is a one-on-one fighting game featuring DC Comics superheroes. The mobile version differs from the console versions in that it is less action-oriented and uses a collectible card mechanic, allowing you to acquire characters as you progress and level them up.



Character Store in Injustice


As always, whenever I get into a game I started feeling the urge to develop my own game inspired by it. So I started experimenting in Unity, trying to implement a similar concept. It's still a very early prototype (none of the game mechanics are in yet), but it's looking promising. I'm considering making this my next project (though I'll need to evaluate other existing projects that are closer to completion before making this call).

I purchased character models a few years back for another game prototype (called the Weeping World -- it was grim and awesome, but too large in scope). Hence the decent looking characters despite it being only a few weeks in.

It has a dark fantasy theme and is somewhat inspired by the early Mortal Kombat games (I had Goro's lair from the first game in mind when developing the first combat arena). As a prototype / proof-of-concept mock-up it is, of course, very rough around the edges, but I thought I'd post some screenshots of it's current state anyway.


In an act of callous heartlessness, an evil wizard gives his equally evil twin a solid blow to the crotch, thus reducing the likelihood of the poor fellow ever reproducing.


I added the blood last night. I'm not sure whether they'll allow this on the iStore though.


The arena needs more work to really live up to it, but was inspired by Goro's Lair.


Battle Setup Screen


Wednesday, September 24, 2014

Facebook API Example with Unity

I integrated one of my games (Death Arena) with Facebook today. I encountered a few difficulties along the way and, although there was information online, it took me a while to get it working properly. The code examples I found online didn't work without modification (I had to combine bits and pieces from various sources), so I thought I'd share my Facebook wrapper class in case others find it useful.

The class is pretty simple at the moment and only caters for the basics -- connecting to Facebook and posting a message to the user's wall / timeline. It takes in a heading string, a main message string as well as a placeholder name string.

For example, one might choose to use 'Bob' as a placeholder name. When calling the PostMessageToFacebook() method you could pass in a message of the form "Bob kicked ass in xyz game" and then pass in 'Bob' as the placeholder name. Once it logs onto Facebook and retrieves the user's first name, it will replace all instances of 'Bob' with the real name.


Sunday, August 17, 2014

Zyrtuul Progress

Progress on my real-time strategy game slowed down a bit in the last few months, so I decided to give it a bit of attention in the last week. It's at the stage where many of the core game mechanics are down -- it's fairly playable, but needs some more work for it to provide a genuinely good user experience.

I'm not sure where to take it from here. Initially this started as a fun creative outlet and as an artificial intelligence development testbed. It's grown into a full-fledged RTS game now. The removal of the multiplayer component still irks me a bit, though I still feel the scope reduction was necessary.

I've been considering toning the entire game down from a traditional RTS to something targeted more at the casual gamer. I've been playing Clash of Clans and was wondering if I shouldn't be moving in that direction -- it's easier to compete with the casual strategy games than it is to try put something out there that tries to compete with franchises like StarCraft or Command and Conquer (even if I was working full-time on it, it would take a loooong time to get it at a level where it could compete with games of that scope).

On the other hand, I've already put so much work into bringing it to its current state that trying to force it into a casual Clash of Clans style game would be pretty tough (I'd probably be better off starting from scratch, though there would be a lot of re-usable code and art resources to speed up the process).

I recently taught myself PHP and was experimenting with the database / server side components of a framework for making games of that type (Clash of Clans, Boom Beach etc). But I'm too attached to Zyrtuul as it currently is to butcher it like that. It's something to think about though. I'm considering buying a Mac Mini in the next few days and deploying to my iPad to get a feel for it.

Anyway, it feels like I'm rambling now. Here is a recent screenshot.


Sim Engine Graphics Talk Images

The company I work for requires some fresh meat, and so we invited some pending Computer Science graduates from UKZN to visit the company and gave some presentations so as to try lure them in. I've been maintaining the graphics engine for the last few years, and so I was asked to speak about that. On Friday I had to dig around for a few images for the talk. I quite like some of them and so I decided to upload a few (since I haven't posted anything in months).





















Saturday, March 22, 2014

Fractals With Shaders

I spent the last few hours experimenting with writing shaders to display fractals. I'm using the Julia Set (named after French mathematician Gaston Julia, who devised the formula). The Julia set requires a set of seeds to be fed in. I base mine on the sine of the application time (so the fractals shift and change over time). I also modify the ratio between the two components of the seed in a similar way, which varies the patterns quite a bit.

A demo can be downloaded from here:

Here are a few screenshots.





Wednesday, February 19, 2014

Loading Terrain Heightmap Data Via C# Script in Unity

For my real-time strategy game Zyrtuul I need to be able to load different landscapes at run-time. A fundamental part of this is loading terrain heightmap data from script. I implemented this last night. I noticed that many people have been asking how to do this online, but I did not see any complete solutions presented. It turned out to be significantly easier than anticipated. This implementation allows you to save your heightmap using any image format (I assume it is saved in Assets/Resources/Heightmaps). Simply attach this script to your terrain object and it will load up the specified heightmap automatically.



Sunday, February 16, 2014

Experimental Art and Design Work for Zyrtuul.

Work has been busy at the moment and I was feeling a bit worn out, but I still felt like doing work on Zyrtuul. So I decided to take a break from programming for the weekend and focus on the artwork instead. I started off searching for source material and looking for inspiration online, in an effort to settle on an overall look for the user-interface, splash screens and overlays of Zyrtuul.

For a while I was attempting to take rendered images of various vehicles, super-impose them over a background and then modifying them in Photoshop to fake a hand-drawn / painted feel. I was initially happy with the results, but after comparing them to other games' splash screens I realized that, while they were okay, they weren't great.




After that I decided to stick with my original plan, using more generic spacey images, which are much easier to make (there is a lot of good source material out there that you can combine to get a unique-looking, visually appealing final image). The image below is still experimental and not final, but gives some indication of what I'm thinking the overall look and feel of the splash screen will be.



I had already designed the look of the mission select screen, but I wasn't 100% satisfied with its current state so I spent some time tweaking that as well. I still don't think it is perfect yet, but it will suffice for now. The current mission select screen can be seen in the image below. It may be too dark to see, but there is a square spot reserved for a top-down image of the map near the top right of the screen. I haven't implemented that yet though (the game is still in the rough early stages).




As the artwork starts to look more polished, elements that I previously liked no longer seem as good as they did. This was the case with the in-game overlays (which I put together sometime last year). These include the minimap border and the 'command panel' (that is, that panel where command buttons such as 'move', 'attack', 'stop' and 'patrol' would appear). In addition to that, I felt it was time to change the way resources are displayed (previously I just had placeholder text at the top-right of the screen). I have put all three in-game overlays into the image below to show what they currently look like.

At the top is the minimap border. The minimap would appear in the square black region. Below that is the resource display panel. When in-game, a number will be shown for each resource type. Below that is the command panel. When in-game, if a unit (that is, a vehicle or building) is selected, buttons will be displayed in the command panel. These allow you to issue commands to the unit.



I was happy with the way the terrain looked, but I felt that some textures looked better than others. I spent a few hours making new terrain textures yesterday. I wanted uber-high levels of detail, and so I composited various images together for the diffuse maps (I've had a lot of practice so I'm getting pretty good at it). I then manually constructed normal maps in Photoshop. Ordinarily, converting the diffuse maps to greyscale and then using that as a heightmap will, although a cheap hack, do the job when using it as input to construct a normal map. However, I wanted a very specific look, and so I instead (painstakingly) constructed the height and normal maps. It is difficult to clearly see the results from the screenshot, but they look very good when viewing the game at full size (especially when combat is occurring, due to the way weapon lights interact with the normal maps).



The final bit of work on Zyrtuul for the weekend was done this morning. I wanted to settle on the game factions and their banners / logos. This took surprisingly long (it took me many hours to do the banners). This is what I'm sitting with at the moment (the logos at the top-right of the image).


Deciding what the factions would be was difficult -- it often feels like most of the good ideas are taken already, and so coming up with something genuinely original seems impossible. They say that most stories are just variations on a few common themes, and so I consoled myself with that thought and decided to just settle on something.

The idea of an empire vs rebels is very cliched for obvious reasons, but Star Wars wasn't the inspiration for that (although now that I have made that connection, I'm wondering if I need to change this). Anyway, I may end up changing this, but the inspiration for this was actually Spartacus.

I thought the idea of designated slave planets would make for a good story -- entire planets whose populations are automatically born into slavery. Groups of slaves are periodically 'harvested' from these planets and brought to work on the elite planets. And, of course, such a situation would inevitably result in rebellion, which would then require those in power to quickly squash it to prevent other slave planets from joining in.

As for the Smugglers' Guild, well they have no interest in such conflicts but occasionally get involved when it profits them. The Smugglers' Guild is amoral and neutral, but if they can get away with attacking either side so as to benefit from the spoils of war, they will not hesitate to do so.

Tuesday, February 11, 2014

Implementing Fog of War

Last night I began implementing fog of war for Zyrtuul, and made some decent progress. Tonight I spent a few hours and got it working properly.

My implementation uses render-to-texture functionality, and involves the following steps:

- Create an orthographic camera that renders the scene from a top-down perspective. This camera does not render any of the usual objects. It will only render special objects called 'fog of war revealers'.

- Attach a quad to each unit in the game. This is simply a flat upward-facing rectangle positioned just above each vehicle or building. I call these 'fog of war revealers'.

- Map an image which will control the way fog of war is revealed for units. I initially used a simple black image with a blurred white circle in the middle, but then experimented and am currently using the image below (made it in Photoshop). This simply makes the fog of war boundaries more interesting. Basically, each unit will be surrounded by an area of 'transparency' with the following shape (completely arbitrarily chosen at the moment and definitely subject to change).


- Create a render texture. This is a surface that the fog of war camera will render to. That is, instead of rendering to the screen, it renders to a separate image in memory. Set the fog of war camera to render to this texture.

- The first time the camera renders it clears the image to black. It then disables its clearing behaviour so that for subsequent frames the image is not cleared. This allows the fog of war state to be permanent. If we wanted the fog of war to re-appear at locations where there are no longer any units we would skip this step and have the camera clear the render target to black every frame.

- Set the blend mode of the fog of war revealers to be 'additive'. This means that wherever the unit moves, the image above will be added to the black background. The following is a visualization of what the render texture might look like if there were four units in the scene.



- Render a large plane at the height of the terrain. This will cover the entire scene. This plane will render in both the main view and the minimap view.

- Map the render texture to this plane's material. What we are doing here is having the render texture control the alpha state of this plane. Thus, the white areas will be transparent but the black areas will be opaque.

- Set the depth buffering behaviour of this plane's material to 'no z-test' and 'no z-write'. This will make the plane always render on top of anything (so that we don't have to concern ourselves with situations where objects are above the plane). Also modify the render order of the plane so that it renders after all objects that must be obscured.

Below are some screenshots of the game with fog of war enabled. The turrets do not currently have fog of war revealers attached to them (so they can currently be obscured by fog of war, which I'll fix later).



Sunday, February 9, 2014

Zyrtuul Screenshots.

I put a lot of work into a new pet project toward the end of last year -- a real-time strategy game that is currently going by the name Zyrtuul. I took a break for a few months but recently decided to do some more work on it.

I've added various new vehicle types. At the moment I'm focusing on getting the art in and looking good rather than on implementing specific vehicle capabilities. I quite like the new harvester. As it gathers red suphur (visible in one of the screenshots, the red stuff on the ground) a heap of red sulphur gradually grows on the back of the vehicle, until it is full.

I'm experimenting with a darker, more grim sci-fi look. I've taken out the trees and water and have put in rocks and lava instead. I've also removed the grass terrain textures and replaced them with dark rock / dirt textures. The look I'm going for is that of a barren planet. To further promote that atmosphere, I've subdued the lighting and given it a bluish tinge. The vehicles themselves are quite detailed, and when combat happens there tends to be a lot happening on screen, so I thought it best to keep the terrain dark and unobtrusive.