(06-07-2011 02:51 PM)Esenthel Wrote: use GetBase(name) instead of Split(name, '/').last()
Hey, thanks for the tip! That's much better to use...
(06-07-2011 04:39 PM)PRG3D Wrote: This function seems to be very slow
Yeah, it's gonna take a while, especially if you have a very large map.
Calling Game::World.update() forces that area to be loaded into the world so Game::World.areaActive() returns valid data for the current area.
Each heightmap tile in your world must be looped through, if you want to count the total number of objects for the
entire world.
This means that other nearby tiles are constantly being loaded/unloaded as well, which further adds to the delay.
However, I think I just thought of a solution while writing this post just now.
Try this:
Code:
Bool Init()
{
D.viewRange(1); // lower the viewRange so there will only be 1 active area
Game.World.init();
// ...
FREPA(areas) { // ... }
D.viewRange(100); // reset viewRange
Game::World.activeRange(D.viewRange()); // reset activeRange
}
What this does is initially sets a low viewRange/activeRange so there will only ever be 1 active area at a time. This should mean that there will be much less loading/unloading of nearby areas, which should result in greater speeds overall.