| User Functions |
|
|
Don't have an account yet? Sign up as a New User
|
|
| Events |
|
|
There are no upcoming events |
|
|
 |
| Object Precaching Techniques |
 |
|
Saturday, October 11 2003 @ 05:43 PM EDT, Matthew
|
The Object Manager in Virtools is notoriously slow; constantly creating/deleting objects at a fast pace--for instance, projectiles in a shooting game--can quickly make it your performance bottleneck. Compound this with dynamic physics, and you're likely to see physics stability problems as well.
One solution to the problem is to introduce an object precaching system. At the beginning of your composition's execution you create as many copies as you expect to simultaneously need. You then reference this pre-created objects, instead of dynamically copying/deleting them.
I'm working this technique into one of our IGF projects, as it has a large amount of both physics projectiles and compound particle effects. I started with a simple proof-of-concept example; check out the web version here. I did a quick test to simulate destruction, too; shots that hit the back two cubes are removed. Notice that the oldest objects disappear when you hit the object limit (100). The source .CMO is fairly well-documented, if you're interested in using the technique in your own project.
|
|
|
|
|