Difference between revisions of "Havok4"
m |
(Added pointer to llPushObject pseudocode page) |
||
Line 118: | Line 118: | ||
http://video.google.com/videoplay?docid=-2779779276874540721 | http://video.google.com/videoplay?docid=-2779779276874540721 | ||
=== Pseudocode for llPushObject (the Havok4 implementation of this function === | |||
[http://wiki.secondlife.com/wiki/LlPushObject/Havok4Implementation Pseudocode for llPushObject] |
Revision as of 17:57, 31 January 2008
Havok4 (New Physics Engine) Beta Test Information Hub
Introduction
The beta testing for the Havok4 implementation in Second Life is now in process. This page provides information on the project, as well as useful information that will help us all to make sure that Havok4 is tested well before it is rolled throughout the main Second Life grid.
Please read the Havok4 Beta1 Release Notes
What Is Havok?
The Second Life virtual world has a lot of moving parts that keep it going. One of these is the Physics Engine. A physics engine is a specialized piece of software that does the "real world" calculations to figure out what do when:
- Something or someone is pushed
- Something or someone collides with something or someone else
- Something or someone is in motion and has momentum
- Friction or damping slows the motion of something or someone
Havok is a commercially produced physics engine, and Second Life was built using Havok1. on which it operated for several years.
How Can I Participate In Havok4 Physics Engine Testing?
You can participate in the Beta Test of Havok4 with a few easy steps:
- Read "What's Changed With Havok4" to understand what should be different, and what should not be different, on the Havok4 Beta Test grid
- Read "New Prim Linkability Rules" to understand how prim linkage works with Havok4 (it's better and should be much more reliable!)
- Login to the Public Issue Tracker at "Issue Tracker" to see how easily you can tell us about problems you find during the beta test
- Download the install the Havok4 Beta Viewer here
What To Test?
Make sure that all of the your content works on the Havok4 grid, and try as many physics-related things as you can think of as well... Here is a short list, and a link to a page with a more exhaustive list of ideas:
- Building, linking, unlinking
- Vehicles
- Weapons
- "Spells"
- Shields
- Building Tools
- Rezzing large linked sets of prims
- Try building simple and complex items, taking them into inventory and rezzing them in different orientations and in different places
- Does walking, sitting, flying, swimming, running and other avatar motions work the way you expect it to?
- Do scripts work as expected?
- Try creating scripts and modifying them
- Are permissions working correctly?
- Can you get the sim to crash using "physics crashes"? (those of you who know what this means... "go for it" and let us know if you can... ;)
There are Many Things You Can Test In Havok4 (a list of lots of things that would be helpful for you to test. Feel free to pick and choose from this list and make up your own things to try as well!
How Do I Stay "In The Loop" With Havok4 Testing?
- Attend "Regular Havok4 Office Hours In-World"
- TELL US about everything you find using the Public Issue Tracker at "Issue Tracker"
Please enter bugs using PROJECT "Second Life Service - SVC" and when entering the bug choose AFFECTS VERSIONS "Havok4 Beta" and COMPONENTS "Physics" to be sure we see them right away!
How Will Havok4 Be Tested And Rolled Out?
This project replaces a core component of Second Life, and being sure that "anything that pushes, collides or has inertia" works right is a pretty extensive task. We have already done a lot of internal testing, and plowed through hundreds of internal bug fixes. We will be taking a phased approach to both catch as many problems as early as possible, and reduce risk of issues as Havok4 is rolled out.
Phase 1 - Internal Testing On Non-Public Test Grid (DONE!)
We already completed this phase, and had a variety of internal staff work on Havok4 enabled simulators. Basic functions were checked, as well as checking to see that the known physics-related simulator crashes were resolved.
Phase 2 - Public Beta Test On Beta Grid
We expect the public beta test for Havok4 to be very active, with many participants. We have prepared a test grid that allows for many types of physics-related tests. The test regions will include:
- Orientation Islands
- Welcome Areas
- Lusk
- Several sandboxes
- Combat sandboxes
- Vehicle testing simulators
NOTE: The Public Beta viewer will be configured to use the beta grid, which will be a snapshot copy of portions of the main grid and a copy of your user account. You can do "anything you want" on this grid without risking damage to your "real account" on the main grid.
Phase 3 - Havok4 On A Select Few Main Grid Regions ("YOU ARE HERE!" :)
In this phase we will use the new HetGrid functionality to deploy Havok4 simulators on a small number of regions of the main grid. This will still be a testing phase, and for this phase any participants will need to remember that you will be on the main grid, working with your real inventory (caveat emptor - don't rez "no copy/transfer" items on these early test Havok4 sims without understanding the potential risks)
Phase 4 - Partial Main Grid Rollout (50-100 regions)
At this point, we will have resolved outstanding issues found during beta testing and the Phase 3 "small deployment in a corner of the main grid" and will deploy Havok4 to a subset of the main grid.
After collecting feedback, if all looks good, we will continue to...
Phase 5 - Full Havok4 Rollout On Main Grid (deploy to rest of grid)
If all is clean at this point, we will then roll out the Havok4 engine to the rest of the main grid, and we'll be "live" with Havok4 everywhere.
A Historical Note: Why Did "Doing Havok" Take So Long?
Some of you who have been around for a long time will know that we talked about replacing Havok1 a long time ago, and did not seem to get this project done, and finally went silent about it. After several false starts, we decided that it would be best to stop talking about the work, or making public commitments, until we were far closer to the goal, and we believe that we are finally at this point.
For "quite some time" we worked to replace Havok1 with Havok2. After working on that project, we realized that we really should rework the interfaces for how Havok is integrated with Second Life. We realized that we needed to define an abstraction layer - a layer of code that would make it easier to do future physics engine migrations so that they don't take as much effort as this migration took, and to allow for more flexibility down the road. At this point Havok4 became a much more reasonable target than implementing based on a then-older release... and thus we set Havok4 as the target. This project has been significantly larger than any of us anticipated, however the good news is that we are now here, ready for beta testing, and ready to fix the last minute issues before we bring Havok4-based sims to the main grid!
New experiences that are normal
Ejection and separation of interpenetrating objects
One of the largest improvements over the previous Havok I engine is that Havok 4 supports separation of interpenetrating objects. That is, a cube that is embedded into the ground and turned physical will attempt to work its way out and up, until it has separated from from the ground and then rests on the ground.
The previous engine did not handle interpenetrating objects very well. It would go into a deeply recursive processing loop known as the "Deep Think" condition, trying to determine where the overlapping objects should move, causing the simulator to run very slowly.
The new engine quickly and easily separates overlapping objects. The objects are treated like compressed springs, so that a deeper interpenetration imparts a greater ejection force onto the object. The interpenetration resolver attempts to obey movement constraints and will not explode out through enclosing walls, but will expand out through whatever openings or spaces are available.
Here is a Google Video showing an extreme example of how the interpenetration resolver works. A stack of about 200 very large disks about 0.5 meter thick overlap in a short stack about 10 meters tall, and enclosed inside a large hollow tube. When rezzed on the ground and turned physical, the disks explode upward and out of the top of the tube, with some disks shooting over 300 meters high from the repulsive force of the overlap resolution. No scripted movements or pushes are being applied to the disks. The motion is purely from the interpenetration resolver.
Google Video: Second Life Havok 4 - Exploding Can of Disks
http://video.google.com/videoplay?docid=-2623683631644524154
Simulator lag from huge piles of stacked objects
Even though this is a new and improved physics engine that should not crash as frequently as the original Havok-1 engine, there are times when the new simulator will still experience very bad lag due to a large number of touching physical objects.
This lag is not a bug, and is not like the old Havok-1 Deep Think condition, but is due to a limitation in how physics engines work in general. This same problem affected Havok-1, but it wasn't as obvious, since large stacks often crashed the simulator before this condition could become apparant.
Normally when physical objects slow down to below a critical speed for a period of time, the engine quiets the physics processing for that object, in order to save CPU time for the more active objects.
In order for the physics processing to settle, the object needs to be in contact with a nonmoving reference object. A single physical bar coming to a stop touching the ground is therefore quieted.
But for multiple stacked physical objects, it is difficult for them all to settle down, because one or more of the other touching objects may still be slightly moving when the other objects settle. This slight movement of the one then reawakens the objects that previously were settled, resulting in small movements rippling through the stack. The feedback of reawakening constantly circulates through the pile so that none of them are ever really able to settle completely. This constant moving and twitching of the spheres is similar to the physical concept of Brownian Motion with atoms.
Google Video example of simulator lag generated from 565 physical spheres held inside a container:
http://video.google.com/videoplay?docid=7316931483709158462
This engine lag is not based on the size of the objects involved. A collection of 500 very small stacked objects can cause as much lag as 500 large stacked objects.
Thousands of objects that don't touch do not lag
The Havok-4 simulator will run at full speed, if there is enough space between physical objects so that the reawakening collisions are kept to a mininum.
There can be thousands of physical objects in a simulator without any lag, just so long as the objects minimally touch each other.
Google Video of 2000-3400 physical cubes in a sandbox, with no lag:
http://video.google.com/videoplay?docid=-2779779276874540721