Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

On physics and Sim crashing... ^^;

Gwydeon Nomad
Registered User
Join date: 1 May 2003
Posts: 480
06-09-2003 02:32
Well I have been asked and so shall I deliver some info on the physics projects I have set for myself (and Baba) and how they have gone. The perpose of this is to both explain some interesting facts about the current physics engine, requests some features and beg for Havock 2.0 ;)

1) Physical Chain: I started this a while ago but only recently did its uniquness spawn the need to play havock (heh) with the physics engine. I started the chain experiments by creating a series of rings, setting them as a chain would be and then turning their physics on from bottom up. The chain would sway, move, etc...

Durring this experiment I disscovered:
A) Chains play heck with the physics fps and Sim resources as a whole. The chain once set in motion beyond the 2nd link or so, would slowly build up resources until everything in the sim would go to slow motion or crash all together. Part of the reason for this is the chain's links have no truely flat surface that they can rest on, thus constantly bumping and jiggling until by time or luck they settle into posstion.
B) Hinges are your best friend when playing with physics. Another version was later created linking every set of two links with a Point-to-point hinge. This not only saved a TON of resources physics engine / sim wise but also alowed for a much more stable chain.

2) Kenetic pendulum: You see these on many office desks. 4 to 6 metal spheres susspended from strings that are attached to a frame. When one is raised and alowed to drop the kenetic force is transfered though the sphers in line until the last is not abel to transfer the engery and is thusly kicked up into the air which then reverses the process.

Durring this experiment we found:
A) Objects of most materials tend to absorb energy rather than transfer it unless very carefuly setup. Our best example was a line of "Metal, Rubber, Rubber, Rubber, Plastic" which alowed the motion to transfer one time.
B) When playing with hinges alignment is very important, so important that even perfect aligment can cause in-explicable errors. When lined up exactly, if any factor is off (spacing between balls, weight, size etc..) they easily slide off one another failing the experiment.
C) Hinges are elastic: When trying to raise the ball, due to the strangness of the 'move' feature of the interface it was hard to raise the sphere only on the hinge. Some times this would work, some times it would not. When you pull an object on a hinge outside its expected movment arch you tend to get a chaoticly moving hinge either in line or outside its defined perameters.



3) Water Clock: The water clock is a japanese bamboo stick set on a pivot point about 1/3 of the way down the shaft with on end hollow to the pivot and the other end weighted so that it will alow the hollow end to fill and then be over balanced and dump its contents into a pool.

Durring this experiment we found that:
A) objects in motion tend to stay in motion... and arnt usualy gona stop ;) Also objects tend to re-initiate each others chaotic movement, this is espeialy true with spehres. This leands to questions as to why the kenetic pendulum experiment was such a failure and will cause it to be re-visitied.
B) Weight of objects is very important and the different materials have widly different weights as well as other specific properties beyond the sound created when contacted (such as rubbers slight bounce).
C) All physics projects CAN be scriptless, not all SHOULD be scriptless. We started the project by filling the tube with balls (creating them with Shift-drag) however this prooved tedius and not fast enough for a water simulation. We created smaller spheres, scripted to die on contact with ground, and setup in a generator. This prooved to be a much better delivery for 'water' and alowed the experiments full success.
D) Object weight Scales based on its size not only its material. Self explanitory here: if you make a metal spehre of x,x,x dimentions and then a plastic one of xx,xx,xx dimentions the plastic might weigh the same or more (do not have exact example on hand).

4) Trap door: Creating a long plank with a counter wight on one end and stopper on the other I tried to create a trap door that would (when steped on by an avatar) drop him into an area below and then reset.

Durring this experiment I found that:
A) Objects when moving very fast due to phycis glitches, lag, sim Physics fps etc.. will pass though just about any sized object if they are spining.
B) The weight of an avatar is hard to measure, (durring this experiment I did a small side experiment to create a scale so I could figure out the exact weight of an avatar. Due to the previously mentioned tendancy for objects in motion to stay in motion it failed. The scale refused to balance even with extended weights, once put into motion by an object being placed in one side it would spin and eventualy putter out in always a Vertical algiment, contrary to its weighting.
C) Weight ratio's scaling effect does not appear to be 'law'. I tried several times to create a counter weight that would alow the door to tip with sufficient speed to drop me down but with enough weight (and thus force) to drive the door back to its original position. This was not accomplished at the time. (This will require more experimenation for final proof).

5) Catapult (My current favorite experiment): The cattapult was built in Trebuche style with a long pool whos business end held a cup and whos oposit end held a LARGE weight. The fulcrum of this was placed as close to teh weight as possible to alow a long arch for the cup. Further experimentation will be moving the fulcrum back alowing possibly more speed to be built up by the counter weight.

Durring this experiment.... :
A) We found that our 'die on contact with ground' spheres cam in handy yet again. I know this isnt a physics note but worth mentioning. It was much easier not having to go clean them up.
B) Objects in motion.... tend to pass right thoughother stationary objects. Many tims durring initial testing (and when re-setting up the Trebuche in a new location) the stopping bar for the arm (stops the motion so the ammunition can begin travel) would get completely ignored by the catapult. The bar would have to be re-created, sometimes multiple times before it would successfuly stop the weapon.
C) Weight is heavy - The catapult started with one 10x10x10 spehre (once working, smaller came first but you get me) which was changed to a cylender and then trippled uppon itself. The perposefor this was to increase the speed at which the fireing arm arched up to its stopping point. The problem was that with this much weigh on one end we had to find new ways to draw it back down into firing possition as edit-rotating was not a good option. This consisted of creating a similar weight with a hole though it which would be palced around the fireing arm (blocks ont eh fireing arm were later needed to keep it from resting on the fulcrum) which would weigh it down due to its distance from the point increasing its weight (like placing a pencil on your finger and having one side further out than the other).
D) Avatars make the best ammo ;)

I know this isnt the most scientific of explanatins of what we have been doing, no numbers, no other info (yet) but I was asked to show our progress.

Some things that would have helped us (and would help to create a better physics engine):

1) Kenetic energy transferance - When an object or avatar strikes a motionless, but physics enabled, object it should move in the oposit direction with the same energy (minus energy absorbed by mass) until natural friction causes it to halt or it transferse the remaining energy to another object the same way.

2) Better object collision detection - Objects at certain speeds (not always fast) or uner certain conditions will pass though objects both physics enabled and non-physics enabled. This causes a lot of problems when trying to uitilize the engine.

3) Air and Water viscocity - With these a lot more opertunities open up. Not only would it stop the tendancy of objects (without propultion) to spin indefinatly (Leonardo Davinchi eat your heart out) but it would alow for things like gliding etc... Water viscocity would also possibly alow such things as boats to be created.

4) Multiple Hinge points - Throughout our experimentation we would try things with and without hinges, not only do hinges work better but they create a LOT less strein on the physics engine and sim as a whole. Chains, chimes, etc etc... many things would beinifit from multiple hinge points, some very simplistic objects are just NOT possilbe without them. This one is very important... I must have multiple hinge points.... ;)

5) The abilty to turn off collision sounds - When trying to join two hinged objects via a sphere enclosed within a hollow sphere the racket created by the repeated bounces was such that my neighbors who are normaly very patient with my insanity to raise their voices about the issue (not that I wasnt anoyed i was just too enthraled with the creations success at the time to notice).

I will come back with more information if this thread prooves popular etc. If you wish any help with any related info that yous see here come by my workshop in Zoe.

Gwydeon
Jericho Powers
Hero Without A Cause
Join date: 31 Dec 1969
Posts: 166
06-09-2003 07:18
About collision sounds, I know you can change the collision sounds with llcollisionsound("soundname";); I might be a little off, but its in the reference. Anyways if you just put "' for the sound name it should suppress.
_____________________
Gibson, thereabouts.
Ope Rand
Alien
Join date: 14 Mar 2003
Posts: 352
06-09-2003 10:09
very cool post Gwyd. let us know what else you find :)
_____________________
-OpeRand
Andrew Linden
Linden staff
Join date: 18 Nov 2002
Posts: 692
06-09-2003 14:38
Wow Gwydeon, that was a lot of meticulous experimentation and write-up. Well done.

I'm one of the developers who works on the physics end of things and may be able to provide some insight about the results of your efforts.

1. Energy is not conserved in Havok 1.x. In fact, some of the logic that determines when objects have settled to a stop need work. I think Havok 2.0 has better settling logic.

2. The collisions of Havok 1.x are pretty good, especially the rigid-body dynamics, however in order to run lots of objects in real-time we are forced to run close to the quantum realm of the physics engine.

I think I posted something about the quantum behavior of SL to a thread a few months ago, but was unable to find it again. But basically the tunneling you noticed in 4.A is a "quantum" effect that happens in real-life at really small space-time scales ==> that is you have to look very closely. As CPU cycles allow games to take smaller time-steps and use more detail in the geometry then these quantum effects will become harder to notice.

3. The amount of CPU cycles required to do proper fluid dynamics for modelling gliders and viscous motion in general is HUGE. You won't be seeing such simulation detail in games for at least another decade or two (but it is fun to think about ;-).

4. Multiply hinged objects can also drag the physics engine to its knees... which is why they are currently disabled. When we port to Havok 2.0 we should revisit this feature to see what can be done.

Finally, if you were to re-run some of the experiments at a larger scale the quantum effects would be less visible. This is because the acceleration of gravity and the "collision tolerance" of the physics engine are constants and increasing the size of the objects involved is sorta equivalent to decreasing the effective time-step while increasing the spatial resolution of the particles involved. As a result the objects will tunnel less, settle more correctly, and maybe even behave more like energy is conserved.

This shows that the Havok 1.x engine could actually do much better if we only had the CPU cycles (read "faster computers";) to throw at the problem. Hence, the main promise of Havok 2.0 is improved performance rather than more correct physics.

Keep up the good work.
Baba Yamamoto
baba@slinked.net
Join date: 26 May 2003
Posts: 1,024
06-10-2003 01:07
Yea that is right! AND BABA! :D
Chip Midnight
ate my baby!
Join date: 1 May 2003
Posts: 10,231
06-10-2003 10:17
Great stuff Gwyd and Baba! Your avatar slinging trebuche is one of the coolest (and funniest) things I've seen in SL. It's a shame that physics causes such a drain on the servers because I would LOVE to see some events like a competition to see who can build the best scriptless avatar flinging machine. Rube Goldberg eat your heart out :)
_____________________

My other hobby:
www.live365.com/stations/chip_midnight
James Miller
Village Idiot
Join date: 9 Jan 2003
Posts: 1,500
06-10-2003 13:21
Give us Havok 2.0! Give it now or we wont go!

:)

(Incase you are wondering what thats all about, I had a protest in Kissling Park a few weeks ago, where about 20 avatars got together with pickets that I made and chanted various slogans. We demanded that Havok 2.0 be implemented before launch. After just a few minutes, we got the attention of many lindens and local news organizations (Ok, maybe just the Lindens), but, we were given bad news, that it was going to be impossible to get it in before launch. Oh well :/ )
Jericho Powers
Hero Without A Cause
Join date: 31 Dec 1969
Posts: 166
06-11-2003 07:14
Ooh, Havok 2.0, I hope we get rag doll effects.
_____________________
Gibson, thereabouts.
Baba Yamamoto
baba@slinked.net
Join date: 26 May 2003
Posts: 1,024
07-03-2003 01:09
From: someone
Originally posted by Jericho Powers
Ooh, Havok 2.0, I hope we get rag doll effects.



I believe avatar flinging is planned... Gwydeon?
Malaer Sunchaser
Lord of the Smurfs
Join date: 1 Apr 2003
Posts: 44
07-03-2003 12:08
yay ragdoll effects!!!
Huns Valen
Don't PM me here.
Join date: 3 May 2003
Posts: 2,749
07-04-2003 03:09
You like ragdoll type stuff? Then you'll LOVE Porrasturvat (Stair Dismount):

http://taat.fi/taat/porrasturvat/

This game was written for a competition. It was developed in a short period of time, so it is not incredibly complex, but it is a lot of fun!
James Miller
Village Idiot
Join date: 9 Jan 2003
Posts: 1,500
07-04-2003 08:50
LOL Huns! I have been playing that game for months! Its so much fun! :D