Archive for the ‘Programming’ Category

A crash course in pointers

Wednesday, April 27th, 2011

OK, so a crash course on pointers. This will be a long email. But it’s at least a month worth of classes crushed into a couple of pages.

A pointer is a variable literally pointing to an address (any address) in memory.

for instance:

int nVar = 12; //This is a regular variable!
int * pVar = 0; //This is a pointer variable!


WoW Addon: Soda Leveling Stats

Friday, September 18th, 2009

I finally finished my addon. Took me just a little over a week or about 8 solid hours of actual programing. But finally, it’s life at

The idea of the addon is simple; Now that I’m leveling a brand new druid along with my friends, I wanted a simple way to track my progress on each session. We all love playing but we have very limited time. Our biggest time constrain at the moment is my wife, who comes home from work at 9pm and after eating it barely leaves us with 2 hours (till midnight) to play. Two hours a night might seem like a good amount of time for most people, but anyone that knows MMOs and how RPGs generally work, knows that 2 hours is such a small window that progress needs to be made efficiently. (more…)

Making wow addons

Tuesday, September 15th, 2009

My Latest read on writing addons:

I’ve been trying to solve an issue with saving variables between sessions, and after much looking, I came across this particular tutorial. It is very outdated, but the information on it is still very valid. If not accurate, it is still a good reference guide for my first addon.

I will post pics when it’s in a more fitting working condition.

XNA Mouse Input and Handling

Sunday, March 22nd, 2009

This is short tutorial on how I’m handling some of the mouse commands. I’m dumping it here in case some one find it useful:

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Graphics;

static public class InputHandler


Notice the libraries that are included. Only the ones that are strictly necessary. The reason it’s static and public, it’s to allow all other parts of the program access to it. This is handy because it will allow us to control menu selections, and gameplay at the same time without having to initialize the class everywhere. (more…)

Slow progress…

Wednesday, March 11th, 2009

I have been doing a lot of things lately. One of the most interesting was creating a set of screens for game flow:

* Initial Screen
* Options
* Pause
* others

This was done thanks to one of the resources in the XNA (again using code from resources… shame on me). The complexity of it is a bit above my knowledge, so it was a direct copy/paste and I just did some mark up to get it to work with my own code.

I did this because of several reasons. First of all, I really got to clean up the code and outsource everything out of the main class and into a World class. World class controls everything in the game board through function calls on update for each element. The only logic here is on the AI behavior changes (when enemies shoot or dive).

The second reason is because it let me use a Options screen that lets me load and reaload things without having to quit the game. This was when the big eureka moment hit me. After having traced how each screen worked, i noticed that it didnt’ have a way to pass game options from point to point. In other words, any options that I added to the options screen was lost the moment I left the screen.

This posed a problem to my idea of having options for adding enemies and other elements. Of course, this is the whole purpose of the options screen! The solution was rather inspired by my previous work with the Sound class. So I created a public static GameSettings class. Why static? well, the answer is rather simple, it offers me the option to control them and access them from anywhere. When the options are updated in the options screen, they’re read by the World class in the GamplayScreen and taken into account when the game loads.

I like this solutions a lot. I think it’s both elegant and functional. It also led me to create a Level class which can store level options. I can create a array of levels, and then access each level as the game progresses.

I am currently working on a HUD. I just got started on it, so there is no much functionality to it yet. So far I am only drawing a radar and a small marker for where the hero is. I still need to decide how to work the radar in the game. I have 2 options, to display a radius of where things are, or display everything in the playing field. They both have pros and cons. I haven’t decided because I’m still strugling with now I want to make the game work. This is a bad thing at this stage… I really should know where I’m going, but I have become increasingly worried about what it takes to make any type of RTS work (even on the simplest level). I love the idea of the RTS, but it takes more than one person, and I have been doing this all by myself, which makes it extremely difficult.

I think I will be working on a single controlled ship taking a number of enemies very much Galaga style though the AI will be free roaming.

More to work on =)

Finding solutions to problems…

Friday, March 6th, 2009

I have been enjoying my journey through the XNA very much. It all started with a little project to move a sprite around, and now I can control a number of sprites, spawning different behaviors, animations and sounds. It wouldn’t be fair to say that I have done all this entirely on my own. The XNA has a great number of resources that I have tried to take as much advantage of as possible. It is not a bad thing to admit that have copied at lot of source code from the resources when it fits my needs. However, more importantly, I have tried to write my own code as much as possible. I have only copied it when it fits my exact needs, and when I think I can learn more from copying it, than from writing my own.


Working with AI

Wednesday, February 25th, 2009

I have been working on a lot of things. Mostly on learning AI implementation. This week I have been working on learning all the simple AI behaviors (I’m very new to this stuff) and finally got it all working last night. I had been stuck on getting my wondering behavior working. Turns out that while cleaning my code, I had left an old variable laying around. I hate it how this small details give you such headaches.

In the process of learning all this stuff, I have found a new love for AI. The complexities of it and the subtle things that make it great even on the most simple games. The book I’m reading is It’s is certainly a great book though I wish the pseudo code was a bit better as far as what each function needs to pass and return. I guess their idea is to make it as open as possible, the downside is that if you’re learning, you’re left wondering.


The XNA Clock

Thursday, February 19th, 2009

The last few months I have been working on XNA. The great thing about the XNA is that it wraps the DirectX interface in some really accessible functions. The downside is that it becomes slightly less flexible. For instance, there is not a function to draw a single textureless rectangle. This is obviously not the end of the world. The solution is quite simple, you can just use a 1×1 blank .png and size is to the rectangle size needed.

I actually found working with the XNA very comfortable and fun. C# is very easy to pick up if you already know Java and C++. I’ve been working in my own project, and helping others with little things here and there. I created this little splash screen in just 30 mins.

Just a logo with a clock like animation. I’ll put more details on my actual project later on!

Rotating Cube

Monday, June 16th, 2008

I’ve been working on learning some DirectX 9.0 which is a great library to create games! Obviously when you’re learning, it’s not all about making games. You have to start somewhere, but a long the way you get to do some pretty neat things. One of those things was a rotating cube. The code came mostly from the book I’m reading, but I modified it with some pretty simple controls to make it some what fun.

This is by no means a complex project, but it’s fun to play with it because you can add your own graphics and it will move the cube at different speeds or directions.


I got the 36 points!

Friday, April 11th, 2008

Finally finished my assembly language class. This is probably one of the most difficult programming assignments I’ve ever had. The assignment seems simple enough at the begining. The idea is that we get a working program. All functions have already been written for us and compiling and running is successful. However, all the functions are in a library that we do not have access to. Instead, we must rewrite the functions and make sure we do not break the existing program.

It sounds a lot easier that it actually is. The functions involved things that are so simple in C++. For instance, we had to travel arrays, bitmap tables, and a “linked list” assembly style.

In truth it was a very difficult task. Traveling arrays requires knowing the exact size not only of the array but also of the data type as that’s the only way we can figure out how many memory offsets we need to travel. Also for the bitmaps, switching one involves going over multiple segments to get a to the specified bit, and then only turning on or off the specific bit.

It was indeed a difficult program, but I’m finally done with it and I got all 36 points (pending teacher review). That means I can go back to reading my game programming book!