Categories
Game Development General

XNA Framework API?

The other day I decided to look through some source code of other games, and I downloaded a breakout clone written using the XNA Framework. It provided the source code, and I figured that C# can’t be that different from Java or C++, so it shouldn’t be a problem. At one point I thought that maybe C# allowed you to use two different names for the same function, such as calling Run() vs defining it as BeginRun(), but then I realized that the code I was trying to find was apparently in the XNA Framework.

I almost gave up looking for the XNA Framework API since it seems to be too difficult to find, which means that the game’s source is almost impossible to follow since I can’t find a way to start running the game. Since I do all of my development on GNU/Linux, and Microsoft isn’t porting their software over anytime soon, I am left with the source code that depends on a missing API to understand. I finally found the API in MSDN, but I had to use Google to do so. Why I couldn’t just search for it with MSDN itself I have no idea. I also wish that the documentation was a bit more useful. For instance, here’s the Game method Run():


public void Run ()

That’s it. I don’t even get to see what it is calling or doing. The comment says “Starts the game”, and I have to find a completely different part of the documentation that tells me that it “starts a loop that will call Update and Draw multiple times a second until Exit is called”. So now I know what it calls and what it does, but why couldn’t the function’s page tell me?

Is it secret code or something? I guess I am just used to seeing the code of implementations, such as C++ standard libraries. I mean, I understand that I shouldn’t have to know what the implementation is doing in order to use it, but since it seems so hard to get good documentation on what the API is and how to use it, what else could I do but go to the source?

Maybe it is because I don’t have Game Studio Express or any of the Microsoft XNA-related pieces of software. I believe there are tutorials provided, and I found a few videos that seem to explain how the content-pipeline works, so it is obviously documented somewhere. Maybe search terms like “xna framework api” aren’t the ones to use?

Well, anyway, after a few hours of research, I finally found the info that I needed. Now I can look at the breakout clone’s source code and figure out how it works. At least until I hit another mysterious XNA Framework API call, that is.

By the way, I kept hearing about how great the XNA Content Pipeline is, and I concluded that it simply integrates graphics asset collection into the same program you use to edit code. It’s nice, but I was expecting more from all the noise getting generated about it. Is there something more to it that I didn’t find in my admittedly quick research?

Categories
Game Development

Space Invaders Clone Progress

I woke up late, which pretty much set the tone for the rest of the day. I didn’t spend nearly as much time working on the Space Invaders clone as I would have liked. Still, it was progress.

I ran into two bugs, one for each small update I made. The first bug appeared when I tried to replace one alien with multiple aliens. I basically swapped out a single pointer for a vector of pointers. I actually liked how easy it was to get the aliens to move back and forth since I didn’t even have to change the variable I used.

Unfortunately, my program would seg fault whenever the last alien was shot. It turned out that I was using a for loop when handling collisions, which incremented the iterator each time through. Well, if I erased the object the iterator references, then the new value of the iterator is one after that object. If it happens to equal vector::end(), then the loop should end.

Except that the iterator gets incremented, so now not only does it not equal vector::end(), it doesn’t refer to anything valid! I switched to using a while loop, and I only increment if I am not erasing, and it fixed the problem.

The second bug was simpler but more subtle. Yesterday I decided to add rows of aliens as well as columns. I found that if you shoot the rightmost or leftmost column of aliens, the rest of the aliens would sometimes move all the way over to the right or left, just like they should. The problem was that it didn’t happen consistently. Sometimes they would move that far, while other times they acted like the column of aliens I just shot still existed. What was going on?

After adding debugging statements and checking the position of the aliens, I found out what was happening. The code was actually working correctly. The problem was that I had an extra row of aliens that were too high to be seen on the screen. Doh! Once I moved the aliens down, I could see that they were moving as far left and as far right as they could as a unit.

I want people to pick up this game and think that it is as finished as any regular game they played. I know I will need a menu and an interface to continue or select levels, but I want to see what else I will need. I am basically looking through source code from various games, and I will document my adventures reading through source in a later post.

Categories
Game Development Personal Development

Thousander Club Update: December 18th

For this week’s Thousander Club update:

Game Hours: 241.25 / 1000
Game Ideas: 616 / 1000

Target: 987

Only two more weeks!

So I found that I could still come up with 100 ideas, which was surprisingly difficult and easy, depending on the hour. I managed to get multiple aliens to move about, which involved replacing the single alien sprite with a vector of alien sprites. It was a bit tricky, but it was due to my lack of experience with erasing members from a vector.

To handle the movement of the aliens, I have a section of code that looks like:


static int step = 1;
...
if (alien->X() > 970 || alien->X() < 74)
{
step *= -1;
}

Basically, if the alien goes too far to either side, it reverses direction. I thought I would need to replace this variable with an array of variables, but it worked surprisingly well. The aliens all reverse direction together when the far left or far right aliens exit the range.

I am thinking that the alien sprite is too large, however. There are only eight aliens across right now, and they move back and forth too quickly. If I add code to allow them to move down after hitting the sides, the player would have almost no time to fight back. I should also find a way to slow them down in general.

The good news is that I am taking the rest of the year off at my day job, which means that I have this week to work on my own game development. Next week I will be celebrating Christmas and getting last minute shopping/gift wrapping/etc done. I will break down my week into certain tasks I would like to accomplish, and I will try to give progress reports each day.

Categories
Games General

Game Tunnel’s 2006 Game of the Year Awards

Did it sneak up on you? It snuck up on me! Game Tunnel’s 2006 Game of the Year awards calendar is up, and two categories have already been published!

The awards have already been distributed for the Best Sports Game and the Best RPG of 2006, and I don’t think who won was a big surprise.

In the coming month, you will see awards for Casual Game, Strategy Game. Sim Game, Action Game, and Quest/Adventure/Platform of the year. There are also dates to recognize outstanding games in Innovation, Multiplayer, and “Special Awards”.

And, of course, the month ends with a listing of the top 10 games of the year, including the winner of 2006’s Game of the Year. There is still time to vote for your favorite game, so do your duty!

Categories
Game Development Personal Development

Thousander Club Update: December 11th

For this week’s Thousander Club update:

Game Hours: 238.25 / 1000
Game Ideas: 507 / 1000

Target: 966

I managed to add the ability to shoot a weapon in my Space Invaders clone. As of now, if the bullet collides with the enemy sprite at the top of the screen, the enemy disappears.

Space Invaders clone

Yes, that orange thing at the bottom is the player’s ship. Hey, it works.

I am giving myself permission to stop every so often and plan my next move. Getting this far was actually simple since I had a fairly good idea what I needed to do. My next moves are not as clear. I think I will work on abstracting the interface. Right now, I have code that looks like “If Space is pressed, then make the bullet move up”. Everything is hard-coded, and I think at the very least the aliens can be made into a more abstract entity. In fact, I should be able to take my one alien and give it some friends. Otherwise, it would be a very boring game.

Also, I am not happy with the speed. It runs very fast, and I think I can experiment some more with the delta code I am using.

I don’t want to try to abstract things too much. I have already been down the road of abstracting too much, which resulted in not getting anything concrete accomplished. I don’t want my code to be completely hard-coded, either. If I keep doing small changes, though, I should be able to mold the project the way I see fit.

Categories
Game Design Game Development

Interesting Game Ideas: The Old Gym

Game Idea:
The Old Gym

Premise
Repair and improve your old high school’s gym on a limited budget.

Huh?
I honestly can’t remember where I thought this idea up, but my old high school recently merged with another one. I was probably thinking about the future, when I would be so wealthy that I could spare quite a bit of it to give back to those things that contributed the most to me. During the last few years, $1 million was raised to replace the gym floor, and I think I remember that there was a problem that required repairs soon afterwards. In grade school, there was also a gym that had sections that were warping, and I don’t know if they have been repaired yet. Maybe it was when I was there fairly recently that I thought about repairing it myself?

Possible Game Here?
Imagine that you had $1 million to repair a school gym, and you have only one summer to work on it. What would you do with the money? Who would you hire to work on it? What kind of features would you want? What materials would you use for the floor, seats, windows, and walls? What kind of sports can you play in it? How much space will you need? Will you need to buy more land for the school to accomodate the luxury locker rooms you plan to install?

I think that you can picture some kind of Tycoon game. You can’t earn revenue from the gym. After all, it is a donation of your money and time. Of course, maybe the initial $1 million might increase based on parents and alumni feeling generous after seeing such great progress? I think the primary goal is to leave your legacy, so your reputation is at stake.

Each day, you would need to monitor the progress of the gym. If you run out of money before completion, the children will have a partially finished gym, and you’ll have a lot of upset people. Your name will always be associated with failure. Similarly, if you run out of time, school will get back in session, and you’ll have to contend with students getting in the way or playing pranks on your workers.

Will you have hardwood, concrete, or tile floors? How many basketball nets will you have? Will the floor slide away to reveal an ice hockey rink underneath? Will you also install astroturf? How about the real stuff? A swimming pool on the roof? Will you put in bleachers, or will fans have to sit in lawn chairs? Will you use state-of-the-art scoreboards and announcer systems, or will scores need to be updated by hand and read through a megaphone?

Will you build quality into the project from the beginning, or will you cut corners? What if you get caught? What if someone gets hurt? What if no one notices?

Perhaps there is a weekly meeting with the school’s board of directors. It can serve as a status report, but you can also use it as an opportunity to request more funding. If you’re charismatic enough, you can get various parts of the overall budget switched to the gym. “Sorry, kids, no band this year.” Will it be easier to request more money if everything is going well? If you do well, does the game end, or can you continue to oversee the gym over the next few years? Will you be asked to tackle tougher assignments? Your city may be tasked with hosting the summer Olympics, and you may be just the person for the job!

Summary:
Rebuilding your high school’s gym may not sound like much fun in real life, but if you had a large budget and a summer, what would you do? It would be interesting to see what people would put into their school gyms.

Categories
General Personal Development

Shut Down Your Lemonade Stand

I came across an interesting quote a few weeks ago: “If you don’t like the world sending you lemons, shut down your lemonade stand!”

If you don’t like your situation, simply get out of it! You don’t like doing homework at the last minute? Do it earlier. You don’t like your abusive relationship? Remove yourself from it. You don’t like how much you weigh? Lose weight. You don’t like your financial situation? Earn more money and/or cut expenses.

Sometimes it seems like things are more complicated than just deciding to change something about your life, but everything you do begins with a thought. Don’t just accept what you don’t want. If you relegate yourself to a life you don’t like, you can’t expect to get anything but lemons. You can be more creative, and you can create a course of action that will take you away from the lemonade stand.

If you are stuck in a routine or have a habit that takes you to that lemonade stand, it can be tough to change. There is a feeling of safety in sticking with the familiar. Just deciding that you need to change is a good first step, though. The next step is to do what you need to do to shut down the lemonade stand. For example, if you want to become healthier and maybe lose some weight, throw out all of the junk food and get yourself a pedometer. If you know that you don’t want to eat food that is bad for you, then there is no reason to keep it in your home. Get rid of it, and you no longer leave the temptation to revert to old habits.

Is there any aspect of your life that you feel stuck in? Identify your lemonade stand, and shut it down.

Categories
Games Marketing/Business Politics/Government

Michigan Ordered to Pay Back Video Game Industry

A Michigan judge ordered the state to pay $182,349 to pay for legal fees the ESA incurred to challenge an unconstitutional law banning the sale or rental of violent video games to minors. Governments now owe or have paid over $1,500,000 in legal fees trying to pass unconstitutional laws, including the more than $500,000 owed by the state of Illinois.

You can read the ESA press release.

In his decision declaring the law unconstitutional, the judge dismissed the state’s claim that the interactive nature of video games makes them less entitled to First Amendment protection. “The interactive, or functional aspect, in video games can be said to enhance the expressive elements even more than other media by drawing the player closer to the characters and becoming more involved in the plot of the game than by simply watching a movie or television show. It would be impossible to separate the functional aspects of a video game from the expressive, inasmuch as they are so closely intertwined and dependent on each other in creating the virtual experience. Not only does the Act not materially advance the state’s stated interest, but it appears to discriminate against a disfavored ‘newcomer’ in the world of entertainment media. Thus, ‘singling out’ the video game industry does not advance the state’s alleged goal.”

Eventually taxpayers have to notice this waste, right? I mean, maybe the first time a government official authorizes an unconstitutional law, he/she made a mistake, but after so many end up failing for the exact same reasons, it has to be obvious that these officials are purposefully wasting our money and our time, right?

Categories
Game Development General Personal Development

Thousander Club Update: December 4th

For this week’s Thousander Club update:

Game Hours: 235 / 1000
Game Ideas: 507 / 1000

Target: 945

I started working on my Space Invaders clone. I first created a mind map, trying to come up with as many ideas as I could regarding the project. I didn’t want to make a standard clone when I could make something a bit different. I gave myself permission to let the ideas flow. In the end, I had a really complex game that only vaguely resembled Space Invaders. It featured multiple planets, multiple weapon types, multiple types of aliens, politics, research and development, and various resources. Even time played a role in this grand game.

Then I remembered that the point of doing this game was that it was simple. So I scaled back to the basic Space Invaders game. I could always add a feature later, but I won’t let myself do so until I actually finish the basic game.

So now that I had a good idea of what game I would make, where did I start? Fred Brooks wrote that representation is the essence of programming, referring to the data structures that you would use to code any software. Someone else once wrote that the user interface IS the game. Put those two together, and I realized that the easiest way to start working on this new project was to start with the interface.

My first running program was just a blank 800×600 window. When you press the left or right arrow keys, text would appear in the console indicating which direction you pressed. When you press space, the console states that you are firing your weapon. It was a simple yet fundamental accomplishment. It showed progress.

Then I added a background graphic, which required initializing the Kyra Sprite Engine. I then made a small alien sprite and displayed it at the top of the screen. Then I made it move back and forth along the top of the screen. Then I made a ship graphic display. Then I made the ship move depending on the arrow keys being pressed.

And just like that, taking small steps, I have the beginnings of a Space Invaders clone. Many months ago, I would probably have tried to do everything at once. For instance, the player’s ship would be an entire class with all sorts of features, like thrusters and a weapon, which would be a different class. I would try writing all of this code at the same time, and debugging would be incredibly hard. This time, I put together one thing, and it worked. Then I did another small thing. Then another. And another. Each step was simple and yet brought me closer to finishing the game.

Currently, if you press the fire button, the text still appears in the console. If you press the arrow keys, no text appears, but the ship moves. This week I will work on getting the weapons systems online, and I will work on this problem in a similar way. Previously I would have tried to get a weapon that shoots bullets that cause damage against aliens that get hit, which involves code for the weapon, the bullet, the interaction between the enemies and the bullets, and explosions. It is just too complex to handle all at once. Now, I know that I will do one thing at a time. Maybe I’ll start by creating a bullet that simply moves. It doesn’t have to do anything other than move. No damage assessment, no launching it from a non-existent weapon. Just movement. I can then worry about creating and destroying bullets. Then I can worry about the bullet-alien contact causing the two things to be destroyed.

And eventually I will have waves of aliens moving back and forth, slowly descending. Eventually I will have multiple levels. A menu system. Possibly some new, unique features?

Conquering complexity. Representation. The interface. Did I really not think about these things before? They seem so obviously useful.

Categories
Game Development Games General

December Chicago Indie Game Developer Club Meeting

If you are in the Chicagoland area or don’t mind taking a nice field trip, come hang out with the Chicago Indie Game Developer Club on Sunday, December 10th! Discuss game development and marketing, provide feedback to games in development, and otherwise be cool, awesome, and amazing. The first five people to arrive will also get to be fantastic.

Where: The Starbucks at
Streets of Woodfield
601 North Martingale Road
Schaumburg IL, 60173

When: Sunday, December 10th, at 7:00 PM