GyroVorbis wrote:If he's entering that into a competition, that might be illegal to use outright. I recommend having a look at that stuff to learn the math and theory behind it, because you'll probably have to write your own code.
edit: Do you have any sort of rotational system implemented? Are you calculating moment of inertia and center of mass for complicated shapes then using a pixel perfect collision system? I'm just curious as to what you're doing. For most every 2D application bounding a circle or something would be fine, but I guess if you're going 3D...
Yeah, I've got rotation. I'm not actually writing a game, but rather a physics engine; I'm more of a "I make your game work" kind of guy. Currently, I've got a hierarchy like the following (though I've recently discovered it'll work upteen times faster if I completely redo it, so this has already changed considerably):
Coordinate
Sprite public Coordinate
Object public Coordinate
Facing public Object
Particle public Object, Sprite
Character/Weapons/Everything else public Facing, Sprite
I should mention I also have a (mathematical) Vector class that isn't part of the above hierarchy, and that this is a top-down physics engine (IE, gravity is perpendicular to the screen).
The Coordinate is what it sounds like; it's an x and y point. Currently you can only apply a vector to it, but I'm concepting more functions I've yet to implement.
The Sprite is a sprite handler that contains all the functions to draw objects to the screen and the functions for pixel-perfect collision (with underlying bounding boxes for speed).
The Object is a Coordinate point with mass, a velocity vector, and two friction constant values (kinetic and dynamic). Friction is handled in this engine in a very basic way: to determine the friction between the world and an object, the engine multiplies the object's appropriate constant with a friction constant defined by what the object is "standing" on. My engine relies on the Impulse-Momentum theorem to bypass acceleration entirely and to allow me to change an object's velocity directly using forces and time intervals; this sped up the engine considerably from when I had both Velocity and Acceleration vectors for each Object.
A Particle is an Object you can create and draw on the screen (Coordinates, Objects, and Facings are all abstract). They follow the laws of particle dynamics.
The Facing class is the one I'm currently revising the most, so practically all of this will change very soon. A Facing is essentially an Object with a direction, rotational velocity, and moment of inertia. Currently, my engine assumes all Facings to be spheres (again, I'm revising Facing the most), and therefore calculate the Moment of Inertia by using Facing's fourth (unnecessary) data member, its radius. By again using the Impulse-Momentum theory, my engine allows you to apply a torque on an object by giving it a magnitude and a time interval; my first revision to this class will be to combine the Force application function and the Torque application function into a single Force application function, for all forces will apply torques. The engine also takes into account the rotational friction of spinning objects by treating Facings (in this situation only) as though they were circular disks on the ground.
After these classes, everything else in the game is a combination of a Facing and a Sprite (characters, weapons lying on the ground, etc). This technique worked reasonably well for the most basic needs, but now I'm looking for quite a bit more realism. My primary impediment is collision detection that allows for realistic (read: obeys the laws of physics) collision, for I already have every other change written down (not typed) that
assumes the collision works the way it should. The 3D engine will come much, much later; as for now, I'm sticking to 2D. If you'd like me to detail the changes I plan to make, I shall. It'll take me quite a while, however, for I truly, I plan to overhaul the entirety of what I just described (in retrospect, I've conceded it is laughably unrealistic).
Questions/Criticisms/Comments welcome; I hope this explanation was understandable. Remember, I read my Physics textbook in my spare time, so these physics concepts are as easy as breathing for me to comprehend; I may have oversimplified some aspects of the engine unwillingly, for which I apologize. However, I imagine most of you will know how this works.
EDIT 1: By claiming my engine to be "more advanced," I was looking at it from solely a physics standpoint. It's the only aspect of game programming I'm interested in, really (read: I couldn't even imagine coding half the shit your game can do, and I know it).
EDIT 2: I'm in an engineering class with your brother. He led me to this website.