Halo: Flooded

 
 

Halo: Flooded is a game I made in my favorite class so far, Structure of Game Design (SGD). SGD is first of 3 main "project" classes in Full Sail’s Game Development program. We were tasked to create an entire playable 2D game in one month. This was also an individual project, and I had the freedom of developing whatever game I wanted to make. A few of the requirements were:

  • A very basic, 3 page design document of the features within the game
  • Being able to shoot a projectile at enemies with real-time collisions
  • Fullscreen or Windowed mode
  • Savable options within an options menu
  • Savable high score table
  • Working event and message systems
  • Switching between game states including in-game pause menu
  • Cheat codes!

Optional Features

We had a list of optional features we were able to add to our game. Each feature had a point value and our game had to contain at least 20 points of these features to obtain full credit. I ended up with 53 feature points, a few of them are highlighted below:

  • Stacked State System – 4 points
  • Particle effects – 3 points
  • Physics based movement – 2 points
  • Anchor/Pivot point animations – 3 points
  • XML scripts for loading data (other than options or high score) – 4 points

The Idea

Ever since I started Full Sail I knew a project I wanted to work on would be an action based platformer/shooter. I played around with the idea a bit throughout earlier classes, and when I started in SGD, I knew that’s the type of game I wanted to work on. I wanted to create my own characters and storyline, but doing that would require much more time, and art assets would be an issue. I started on a search for sprites to use in my game, and I stumbled upon an awesome sprite sheet of Master Chief from the Halo universe. The sprite sheet was made by a guy named Innerrayg, and I thank him because I was able to piece together great animations, and it served as a direction for my game.

The only thing left to do was determine the gameplay. That became an easy decision, because around that time I was playing the Nazi Zombie mod for Call of Duty: World at War. With their round and point based progression, they were able to achieve very replayable gameplay, that was still simple enough for this type of project.

So my challenge was to create an action platformer based in the Halo universe, on a single map with gameplay similar to the Nazi Zombie mod.

The Barriers

After developing the basic player movement, collisions, and physics, I knew I had to start building an area to do my testing. I knew I needed a quick way to make changes to the one map I was making, but it would have been a pain to have to develop a full editor for that purpose. I wouldn’t have had enough time. I tried finding an editor that I would be able to use, just a generic 2d level editor.

GLEED2D came to the rescue. It actually stands for Generic LEvel EDitor 2D. I was able to define objects on a canvas, that had a few default values, like position, scale, rotation. Easily, the most helpful part of this editor, is the ability to create your own custom properties for each object. I was able to give certain objects collision properties, spawn timers, and ammo counts. I even made objects that were used for spatial partitioning, greatly enhancing the speed of my game.

The only other major obstacle I knew I would face was pathfinding for the enemies. I planned on having different rooms, some of them being very vertical. The enemies had to be able to chase the player wherever they choose to go in order to keep the Nazi Zombie-like gameplay.

I ended up placing about 100 path nodes throughout my level, each one with unique connections to other nodes. Whenever an enemy does not have a path, he goes to the nearest node, finds the path to the player, and along the path, he is given instructions to perform certain actions like jumping or landing. With the custom properties that I could write in GLEED2D, I was able to create reliable pathing for an entire level after the engine for parsing it was done (that was the hard part).

I Present to you, Halo: Flooded

Click here for a larger screenshot.

Download

I haven’t been able to work on this at all since SGD, so this is the copy of the game I recieved my grade on. It should be very stable, and I’m sure you will enjoy it.

Download Halo: Flooded

Note: Alt-Enter will switch between windowed and fullscreen.

The Playmine

 
 

Last weekend I was able to participate in a programming event at Full Sail. It was called The Play Mine. Up to 24 people could participate in a 24 hour programming event that went from noon on Saturday, July 18th to noon on Sunday, July 19th. We had to all work together to see how much of a game we could put together in that time. I signed up earlier in the week and to my surprise my name was on the list to participate. I didn’t think I was going to be able to do too much, mainly because everyone else there was ahead of my in terms of classes. I decided to still show up and give it my best.

Saturday at Noon

Only 19 out of the 20 decided to stay and participate throughout the entire event. We were given the task of making a game that would also be playable as a board game. We were armed with our Visual Studio IDE’s, our knowledge of C++, and the DirectX SDK. After brainstorming for an hour or two we came up with a semi-concrete game idea. The next 22 hours were going to be divided up into 4 iterations. We split ourselves into teams and each team had their own goal to reach by the end of the iteration.

The First Iteration

The team I was on was responsible for the tile/map system. We had to have a working tile engine for us to make maps in a few hours. After we got all the coding done, as well as fog of war rendering on top of our tiles, we were still at a loss. We had to have some way to generate maps to use with our tile engine. I had the idea of using Mappy, which is a free, open source tile-based map editor. We all decided this would be fine because we were aiming for creating the game as fast as possible. It wouldn’t have been worth it to be working on a map editor.

Sunday…. Noon…. A Game Called Yella

After 2 cases of Monster, and a quick debugging session that was cut down to less than an hour, we were finally at the end of the 24 hours. Our final product…. a game called Yella.

Screenshots

Download

Check out http://theplaymine.com/?page_id=11 for a download of Yella if you dare.

Ice Cavern using the UT3 Editor

 
 

Unreal Tournament 3 Editor

During my 3D Content Creation class we were tasked with creating a map with the Unreal Editor for Unreal Tournament 3. Fortunately, I have had previous experience making levels for Unreal Tournament ‘99, and Unreal Tournament 2004. I have always loved creating maps with tools like this, as well as StarEdit for Starcraft, and Valve’s Hammer Editor.

I spent quite a bit of time looking through all the meshes and materials that were available to me. The amount of resources available along with the editor is amazing. I found great cave resources, as well as a bunch of ice materials.

The Ice Cavern

Yeah, I decided to make an Ice Cave. To learn more about the gametypes within Unreal Tournament 3, I decided to make it a Capture the Flag map. The only problem I came across was collisions. Many of the meshes I used didn’t have good collision bounds when it comes to walking across them, or jumping over them. As a substitute for a few of these special cases, I turned off collisions for the object entirely, and I created my own custom collision bounds. It worked very well, but I didn’t have enough time to make it perfect. That was acceptable for the class, mainly because we only had a few days to learn the editor and get a decent map submitted.

Screenshots

Download

Check out my map and leave me comments!
Ice Cavern

Where’s Megaman?

Megaman? Where did that come from? Another assignment we had to complete in our 3D content creation class was creating a character, Megaman, in Maya. I was planning on using the pivot structure I used in Megaman to make it look like he was running, and then importing him into the Unreal Editor. After that I would have put him in a static mesh of a crystal or something, just so he could make a cameo in my level :)

Who knows, I might have time to go back and add this in for fun.

Super Smash Bros. Pong using Win32 and GDI

 
 

Back to the website… Yeah I’ve been working on a pretty big side project. For my Windows Programming class, I had to write a game of Pong, using Win32 and C++. I could not use MFC, DirectX, or any other API besides the Win32 API. The requirements weren’t too difficult, but I wouldn’t want to stop there. I decided to make something much bigger.

Super Smash Brothers Pong

I wanted to have a pong game based on Super Smash Brothers. Mario and a few other Nintendo characters will be playable. There would be a game of pong going on, and while that game was played, the chosen character would have attacks available to send fireballs or boomerangs across the screen that the opponent would also have to block. If the ball or any projectiles hit the opponent’s side of the game, they would lose health. Sounds like a simple concept, but it ended up being much larger than I expected. Plus it doesn’t help that I started on it with under a week before it is due.

Single Player

I was able to implement a single player mode with 10 stages. The difficulty increases through the 10 stages and you are able to fight all 6 characters I implemented. When you begin this single player mode you choose a single character to use and you are able to save your progress through the stages.

Multiplayer

There is a multiplayer mode so 2 people can face each other in Super Smash Brothers Pong. After each player picks one of the six characters they proceed to a stage select screen where they are able to pick from 7 different stages to play their game of pong. Each stage has a different background and paddle to add a little variety to the game.

Character Attacks and Gameplay

Mario
Quick Attack: Fireball
Mid Attack: Mushroom (large paddle)
Power Attack: Star Power
Luigi
Quick Attack: Fireball
Mid Attack: Vacuum Ball
Power Attack: Head Dive
Link
Quick Attack: Boomerang
Mid Attack: Hookshot
Power Attack: Song of Storms
Samus (unfinished) Fox (unfinished) Yoshi (unfinished)

Each player’s attack bar will constantly fill during the game. They can perform a quick attack when the bar is 1/4th full. They can perform a mid attack when it is 1/2 full. A Power Attack is performed when the bar is at full power. The first player to run out of life loses. The end result turns out to be a pretty fun game to play, and it is a great spin on Pong.

What’s Left?

Well I still have quite a bit to do to make this a polished game. I need to finish the attacks for 3 of my 6 characters. I need to add sound to make the game more interesting. Maybe learning FMOD would be a good idea. My how to play screen is very weak. I also need to fix a few bugs that can sometimes ruin gameplay. If you take a look at my code right now, it is a mess. My entire project was created using "just in time" programming.

For setting this up in under a week during classes, and using Win32, I think it was a great project. I learned quite a bit about multithreading and a very effective way at handling collisions, which I will post about.

Download the work in progress game: SSBPong.zip

Boggle – Using Hash Tables

 
 

One of my projects I had to do for my data structures class was a Boggle game in C++. It presented a very neat challenge of cataloging the English dictionary into the program. Throughout our data structures class, we found the best way to store the dictionary was through a hash table.

Hash tables are used to store very large amounts of information for fast searching, inserting, and removing. A hash table is compromised of an array of buckets. Each bucket is used to store a select set of information, usually within a singly linked list. You will want to write your hash table to work along with a singly linked list. In the case of the buckets being a singly linked list, you would use your array you made, and the [] operator, to access the appropriate singly linked list.

Check out how I constructed my Hash Table…

#include "SLList.h"     //I made my own Singly Linked List, check out my download to see more of this

template <typename Type = int>     //The class must be templated to create a proper SLL
class HTable
{
public:
HTable (unsigned int numOfBuckets, unsigned int (*hFunction) (const Type &v));
virtual ~HTable ();
void insert (const Type &v);
bool findAndRemove (const Type &v);
void clear ();
int find (const Type &v);
int numEmpty();     //I only made these next 4 functions to show stats on my Dictionary Stats page
unsigned int getNumBuckets();
unsigned int largestBucket();
unsigned int smallestBucket();


private:
SLList<Type>* arr;     //This is going to be dynamic memory so its going to be pointer
unsigned int (*hFunc) (const Type &v);     //This will store my hash function, I'll get into that soon
unsigned int numBuckets;

};

template <typename Type>
HTable<Type>::HTable(unsigned int numOfBuckets, unsigned int (*hFunction) (const Type &v))
{
arr = new SLList<Type>[numOfBuckets];     //Dynamic memory (our buckets), now we can use arr[ANUMBER] to access our SLL lists
hFunc = hFunction;
numBuckets = numOfBuckets;

}

After constructing a hash table I have all the buckets I need, and I can call my saved hash function to find out where any data sent into find, insert, and remove, would be.

Hash functions are written to find which bucket a specific item should be in. They need to be written in accordance to what type of information you will be storing. That is why you pass in the hash function that you will write alongside your program, rather than writing it within your Hash Table data structure.

Lets see how I need to write my hash function in this situation. I could have stored the entire dictionary within a 26 bucket hash table, with a bucket for each letter of the alphabet. Then if I needed to find if a word the user typed was real, I would grab the first letter of the input, head to the appropriate bucket, and see if it was there. Unfortunately a hash table like I just described would be very slow. There would be thousands of words in some buckets. It would take quite a bit of time to iterate through all of these words.

I needed to write something more efficient as one of my goals for the project. My hash function was completed after quite a bit of trial and error. Once I knew what had to be done it was all about finding which numbers would work out the best. In the end, this is what my hash function looked like…

unsigned int wordHash (const Type &word)
{
unsigned int bucket = 0;
short length = word.size();
for(int i = 0; i < length - 2; i++)
{
bucket += word[i] * word[i+2] + word[i+1];
}
return bucket % 16691;

}

I wanted to generate a large number based on nearly every character in the word in order to make it very unique. I did not want to spend too much time looping through the words so I decided to loop through the length minus 2. I made 16691 buckets to store this information. I chose this number for two reasons:

  • It is a prime number, meaning I can perform a modulus to it and get a number between 0 and 16690
  • It is a good number to evenly distribute 110307 words, leaving about 6 words per bucket on average
  • These are the results…

    I was amazed at how powerful that formula was! Out of 16691 buckets only 30 of them were empty and the largest bucket only held 18. Now my Boggle game can search the dictionary very quickly. It would only take a call to the hash function and iterating through a maximum of 18 words rather than searching through 110307 words.

    The rest of the game consisted of programming the grid and scoring. If you need the source or you need help with programming our own version of Boggle feel free to contact me at mikesprogramming@gmail.com

    Here is a link to the zipped up executable: Boggle.zip

    The Syndicate

     
     

    Last month I had one of my few general education classes, Psychology. It was an okay class overall, I found the content pretty interesting. We were put into groups in order to create a story and a few characters. We would be responsible for creating the psychological interactions between these characters. We were allowed to compile the final project in any medium we wanted, whether it be a powerpoint, word document, etc…

    I wanted to spice things up a bit so I decided to create a website. I only had a few days to get it together but I was up for the challenge.

    Check it out at http://mikesprogramming.com/syndicate

    I programmed the site entirely in PHP and hosted it on my home computer for the submission of the project. Our group credits are inside the website.

    Reducing Flicker in Console Applications

     
     
    Everyone who starts C++ has to start somewhere, and that place is nearly always the console window. The console window is a very quick way to jump into programming without having to worry about the overhead of managing the window, loading and displaying graphics, etc…

    Along with the ease of use, the console brings a many limitations to programming real time applications. The most glaring limitation is the way the console redraws itself. Real time applications must clear the screen and redraw every element to produce an updated image. This code will cause some flickering…

    Bad

    while(true)
    {
    Update();

    system("cls"); //Clears the entire screen to show nothing

    DrawElements(); //Draws everything on the console screen

    //I suggest you sleep for 100ms or so here

    }


    That code wouldnt work because there would be a fraction of a second where the screen will be blank and you may even be able to see it drawing, dependent on how the objects on the screen were drawn.

    There is some code in windows.h that can help us.

    Good

    #include <windows.h>

    while(true)
    {
    Update();

    LockWindowUpdate(GetConsoleWindow()); //Locks the console window so the OS doesn\'t draw it

    system("cls"); // Clears the entire screen to show nothing

    DrawElements(); // Draws everything on the console screen

    LockWindowUpdate(NULL); //Removes the lock from the console window

    //I suggest you sleep for 100ms or so here

    }


    This code will effectively stop Windows from redrawing the window in the time we are clearing it and redrawing it.

    Window Locking Functions

    GetConsoleWindow() – Returns a handle to the current console window

    LockWindowUpdate(HWND) – Takes in a handle to a window to lock, if NULL is passed through it will unlock the window

    Alternatively: UnlockWindowUpdate() can be used like LockWindowUpdate(NULL)

    This piece of code increase the visual appeal of my project, Boggle, quite a bit. Unfortunately I hadn’t learned it earlier and some of my other projects had suffered from this limitation. I will be posting two of my projects soon so you can see what it was like before I used this code, and after I used this code.

    Try it out and leave some comments!