Energy Quest

The Making of Energy Quest

The Basics

I created this video game after reading ‘Tricks of the Windows Game Programming Gurus’. I take credit for almost all 7000 lines of code written in the creation of Energy Quest. I only reused the Windows communication and message handler code from the book.

I designed a 2D isometric engine so that my objects would be drawn from back to front. This was so the game could would appear 3D. This means that every object in my game is sorted and outputted back to front in order to give the illusion of 3 dimensions.

The Physics

I created a universe of a specific size for my game and then gave each object an x,y coordinate in that universe. While processing the objects in the game, I used their universal coordinate and their relative position to the middle of the screen in order to draw them in the correct position. This use of relative velocities lets the moving objects in the game look realistic. Each object keeps track of its own absolute position and velocity in comparison to the universe.

The Artificial Intelligence

Red Monsters

States: Wandering, Tracking, Attacking, Dying

Wandering: When in a passive state, the red monsters will randomly choose whether they would like to stand still or walk in a certain direction for a random amount of time.

Tracking: The red monsters will track towards the player when in an aggressive state. This aggressive state could occur because the monster’s friend yelled for help, the monster was attacked personally, or the player came within the monster’s agro radius. If a monster collides with another monster while tracking, the one who is furthest away from the player will stop until it is free to move again.

There are 8 different positions around the player which I call ‘holes’. These holes are filled by monsters so that they can surround the player quickly, and they look very intelligent doing it also. When monsters get close to the player, they will choose the closest hole to their current position.

Attacking: The red monsters attack when they are within melee range of the player.

Dying: When a monster runs out of health, he will go into a dying state and perform his last few animations (these animations being death animations of course).

Mechs

States: Searching, Attacking, Searching for a Recharge Station, Recharging, Waiting for a Recharge Station, Dying

Searching: Like the red monsters, the mechs will choose whether they would like to stand still or move for a random amount of time. While in a searching state, the mechs learn where energy stations are located if they come close enough to see them. If a mech sees an energy station, he will check to see if he already has it in his memory, and if not, he will record this new station’s coordinates. Also, if the mech has lost any life or ammo and is in searching mode, he will head for the nearest energy station to fill up completely.

Attacking: Mechs fire a green plasma weapon from a varied range. If they are out of range, they will move closer to you, and if you run at them, they will back away. Mechs will attack until they are out of ammo, or low on life. They won’t always run when low on life. There is a random threshold chosen for each mech. It is at this low life threshold that a mech will try to flee to the nearest energy station.

Searching for a Recharge Station: While searching for a recharge station, the mech will check to see where the closest station is in his memory, then run to it. If the station is not already being used, the mech will stand on the station and wait to be recharged.

Recharging: If a station is not owned by the enemy, meaning it is blue or yellow, then the mech will stand on it until it changes to red. After the mech owns the station, he will fill up on health and ammo completely. It is at this time that he will leave the station and switch back into the searching state.

Waiting for Recharge Station: If a mech wants to recharge at a station already in use by another mech, then he will have to wait his turn. After the friendly mech is finished recharging, he signals that he is finished with the station and another mech can hop on.

Dying: If a mech runs out of life, the death animation and state will ensue.

Compatibility

Unfortunately this game is not compatible with Windows 7 at the moment. It can however be played on a Windows XP system that has DirectX 6 installed.

Download

Click on the above link in order to download Energy Quest.  To install simply unzip the folder and then double click on the ‘Energy Quest’ executable.

How to play

The goal of Energy Quest is to take over energy stations. Once you have taken over all energy stations on a given level, that level will be complete. Energy stations come in three different colours: blue, yellow and red. A blue station belongs to you, a yellow station is neutral, and a red station belongs to the enemy.

Stand on energy stations in order to make them your own. When an energy station is blue, you will be able to regenerate health and ammo while standing on it. You will notice a mini-map on the top left of the screen. Once you have changed all of the energy stations in a level to blue, the level will be complete.

You are equipped with a plasma weapon so that you can combat the monsters in the game effectively. LEFT-CTRL will fire your weapon and the 4 arrow keys will move your character around the map.

To handle the mobs of enemies that will sometimes amass, you have been equipped with mines that you may use at your discretion. In order to deploy a mine, press down the SPACEBAR. If you want to pick up a mine that you have placed, press the LEFT-SHIFT key. Walk over mines that enemies drop in order to add them to your inventory.

You can sprint with LEFT-ALT so that you can outrun your enemies in sticky situations. There is an endurance meter at the top right that will recharge when you are not sprinting.

In this version of Energy Quest you cannot die even though your health is shown at the bottom left. This means you are free to experiment with the monsters’ AI without fear of dying.