To give you an ad-free browsing experience, this website is completely funded by donations. If you use the information in this article to solve a problem, entertain yourself, or otherwise improve your life, please consider a small donation to help pay for server costs. Many thanks, and enjoy the site!

Game Code

Basic Game Physics (Velocity and Acceleration)

This site spends a lot of time focusing on the graphical side of game programming, but what about the underlying math that drives game engines?  After an evening of being inspired by the marvelous Havok physics engine, I decided to bust out some old code and use it to demo classical mechanical physics.

A shot of the physics demo in action

A shot of the physics demo in action

The demo has a pretty simple premise – use the arrow keys to fly a spaceship (taken from the classic game Raptor) in all 4 directions and use spacebar to fire two “lasers.”  As always, the included VB6 source code is very carefully organized and commented.

Also, for any VB-haters out there, it’s worth noting that if the demo’s frame rate limitation box is unchecked, the code will easily run 500+ FPS on any modern machine.  Still think VB6 isn’t a viable choice for game programming?

As a bonus, the demo also includes the code for drawing an animated star field.

DOWNLOAD CODE (60 kb)

 

BSD License
All source code in the above zip file has been released under a BSD License.

 

Related articles:

Discussion (Oldest Comments Displayed First)

Be the first to comment on “Basic Game Physics (Velocity and Acceleration)”

Post a comment

Feel free to use any of these tags in your comment: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>