Page List

Tuesday, November 27, 2012

Asteroid Collision Take 2

Ok, implemented a couple of those things I talked about last time. A delay between asteroid launches and a check to make sure I'm not spawning a asteroid right on top of an existing asteroid has greatly improved things.

Not a huge success but still looking better. Still gotta some work on improving asteroid collision though. Still seems to be some trouble with asteroids spawning on each other, might try expanding the collision area I'm checking for existing asteroids to make sure new asteroids have a wider area to take off from. The next step after that is to improve the behavior for asteroids reflecting after a collision.

Tuesday, November 13, 2012

Collision Detection First Attempt

Evening everyone,

Decided to start implementing collision detection. Going to start with handling asteroid on asteroid collision detection. Right now I am starting with some simple rectangular intersection collision detection. Once I have everything working properly I might take sometime to implement a secondary pixel collision detection.

As you can see from the video I have some work to do. First problem seems to be with the fact  that I am now spawning multiple asteroids  Things would probably work better if I checked for an existing asteroid in the area I am spawning a new asteroid. I could also reduce my woes if I added a timer for a cool down between asteroid spawns to keep them all from launching in the space of a millisecond.

On the collisions them self the goal is if two asteroids collide they reflect in two different directions. Right when a proper collision happens (as in not having two asteroids spawned on top of each other) what happens is they both head in the exact opposite direction from their original heading. Fortunately that should be very easy to adjust.

Hopefully next time I post it will be a video of the asteroid-asteroid collision working correctly.

Saturday, October 27, 2012

I'm back at last

Well, after about a year and a half I've finally gotten back to work. Here are the results.

First, I've finally decided on a name for this game. Given that the game is about moving your ship using the recoil from it's gun I've gone with the name 'Newton's Third' after the law of physics that states for every reaction there is an equal and opposite reaction.

Secondly, after getting the player's ship working properly the next logically step is to add the objects that the player will be both dodging and trying to destroy. I have gone ahead and added the necessary classes to add a asteroid object to the game. Asteroids will be generated based on minimum number of on screen asteroid criteria. If a  asteroid leaves the screen or is destroyed by the player a new asteroid will be generated to keep to the minimum number. During asteroid generation the asteroid will be deployed from a random side of the screen and will be given a random heading, heading speed and rotation speed.

At this point only the asteroids only deploy from one area of the screen and only one asteroid is on the screen at one time.

Having only one asteroid launch from a single location is a design choice for this portion of the project to make the next step easier. Now that a second object exists I will have to write code to allow the ship and the asteroid to interact. As you can see from the video the ship (and by extension the ships lasers) and asteroid will merely pass through each other. The next step will be to add code that will detect if the ship (or it's lasers) and the asteroid collides. Once that is in place I can begin programming rules and reactions that will make this project start to look like a real game.

Sunday, April 3, 2011

Mile stone reached, basic player movement finshed

Just a quick update. Managed to implement the flame thrower weapon. Early tests resulted in this.

After a little bit of debugging finally got something that worked properly.

After seeing it in action I don't now whether I fill keep the flame thrower weapon in the end. Seems to me like it has the potential to be a game breaker, I'm hoping the speed will make it difficult to use but I'll have to make some targets first to test it out. Hopefully it can be tweaked into being useful but not too useful. I'm sure once there is something to shoot at I will have to do a lot of minor tweaking to the weapons recoil speeds, firing rates, and damage.

With the flame thrower finished I can now move on to making the environment a little bit more interesting. Hopefully next weekend I can get a couple of asteroids floating around. A the very least I might as well draw a background cause I'm getting tired of corn blue.

Saturday, March 26, 2011

Final stopped being lazy

Good news nobody. I'm done being lazy. Actually, I'm finish an all consuming marathon of reading.

Anyhow, spent an hour coding to get myself back in the grove. Implemented the second weapon for the players space ship. Now the player has the ability to choose between two weapons. The 'blaster' seen in the first video, or a new 'cannon' weapon. As you'll see in the video posted with this entry the cannon fires slower than the blaster, the projectiles also move slower than the blaster, but the players ship moves faster when it is fired. Also once I implement something to fire at, the cannon will do more damage than the blaster as well.

Next step will be to implement the last weapon, which will be a flamethrower like weapon. After that I can start implementing some obstacles and this will finally start looking like a real game.

Sunday, February 27, 2011

Moving and shooting

Ok, things are starting to shape up. I have further refined the movement of my ship. To get the ship to move exactly as I need it to I had to finish up the weapon firing mechanism. This would be done with two classes, a projectile class and a weapon manager class. The importance of the weapon manager class in term of movement is it would track the cool down between weapon bursts. This is importance since the player ship is powered by the recoil of shooting it's weapons. Every time the weapon is fired the ship moves in the opposite direction. I'll let a video of the game in action explain the rest.

You will also notice I have added a window in the upper right hand corner showing which weapon is selected. I have only implemented the blaster. Hopefully by my next update I will have implemented the cannon and flamethrower.

Friday, February 18, 2011

Geometry my old enemy, we meet again!

When we last left off my attempts to get the player ship to move resulted in jerky movements and spiraling off into infinity. Things have gotten slightly better.

Remember how some old games use to have cheat codes that let you unlock debugging mode. When I was younger I was always irradiated that all this did was make a bunch of numbers appear in the corner of the screen. I've learned those numbers are my friends.
A bit of yellow text and suddenly finding out what was going on was much easier. Using break points can be a pain in the ass when certain methods and lines of code get ran 60 times a second. My biggest problem is that I seem to have forgotten everything I know about geometry and trigonometry. I did not help that geo and trig are probably my worst mathematical subjects so I didn't know much to begin with. I need to brush up on somethings.

I checked my bookshelf but unfortunately I sold my geo and trig math books for money that was probably wasted on junk food and other university supplies. I wasn't completely out a luck, my modern philosophy book was of no value to anyone and thus remains in my possession. I since Descartes was the father of analytical geometry his Discourse on Methods might shade some light on my problem. A little reading revealed that by assuming everything I can doubt does not exist and only accepts things I know are absolutely true I should be about to completely rederive all of geometry and trigonometry from innate concepts. 

A half hour and one existential crisis later and I decided to just check Wikipedia. Ultimately my ship is now moving in the proper direction when press the move button.

Probably would demonstrate my progress better if I captured some video, maybe next time

Next step: Smooth out ship movements and handle collisions with screen boarders. Begin writing code to handle ships weapon.