-
thanks for the catch, jasonpeinko
http://lab.generalrelativity.org/foam/circle/
here's a new demo with circles- it was cool to have circles behave like wheels just by tossing them into the engine... left and right arrow keys to spin the wheels.
still no optimizations- it'll still eat your computer alive!
-
M.D.
yeah nice one, now release that source
please
-
Originally Posted by newblack
still no optimizations- it'll still eat your computer alive!
omfg theres smoke coming out the back of my computer...
But seriously - very nice. Why RK4 instead of Verlet? I wish there was a good profiler out there - I'd love to know where the AVM2 spends its time and where best to make improvements. Have you tried running the simulation with no graphics?
-
Senior Member
*sniffle* I flung my car out of bounds to it's death. Then I reloaded and it was back. *happy*
Too bad my 'in my head' physics game is probably too weird to work with any existing engines. I am probably not smart enough to make my own either, but who knows, maybe one day.
Gotta to hit my physics books and read up again on angular momentum, vector transformations, and sliding/rolling friction, collision response...
-
Hype over content...
Another great bit of work. It seems nothing very cool gets posted here for ages, and then we get a few in one big sweet go.
As to the profiler rje, I've heard lots of good things about the one with Flex3, but I've not tried it yet as Flex3 projects aren't backwards compatible with Flex2, it's still in beta ( Which times out ) and life's too busy atm to make even more work for myself.
Squize.
-
Script kiddie
Still not detecting my player...
-
hummm.. nice one
I agree looks very stable and it runs smooth and fast in my laptop.
If you can make this sophisticated engine, and if you want to make rope and spring, I think a 2D liquid and rag doll (interconnected objects) is not far ahead. do you ever think of improving your engine to an extent where it can handle even an arbitrary collision like
and could you make a level designer for you engine, it would give us LOTS of fun.
nonetheless, very good job!
-
Senior Member
These are very impressive demos, very cool to see this in actionscript.
As you might know, I also love physics, and I've been working on a rigid body solver myself... (see blog in my sig)
If you don't mind, I have some technical questions
I've seen you use an rk4 integrator, but how do you solve collisions? constraint/impulse/penalty based?
What's your friction model like?
Thanks for the great post
Always nice to see some new and innovative things here once in a while
- Oz
-
Zombie Coder
Geez, you make a few sponsored games, get some favourable reviews, and start to think you're actually not a bad programmer, then something like this comes along and you realise "Nope. Still crap"
-
thanks again everyone- here's a high-level roadmap for those interested:
1. adding a few more geometrical features first: cubic and quadratic bezier curves, capsules and lozenges.
2. implementing a coarse and fine collision detection scheme (instead of blind, brute force)- spatially with quadtrees/simple grids and geometrically with bounding areas.
3. component objects- this will lead to contextual coarse collision detection via bounding volume hierarchies.
4. attempting to implement a global contact solution...
5. contingent on 4, improve friction
6. release a quiet beta
@ozmic66/rje --> integration:
ok, first the easy answer to why rk4 instead of verlet/euler- it's sturdier and more accurate. but a huge goal of mine was to make solvers completely swappable. it allows you to use different solvers where you deem fit. for instance, in the case of constraints, a much more accurate result is obtained from RK4- but something less "volatile" might only deserve Euler....
ok, the harder question- forces/collisions etc.: the difficult part (from an implementation standpoint) of using a great numerical integrator like rk4 is that to be worthwhile, all forces have to be accumulated from within the step. it's unrealistic/painstaking to even imagine finding/resolving collisions also- it would run even worse than it does!
so i allow collisions (which are handled via impulses) to get integrated a few times each step- semi-pseudo code of it looks like this:
Code:
var i:int = Engine.SOLVER_ITERATIONS;
while( --i )
{
for each( var solver:ISolver in solvers )
{
solver.step( dt / Engine.SOLVER_ITERATIONS );
}
resolveCollisions();
}
contact friction also gets applied via impulse in the collision solver. there's a TON i want to do to improve friction but for now it's just applying an impulse that's opposite the relative tangential (to the collision normal) velocity at the contact point scaled by the colliding objects' coefficient of friction.
@ArielGenesis-->
i think that there's no decent way of generalizing a collision scenario like the one in your image. objects that complex would just need to get abstracted anyway.
@VENGEANCE MX-->
what browser/player no. are you using?
@EvilKris-->
lol. i guarantee it's nothing spectacular compared to a successful, well-written game!
-
M.D.
Originally Posted by newblack
2. implementing a coarse and fine collision detection scheme (instead of blind, brute force)- spatially with quadtrees/simple grids and geometrically with bounding areas.
yes, thats something which lacks in every engine I've seen.
-
I dont really understand what you are doing but that is the best physics engine i ever saw so far... Not only accurate, but also realistic in the terms of mass and gravity and acceleration.
-
Senior Member
fun fun fun
I thought trees are only good for static scenes, otherwise re-building it would kill the benefits.
Last edited by realMakc; 09-03-2007 at 07:57 AM.
-
here're cubic bezier curves implemented- this will be the last update before spatial partitioning gets thrown in (left and right arrow keys to spin the ball):
http://lab.generalrelativity.org/foam/bezier/
i've done a lot of structural reworking and am getting happier with the syntax, so i thought i'd share the implementation for the demo above:
Code:
//creates a new instance of the engine
var foam:Foam = addChild( new Foam() ) as Foam;
//static elements
//walls -- RigidBody( x, y, mass, geometry )
var ceiling:RigidBody = new RigidBody( 400, 0, Number.MAX_VALUE, ShapeUtil.createRectangle( 800, 20 ) );
var floor:RigidBody = new RigidBody( 400, 500, Number.MAX_VALUE, ShapeUtil.createRectangle( 800, 20 ) );
var leftWall:RigidBody = new RigidBody( 0, 250, Number.MAX_VALUE, ShapeUtil.createRectangle( 20, 500 ) );
var rightWall:RigidBody = new RigidBody( 800, 250, Number.MAX_VALUE, ShapeUtil.createRectangle( 20, 500 ) );
//curve -- CubicBezierCurve( x, y, control 1, anchor 1, control2, anchor 2, geometrical resolution );
var curve:CubicBezierCurve = new CubicBezierCurve( 110, 400, new Vector( -100, -200 ), new Vector( -100, 90 ), new Vector( 100, 90 ), new Vector(), 9 );
//incline
var incline:RigidBody = new RigidBody( 670, 470, Number.MAX_VALUE, [ new Vector( -320, 20 ), new Vector( 120, 0 ) ] );
//adds elements to the engine for simulation
foam.addElements( ceiling, floor, leftWall, rightWall, curve, incline );
//dynamic elements
//ball -- Circle( x, y, radius, mass )
var ball:Circle = new Circle( 60, 100, 50, 70 );
//adds a force generator for key-driven angular acceleration of ball
ball.addForceGenerator( new KeyDrivenTorqueGenerator( stage ) );
//adds the ball to the engine for simulation
foam.addElement( ball );
var i:int = -1;
while( ++i < 3 )
{
//add a triangle, square and pentagon to the engine for simulation
foam.addElement( new RigidBody( 600 + 20 * i, 120, 60 + 10 * i, ShapeUtil.createSymmetricPolygon( 3 + i, 35 + 10 * i ) ) );
}
//run the simulation
foam.run();
as you might imagine there's a lot more that can be set/specified but the bare bones stuff does a better job of presenting the syntax i think. a lot of helper classes will be included when i release it to make some of the mundane stuff a bit more bearable...
curious to hear your thoughts- thanks!
Last edited by newblack; 09-08-2007 at 03:31 PM.
-
Senior Member
Originally Posted by newblack
left and right arrow keys to spin the ball
this looks like wheel, not ball. make a car demo?
-
I am very impressed by your engine, and how fast you come out with updates, and how well it runs. Keep up the good work man.
-
Senior Member
In about 1-2 years, when you get kidnapped by some guy with a DarthVader mask, we can save a lot of explanation if you just start explaining how to implement the engine to that person in the DarthVader mask. Carry the engine around in a flash drive actually, it will save everyone involved some cab faire, and you would not BELIEVE how hard it is for someone in a DarthVader mask and with a hostage to hail a cab! Not that I would know.
This DarthVader masked person will let you go once they figure out how to use the engine, so no worries.
-
@realMakc
balls spin too! i'll have a new demo before too long
@jasonpeinko
thanks!
@Alluvian
i'm afraid i have no idea what you're talking about!!! must i be kidnapped?
-
Senior Member
balls spin in 2 planes. wheels - in 1
-
Senior Member
check out this quad tree thingy; author says he'll be testing grid version soon.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|