Monday, March 29, 2010

Intercept bullets

Or Predictive fire.

Here is a little story of how my night went.

I really wanna get some Intercept bullets done. Ones that will predict wheer you will be if you carry on with your current heading and velocity. Sounded easy and i need this to add to the arsenal of the Aliens that wanna kill ya.

Woah, writing this was so easy. Just speed of me enemy bullets multiplied by the place where they think the player to be, which is just the time it would take my bullets to travel to him (using current position, no fancy refactoring for this game!). Then multiple the players veloicty by that travel time and add it to his bas position. There ya go. Easy.

In fact i wrote it very quickly, and after it didn't work i realised the age old problem for programmers. If ya don't call the code, it cannot do anything!! haha!

So i fixed it up. and when i did the bullet seemd to predict a distance way too far ahead of where you could possibly be. so after checking my code i decided to play it once more. When i did, i found it to be quite accurate, only. It looked crap!

Yup.... it looked crap. Bullets flying off allover the place, none coming near me as i quickly moved up and down in the same place. BAH! i say!

So what to do? Well i simply dampened down the predictive accuracy. I set it to exactly half and OMGoodness, it actually now works like i really wanted and imaginged in the first place haha.

Here is an excert of my conversation i was having with a friend currently residing in Colorado. Via msn messenger. (yes my text is red in messenger too!)

robert says:

OMGoodness
robert says:
I decided to just halve it's accuracy, so it goes not as far out.
robert says:
and OMG it is freaking awesomeness
robert says:
and truly hard, haha!
robert says:
i loves it!
robert says:
so part design, part coding and part hacking, i actually have what i desired
robert says:
i love writing games!

And here is a look of what it did to my streaming enemy bullets as i wiggle up and down.
There are a couple of bullets from this boss that were fired from a different place and a different method. But mostly this is a really fast stream he fires at me in the middle of his attack sequence.

So the moral of the story is... "You can get what ya want, but not always the way ya expect to get it!"

G'night

No comments:

Post a Comment