Archive for July, 2005

Zombies and Vampires and Werewolves, oh my!

Tuesday, July 26th, 2005

Having completed the controls and a (rudimentary) system for weapons, in this edition, we’ll talk about monsters, those poor bastards we’re going to shoot. We’ll talk about them hurting the player tomorrow. Today we focus on their movement and senses.Needless to day, not all monsters are created equal. Aliens don’t shuffle around mindlessly moaning “brains… brains…” and werewolves don’t generally carry ray guns that make that *woobawoobawooba* sound when fired.Even so, we can distil what they all have in common to create a generic monster template that can be customized for different types of monsters.

Monster senses are something that though different from ghoul to tentacled polyp, works the same way. The eyesight is a field of view, a cone if you will, expressed in angles. For regular humanoid baddies it will probably 120 degrees. The strength of their eyesight can be expressed as the length of the cone. The longer the cone, the further they can see.

But as monster movie buff everywhere will attest, eyesight is just not good enough. How do you model that vampire that can smell your blood? If we increase its field of view to 360 degrees we’ve practically achieved the same thing. This would cause the vampire to zero in to you location no matter where you are.

This seems ok, but we can do better. Here’s the scenario: You are in a room with a vampire and you’ve been far enough away that it has not noticed you. You try to reach that shotgun in the middle of the room (who keeps shotguns in the middle of rooms anyway? *cough*Doom3*cough*) and get close enough that the vampire can now smell your blood so it starts to slowly advance in your general direction — it doesn’t yet see you, it just know that fresh blood is closeby. Crap, you think to yourself, I can still reach the shotgun before it sees me. However, before you can reach the shotgun, the vampire sees you! This time it comes running at you fangs first! Good thing you reach the shotgun before it get to you and make it eat holy buckshot.

This would be a lot cooler, I think. We can implement this by defining a radius for the sense, and a precision factor. The precision factor is a radius around the player. When the monster uses this sense, it’s not given back an exact position, but one that’s a small circle around the player. The more imprecise the sense, the larger the circle. This way it’s coming toward your general direction and not homing into you like a fat kid at a pastry shop.

Ok, let’s compile a list of things we need to keep track of for our monsters:

  • FOV (field of view)
  • Length of FOV
  • Radius for secondary sense
  • Precision of seconday sense
  • Base movement
  • Running Rate (this is a factor that we multiply the base movement by. It’s adjustable since some things are just faster than others)

Now that we have a rough idea, lets apply it to some critters!

Zombies

  • FOV: 90 (smaller than normal, maybe their missing an eye?)/li>
  • Length of FOV: 70 pixels (we play at 800×600)
  • Radius of secondary sense: 0 (no, they can’t smell your brains)
  • Precision of secondary sense: 0
  • Base movement: 20pixels per second
  • Running rate: 1.5x

Vampires

  • FOV: 120
  • Length of FOV: 100 pixels (better than zombies)
  • Radius of secondary sense: 300
  • Precision of secondary sense: 30 (it’s not perfect)
  • Base movement: 30pixels per second
  • Running rate: 1.5x

Werewolves

  • FOV: 120
  • Length of FOV: 70 pixels (they are colorblind after all)
  • Radius of secondary sense: 500
  • Precision of secondary sense: 10 (beware their nose)
  • Base movement: 30pixels per second
  • Running rate: 2.0x

And there you have it!

I’ll try to have this in by this weekend. Tune in tomorow as we talk about damage models and how both the player and monster can bite it.

Success!

Sunday, July 17th, 2005
I’ve finished the control scheme for Attack of the B-Movie Menace. It took some very careful studying of trigonometry (remember when you said in school that you’d never use it?), but HOT DAMN are they smooth!Moving the character is just an extension of your will! It’s freaking great. He runs, he shoots! It’s perfect.

I’ve halfway implemented the weapons system. The way weapons will work is simple. Each weapon has two attacks, a primary and a secondary. Each attack will use a certain type of bullet which get stored in clips. You can carry a cartain number of clips on you, and when you exhaust one, another is automatically loaded. Careful! Reloading takes a few seconds depending on the weapon (a few seconds may mean the difference between life and death! Muhahahah)

Anyway, I won’t post a picture because there’s nothing visually interesting about this. Once I get the weapons system implemented I might upload the executable so you can play around with it and tell me if you like the controls.

Later!

Overpromise. Underdeliver.

Tuesday, July 12th, 2005
Ok, I’m a day late. I really didn’t have any time on Sunday since I went on a Nature Hike / Safari and didn’t get home until very late.

Anyway, I have a little dude running around onscreen using WASD and he even faces the mouse cursor perfectly.

Sadly, he does not yet fire a weapon, as promised :( . Mostly it is due to the beastly schedule I had this last weekend. Don’t look at me like that! I told you about it already!

Anyway, as I should have more time on my hands, I’m looking forward to this weekend for some great stuff :)

Quick Update #1

Sunday, July 10th, 2005
Just a quick update to say that I’ve setup the framework, I have a sprite loaded and moving on the screen.

My next step tomorrow is to get it rotate with the mouse. That’s going to involve a little bit of math since it requires me to find the dot product between two vectors (an imaginary vertical line going from the player to the top of the screen and one going from the player to the mouse).

My first stab at the rotation algorithm goes a little something like this:

  1. Get the angle between those two vectors
  2. Divide the angle by 24 (there are 24 rotations images for the sprite)
  3. Display the right image in the right place

Simple, huh?

Being that it’s almost 4am, I’m going to leave that for tomorrow (hopefully).

I was out virtually all day today, and tomorrow seems to be more of the same. *sigh* I just want to code :(