Gang Wars

First Steps

The first “big” project I tried to create was part of my first big exam I had to manage. The task given was to manage a game that fits into the description “Top Down Winner”, basically telling us that it has to be some sort of a Top Down game.

First thoughts:
– Shoot Em Up
– Little Rpg
– Strategy for 2

Taking into account that my skills of programming – not to mention the poor parts of art – weren’t over the top (and aren’t even mediocre yet), I had to decide for something that might be manageable in a small amount of time. Thus, I focused on a small strategy game for 2 players, fighting against each other to find a “Top Down Winner”.

This is how the whole playfield looked like. I know, very basic. Still, there is everything I wanted. Tiles, Obstacles, Icons for mercenaries.

Zwischenprüfung GDD

I made a Game Design Document to show what I want – and how. Not everything written there made it into the final game but it helped me stay focused. Right now, only written in German. Ideas were mainly taken from games like Shadowrun or Vandal Hearts, a real classic gem.

Small Summary:

  • Hot Seat PvP for 2 Players
  • Different Mercs with different classes and attributes to choose from
  • Turn-Based with Tiled Movement (no timer)

First Problems

Movement + Activation  I wanted to solve this via Raycasting – and it actually worked. I haven’t worked with Raycasts before so there was (and still is) room for improvements. I took the main camera as source for some kind of laser that shoots into the direction the camera is looking – normally. Here, i took the point of my mouseclick to guide the camera to shoot through the right spot. Basically, the laser asks the surface he is hitting – who are you? In my example, he asks for a tag, some kind of attribute I gave to any object in the scene. It didn’t take that long to confront me with a major problem – how to move? I mean, if I hit a figure and I want it to move, i wanted this to happen via

  1. click the figure
  2. click the tile
  3. move onto the tile

It might be obvious that instead of moving, the ray simply hit two different things. So I had to make clear that if I hit a figure, it gets stored and compared to the next thing I click on. Is it another friendly figure? Swap controls. Is it a tile? Move there.

RaycastScript

Details

These pictures show the different ranges one has to take into account. That is where tactics happen – do I move onto the field with all of my team or do I try to block some paths? Am I able to attack a certain guy when I wait here?

I wanted to change the color/ material of the ground so it get’s swapped out. Somehow, I wasn’t able to either get that proper line of code or my colliders did not work out that well. Instead of that I created some layers that get stuck to every different figure on the map, only activating when the figure is active, too.

That wasn’t really good performancewise. Not that this would in any way affect the gameplay of this game (since there was nearly nothing to load) but it just felt wrong. Anyways, it worked. I had to use multiple layers, the more movement the figure had, the more layers did it need. They also had to set themselves inactive whenever they are in a spot that can’t be reached by either a smaller amount of movement points or an obstacle.

Two more pics. The way it looks like when both players chose their figures. Second pic is “infight”. The blue cube with the sword and that orange circle underneath is the active fighter.

Notice that the icon for shieldbash is active at the screen bottom, saying that he could use it now. Combat works with calculation of damage via attack/defense + a hit rating that allows more squishy classes like the priest to avoid some damage. I shall post some screens of the code afterwards.

Everything that happens here in short:

First check if the attacker hits. If there is no hit, there is no need to calculate the damage. Second is a bit confusing but the last “method” actually happens before the second get’s in touch. There is a small formula that provides the impact of different armor and attack power and spits out the actual amount of damage.

Lastly, DamageFlows, takes the health away and makes it (damage) visible on screen.

Artwork

There is not much to see here as you might have already guessed. Still, I’d like to share some of the Pixel-Pics I made.

Download

If you want to try “Gangwars”, feel free to download the .exe right from my drive. Click the download button on the upper right when the new tab opens.

Gang Wars Download

I added a small HUD for hints and tips and a bugfix button. What is that bugfix button good for? Well, just one day before I had to present my project I found out that there was a major error occuring sometimes. What happened was that when a figure died, the bottom did not notice that it becomes walkable again. The bugfix toggle had to be used for those certain situations. Back then it was the real workaround I came up with. Now I would use a simple OnDestroy() funtction that is already implemented, telling that one area of ground i hit before dying to become walkable again. Lesson learned!

Thanks for taking your time to look through everything I have written and posted here. If you are interested or do have any questions, feel free to contact me via mail, facebook, twitter or contact form.