Thursday, May 3, 2012

Math Rules. Also this: *=

Today I feel like writing about game math and stuff.

First, The things people say and have said about Math is a lie. Math rocks super hard. For example, you see that math dude over there with the glasses? Yeah. Underneath all the annoying ticks and unbelievable amounts of dandruff is a Wizard.


Do you want do control fire or lightning?  Do you want to conjure strange beasts from your imagination. Yes? Do Math. I Wish a younger me knew this and believed it.


booyah


Second, I want to talk about this: *= . Yep, that thing.  Don't be seduced by it's charms - the lovely looking asterisk and the striking parallel lines. It's not as awesome as you might think. I've used it and am full of regret.


Here's how I started using *=

I wanted to make a 2D platformer.  I didn't know how to build a game, so I used Game Maker. I found this guy's Script for a Mario. It was pretty good minus most of it. So I ripped apart the code to figure out the magic behind it and make it better. (Aka What happens when I change this number? What happens when I delete this condition? Who really even wants this line? Good times.)

One of the neat-o things was how the dude did friction.

MariosRunJuice *= 0.9f;

So here is *= at work. Sure it looks pretty amazing and kind of does what you want. Say Mario is running at a super fast speed of 10 blocks a second (320 pixels per second?). If you stop pressing the Run-Faster-Now button (great button btw), mario will go 10 blocks, then 9 blocks, then 8.1 blocks, then 7.29 blocks. which continues all the way down to almost 0.

So mario slows down at this sort of natural rate. Yay! You've achieved friction by going *= a percent.

It also has the added benefit of being unsigned. You don't have to worry about accidentally flipping directions, and all that craziness. Also it looks real pretty and elegant and should be asked out on dates.

The problem is that *= sucks. Why? It causes exponential change, which sucks. It's the same reason capitalizing interest sucks for those who took the student loans (me) and totally amazing for the person who handed out the loans (banks and others.) Those numbers go out of control bonkers.


I'm trying to say that it's super hard to control *= and make the motion/controls feel good.  Finding the exact curve you, another designer, or some focus testing wants is stupid hard.  If you want Mario to slow down faster but take longer to stop (Which totally doesn't make sense.) *= can't do it alone. It'd need help from ugly nested ifs or weird threshold stuff. That code just feels gross.

Instead use -=. Yes it takes more over head and more conditions. But those conditions probably involve 0 or 1. And 0 and 1 are some pretty amazing numbers. (Trying pointing to a 0 of something. Totally impossible. Go Brahmagupta! (And Google for helping me find that dude's name!))

Also probably include Time into your physics.Variable frame rates can ruin nice looking physics. Also it's nice to be able to find the position of Mario or a Goomba at a given time with networking or replays or something.

Anyways, going back to Math being absolute magic. I really think graphing calculators and linear algebra are pretty much the same stuff as Mario and Sonic but without all the fancy colors. When Mario jumps and doesn't die horribly, that's probably because your brain just used a bunch of fancy numbers to make you jump at exactly the right time. Which is pretty awesome.


Math rules.

Monday, January 2, 2012

20 Reasons why Super Metroid is the Best Game Ever. #1


Before I go into the number one reason, I wanted to express some gratitude. Writing this Metroid Blog has been a blast. I love Super Metroid and flipping out about it.

So, here's a picture of a Bear riding a T-Rex.


Super Metroid is the greatest game every made. Here's reason number one...



#1 Samus Aran is Super Freaking Awesome

I made another list. Let's go through it with pictures instead of words:



1 - Samus walks around with an armada of weapons



Who whould you would want 174 missiles? Samus. Who really needs to combine beam weapons into something more awesome?  Samus. 

Well does she really need to be able to just jump into enemies and kill them?
Yes. Because it's the screw attack and she's a boss.

2 - Samus does what she wants...
...which happens to be turning into a very small ball.

Traverse small corridors

Avoid attacks

use Bombs and things.

The morphing ball makes no sense and is awesome. Don't you want to fight super huge monster things? Yes, but first you have to crawl through the smallest of spaces.

I always felt like the morphing ball was another snub at Mario. "Oh your guy grows bigger? Well screw that we're going to small town."

Yep. Morphing ball.

3 - Samus gives no shits


So the lava. They make you walk through it to get a missile. That's not hard. You just have to take some damage. That's like a sign saying 'no weaklings allowed.' 

As a player, I'll just press forward on your control and go and grab it.  It's funny to me how I'll panic a little each time.

For the boosting of spikes. Just press back as you hit something and you'll do this boost jump thing. Why give Samus something so obtuse and complicated? Probably to be more awesome. 

4 - Samus goes really really fast


Yep.

5 - Samus gets paid to blow stuff up

Wtf is this thing?


Where did that come from?


How about this?



So yeah. I didn't make those pictures with the intention for this blog to actually have anything to say.  But it did - heck yes!

Super Metroid sets you up to feel like a badass. Those examples above where designed so you go either "I'm awesome." or "OH NO!" *blam blam blam* "I'm awesome."

I got this idea from Sequelitis #2. I'm gonna steal Eograptors ideas more blatantly, and use Megaman: X as an example.

In the Megaman: X intro, you fight Vile. Vile poops on you.


The first time I did that fight - I felt helpless. It felt something like "wtf is this cheap dude. ow ow shit ow frik. ow ow."

Right before you die, Zero shows up, and shoots Vile's arm off. That's the moment you realize Zero is a badass.  But you're supposed to feel that way - You just got messed up badly. When Zero beats up your bully of course it's gonna seem like a badass.

This idea of setting you up to feel awesome. That's the number one reason Super Metroid is the best game ever. It evokes awesome. Here's some more examples:

1 - You fight this sweaty monster thing. It keeps pushing forward and doesn't seem to die. You're probably lose the first time. So the second time you make it eat missiles and die in the lava.


You're gonna feel awesome after beating a dude who just won't die.


2 - In maridia there's this pile of enemies before you get the plasma beam. Sure the fight is easy but you got to shoot it like 20 times. Then you get the plasma beam and one shot 'em - you're gonna think "I'm a boss."




3 - You fight your way through the entire flippin game, beat up the Metroids, take down final boss, only to lose to stupid transformation. But then (!) a Super Metroid swoops in, saves your behind, and gives you the ultimate weapon.

Hyper Beam
You get to crush everything.

Well shoot. That entire closing sequence of the game rocks. You feel powerful and scared at the same time. Then you win and feel so awesome.

So yeah.

Super Metroid makes you feel like a some crazy bounty hunter in space armor with a flipping tank gunarm, who rolls around as a ball, flips off of walls, zooms at ridiculous speed booster speeds, blows up space pirates, and destroys entire planets.