Skip to main content

giving something back, physics for games

  • Still a bit to go but finishing up the chico of the dead game, about a week left? event spent some time improving the quality of the first part of the game experence (added help)

  • well, took 5 hours to write my own morph plugin for max, but then took 2 days to change the pipeline, engine and animation for stream based morphing.
    and so the first thing to make was a shalug, half shark, half slug. what else is morphing…

  • First pass of the assets is almost done (evironemnt, some props, 3 player models and 5 zombies are done. one zombie and 3 small creatures left)
    Code is also getting done, minus the occasional task from hell such as 'rewrite collision system…

  • Started to implement game flow over the place holder assets, so have seen ingame cinematics and the simple scripting sequence work.
    Today finished one of the three player models, added frustum culling and linked up the missing bits for game…

  • Day 15 game dev, the zombie can now fight back which makes thing seem a bit more fair, also made it a lot tougher to kill the zombies.
    Title screen and starting a new game are done. now to make place holder art for the rest of the game.

  • Still working on iPhone, now have opengles2 support for my pipeline (shaders)
    finished up the goldfish project, and having a break from the cute stuff to do something violent, like shoot zombies.
    zombie is a performance test, though still…

  • Took a break from programming to do some artwork, and kind of happy with the result of an afternoon mucking about with normal maps. possibly should learn mudbox or zbrush, but found a workflow that suits me, even if i get to swear about polygon…

  • well, that is a way to spend my time.
    had another go at asset pipeline, using what i had learnt over the last few months and getting the information to the engine for the shaders, as well as preserving non shader rendering.

    excitement…

  • well, it is not so much that it is finished, it is more that i'm moving on and not working on it further.

    Nice to wrap something up, annoying the difference in quality of what you want to get done and what you can realistically get done.…

  • That took a bit longer than expected, but now have my own 3dstudio max exporter supporting biped, physique, scene graph, materials and animation. Also happen to have a win32/ iphone game engine that supports skinning.
    (morphing is mostly done…

Submitted by davidcoen on

harro, thanks to the people who have helped/ commented on my post, though i might try to give something back. (ie, finished another step of my physics engine)

setup. have object in game world, and want it to move/ collided/ have forces act on it/ momentum

a potential solution. reduce each object to a 'force diagram' at the begining of each frame (quantify all the forces on the object) and resolve this in the world. (so, i have this force from gravity, this from velocity, now subtract the static coeeficent of resting on an object, if force still left then kinect coefficent and or whatever...)

the math.
SumForce = (velocity(old) * mass ) / time
SumForce += (acceleration forces in world(gravity & whatever)) * mass
SumForce -= restitance force if im resting on another object

Displacement = ((SumForce * time * time) + ( velocity(old) * time )) * 0.5
Velocity = (SumForce * time) / mass

_note. displacement is the average of old and new sumforce * t^2, I just think of it in terms of velocity, as i use it in collision....

perhaps this could be of sue to someone, derived from
F = ma and
x - x0 = vt + 0.5at^2

Submitted by CombatWombat on Wed, 10/12/03 - 8:58 PMPermalink

Hi David, yeah I've been playing around with similar stuff, and I'm doing something similar - although I'm breaking it into two parts - statics and dynamics. Statics being momentum transfer/conservation of momentum, and Dynamics being this force resolution you're talking about. You'd probably also extend this to building up a graph of objects that are touching, and chain the momentum transfer/conservation of energy calculations.

For example, if A is pushing on B and B is resting up against C, you need to resolve the momentum transfer as a chain to get everything moving with the appropriate velocities.

It looks like you're attempting to handle both the Statics and Dynamics in one, which is probably going to be really tricky. The momentum (ie velocity(old)*mass bit above) isn't a force, and including it will essentially mean that the faster an object is travelling the faster it will accelerate.

You probably want to divide SumForce through by the mass (a = F/m) - unless you're assuming everything is the same mass anyway. And think the last line for Velocity = should be Velocity +=.

I've yet to finish the conservation of momentum/energy part of my system, I may yet collapse the Statics and Dynamics back into one lot of code, but want to get it working separately first (much easier to debug :)

Cheers,

Mark

Submitted by MITA Studios on Thu, 11/12/03 - 7:53 PMPermalink

Hey,

I wrote a simple physics engine about a year ago which handled particles, spring-damper systems, and environments (friction, air resistance etc). One word of warning, at present, you're using Euler integration to calculate your values of Displacement and velocity:

s = u*t + 1/2*a*(t^2)

u = initial velocity, s = distance, a = acceleration, t = time change

This is just one of the equations of motion, but your equation:
x - x0 = vt + 1/2*a*t^2 is an Euler integration, which may cause stability issues later down the line.

When I first wrote my physics engine, I though, yeah yeah, stability crap, it'll be fine, but then when my particles somehow started gaining energy in their spring-damper systems and oscillated to a massive speed, I realised that maybe Euler integration wasn't going to work.

You have a number of options:

Mid-point integration
4th order Runge-Kutta integration
Taylor Series expansion

none of them are particularly exciting, but I'm sure if you search for them, they'll pop up all over the place, and won't be too hard to implement!

cheers

Matt

Submitted by shiva on Thu, 11/12/03 - 9:22 PMPermalink

add verlet integration to that list

Submitted by davidcoen on Fri, 12/12/03 - 10:41 AMPermalink

cool, thanks for the comments, yes, have been needing some massive dampening values on the springs..

Posted by davidcoen on

harro, thanks to the people who have helped/ commented on my post, though i might try to give something back. (ie, finished another step of my physics engine)

setup. have object in game world, and want it to move/ collided/ have forces act on it/ momentum

a potential solution. reduce each object to a 'force diagram' at the begining of each frame (quantify all the forces on the object) and resolve this in the world. (so, i have this force from gravity, this from velocity, now subtract the static coeeficent of resting on an object, if force still left then kinect coefficent and or whatever...)

the math.
SumForce = (velocity(old) * mass ) / time
SumForce += (acceleration forces in world(gravity & whatever)) * mass
SumForce -= restitance force if im resting on another object

Displacement = ((SumForce * time * time) + ( velocity(old) * time )) * 0.5
Velocity = (SumForce * time) / mass

_note. displacement is the average of old and new sumforce * t^2, I just think of it in terms of velocity, as i use it in collision....

perhaps this could be of sue to someone, derived from
F = ma and
x - x0 = vt + 0.5at^2


Submitted by CombatWombat on Wed, 10/12/03 - 8:58 PMPermalink

Hi David, yeah I've been playing around with similar stuff, and I'm doing something similar - although I'm breaking it into two parts - statics and dynamics. Statics being momentum transfer/conservation of momentum, and Dynamics being this force resolution you're talking about. You'd probably also extend this to building up a graph of objects that are touching, and chain the momentum transfer/conservation of energy calculations.

For example, if A is pushing on B and B is resting up against C, you need to resolve the momentum transfer as a chain to get everything moving with the appropriate velocities.

It looks like you're attempting to handle both the Statics and Dynamics in one, which is probably going to be really tricky. The momentum (ie velocity(old)*mass bit above) isn't a force, and including it will essentially mean that the faster an object is travelling the faster it will accelerate.

You probably want to divide SumForce through by the mass (a = F/m) - unless you're assuming everything is the same mass anyway. And think the last line for Velocity = should be Velocity +=.

I've yet to finish the conservation of momentum/energy part of my system, I may yet collapse the Statics and Dynamics back into one lot of code, but want to get it working separately first (much easier to debug :)

Cheers,

Mark

Submitted by MITA Studios on Thu, 11/12/03 - 7:53 PMPermalink

Hey,

I wrote a simple physics engine about a year ago which handled particles, spring-damper systems, and environments (friction, air resistance etc). One word of warning, at present, you're using Euler integration to calculate your values of Displacement and velocity:

s = u*t + 1/2*a*(t^2)

u = initial velocity, s = distance, a = acceleration, t = time change

This is just one of the equations of motion, but your equation:
x - x0 = vt + 1/2*a*t^2 is an Euler integration, which may cause stability issues later down the line.

When I first wrote my physics engine, I though, yeah yeah, stability crap, it'll be fine, but then when my particles somehow started gaining energy in their spring-damper systems and oscillated to a massive speed, I realised that maybe Euler integration wasn't going to work.

You have a number of options:

Mid-point integration
4th order Runge-Kutta integration
Taylor Series expansion

none of them are particularly exciting, but I'm sure if you search for them, they'll pop up all over the place, and won't be too hard to implement!

cheers

Matt

Submitted by shiva on Thu, 11/12/03 - 9:22 PMPermalink

add verlet integration to that list

Submitted by davidcoen on Fri, 12/12/03 - 10:41 AMPermalink

cool, thanks for the comments, yes, have been needing some massive dampening values on the springs..