|
PartitionWorld | |
PartitionWorld WorldIndex, Size | |
Parameters: WorldIndex = The index of the world you wish to partition Size = The size of the partition regions. (recommended values 48, 64. Absolute min of 16) |
|
Returns: NONE | |
PartitionWorld builds a special partition map for all the elements captured in this world. This map is used to accelerate calculations like collision and ray intersections. When you call PartitionWorld you give the command two parameters. The first is world and the second is the partition size. What partitioning does, is builds a grid like table that represents the world. Each cell in the table is square and will represent a region of our selected size. These cells contain a list of the world elements that share this region in world. What this does, is allows PlayBASIC to rapidly calculate a short list of elements that are within any given area of the world. This is particularly beneficial when dealing with collision and ray intersection. As it allows those functions to focus on a smaller groups of elements, rather than everything. Greatly accelerating there functionality. FACTS: * Avoid setting the partition size too small. This not only makes the structure eat up a huge amount of memory, but can actually be slower to search. I find setting the region size to somewhere between 48 and 256 to be a good balance. * Building the Partition Map can be a bit slow for large worlds. Mini Tutorial: This example build a simple world, partitions this world then runs a series of ray intersections on the world.
|
Related Info: | CameraBasics | CreateWorld | NewWorld | QueryWorldRegion | RayIntersectWorld | SpriteCollisionMode : |
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |