help resolving performance issue..
by Dillon Nys · in iTorque 2D · 01/14/2012 (3:55 pm) · 2 replies
In my game, a patch of grass is generated that looks like this
and then, randomly, it will be added to my scene using this code
where the grass patch is loaded, and then one by one the flowers are mounted on.
however, this creates extreme lag when running on my ipod touch 4th gen until it has completely loaded.
any suggestions on a more efficient way to do this?
and then, randomly, it will be added to my scene using this code
if(isObject(%grassPatch) && $loadGrassPatch)
{
%grassPatch.addToScene(sceneWindow2D.getSceneGraph());
%grassPatch.setLinearVelocityX($platformVel);
for(%i = 0; %i < 22; %i += 2)
{
%flower = $flowersList.getObject(%i / 2);
if(isObject(%flower))
{
%flower.addToScene(sceneWindow2D.getSceneGraph());
%offsetX = getWord(%grassPatch.LinkPoints, %i);
%offsetY = getWord(%grassPatch.LinkPoints, %i + 1);
%flower.mount(%grassPatch, %offsetX, %offsetY, 0, false, false, false, false);
%flower.setLinearVelocityX($platformVel);
}
}
$flowersList.clear();
$loadGrassPatch = false;
}where the grass patch is loaded, and then one by one the flowers are mounted on.
however, this creates extreme lag when running on my ipod touch 4th gen until it has completely loaded.
any suggestions on a more efficient way to do this?
#2
01/15/2012 (2:02 am)
Don't add the flowers to the scene during gameplay, add them once when the level begins and simply leave them off camera. It's quicker to move and remount them to create random variants than to reload new ones.
Torque 3D Owner Marc Dreamora Schaerer
Gayasoft
Datablocks & Texture Loading halt:
Ensure that the datablock is loaded already along the level datablocks and consider using the standard (for over a decade) loading screen technics where you actually draw every image in the scene behind the loading screen. Reason to do this is that the camera has to see and render it so OpenGL uploads the texture from RAM to VRAM for binding.