Monday, August 31, 2009

Bump Mapping

Lately I've been looking at bump mapping, a technique which adds actual 3d texture to something. You can see an example I made here:















After playing System Shock 2 and Half Life 2 I'm really inspired to make a 3d game. However, I am terrible at making, animating, and texturing people or creatures. Environments are more towards my strong suit. I'm also trying to wait until I finish my current project.


Edit:
Here's one that looks much better:

Friday, August 7, 2009

Waking up early

For some reason, I have a weird tendency to wake up rather early. Usually 5:00 nowadays, but a year ago it used to be 4:30. I just don't like sleeping in. It seems like a big waste of time to me. I always feel like I have to be getting something accomplished (even if it's something like writing a blog post, or reading a book).
I usually go to bed at about 10:00, so I probably don't get enough sleep, though I usually fall on the couch and don't get up for a while in the middle of the day.

Anyway, I look forward to the pill you can take that will let you stay up 24/7.

Wednesday, August 5, 2009

Twitter?

Today I just got a twitter. I've been hesitant to get one so far, because I haven't really seen much point in it, but I decided I should at least try it out. So far I'm noticing a rather alarming lack of options for customizing the layout. You can only change some of the colors, you can only place your background image in the top left corner, and all kinds of other limitations that just seem lazy on the part of the creators of twitter.
You can check it out at twitter.com/ninjutsu63.

Sunday, August 2, 2009

Enemy AI

I notice that a lot of people seem to have trouble coming up with some good AI for their games. I have trouble with this as well, so I thought I would detail the process I performed when I created an enemy AI for my platform-shooter.
First, I wrote down the basic things I wanted the AI to do. That came up with something like this:

-Patrol an area when idle
-Be able to 'spot' the player, and give chase
-Be able to try and shoot the player is in range
-Be able to jump over and onto obstacles

Listing it out like this provides you with some guidelines, which is much better than simply thrashing out some code without a clear idea of what you want.

The next step is to write out the basic idea of your code. This might be pseudo-code, or just normal code. A simplified version of my code might look like this:

//if we are in idle mode
if state=0 {
//look for the player. if we find him, transition into alert mode
//patrol an area x pixels wide
//if an obstacle is encountered, jump
}
//if we have spotted the player and gone into alert mode
else if state=1 {
//if the player is out of range, go back to idle mode
//go towards the player
//try and shoot the player
//if an obstacle is encountered, jump
}

As you can see, this is very simple, but gives you a good outline of what you are trying to accomplish. From here, you can write your basic code. Chances are, it won't work perfectly the first time you try it out, which is where iteration comes into play. Just test out the AI, and when it does something unrealistic or stupid (like walking into walls, or shooting in the wrong direction), figure out what it should be doing (jumping over the wall, shooting the other way), and fix that in the code.

With enough iteration, you should get a good code that works about how you wanted. You might find it doesn't exactly match up with your original guidelines, but often times it is even better than what you predicted.

Fun fact: At one point in my AI development, that enemies could actually jump onto each other, and would stack themselves up to get at me. It was pretty entertaining to watch.