LibLoad() and Action Actuators Problem

Hey,

My game has a massive amount of objects, but only uses quite a few at a time. This makes the framerate good, but it takes almost a whole minute to launch the game.

I decided to use use the ‘bge.logic.LibLoad()’ function to dynamicly load scenes only with needed objects. All works good, except action actuators:

  1. Only the highest priority action actuators play.
  2. Loop-stop mode does not stop ever.

I ran out of ideas how to tweak the actuator to work. All the actions are loaded when I LibLoad the scene in the game (tested many ways), so the problem is in the actuators. Any tips/similar experiences?

Using 2.61, same issue in 2.63 though.

instead of using the Action Actuator, try playing the Animation on the objects directly

excuse crude code:

Object:

(TrueTrigger Enabled) Always -------------------> pythonScript.py


import bge
from bge import logic
cont = logic.getCurrentController()
Obj = cont.owner

# check to see if Object already initialised
if "State" not in Obj:
    Obj.playAction(*ActionName*, *StartFrame*, *EndFrame*, *layer*, *priority*, *blending*, *play_mode* , 0, *ActionSpeed*)
    Obj["State"] = "AnimPlaying"

# Animation has finished, stop the animation.
elif "State" in Obj and Obj["State"] == "AnimPlaying" and Obj.isPlayingAction(*AnimLayer*) == False:
    Obj.stopAction(*AnimLayer*)
    Obj["State"] == "AnimStopped"


http://www.blender.org/documentation/blender_python_api_2_65_release/bge.types.html?highlight=playaction#bge.types.KX_GameObject.playAction

play modes:

bge.logic.KX_ACTION_MODE_PLAY= Play the action once.
bge.logic.KX_ACTION_MODE_LOOP = Loop the action (repeat it).
bge.logic.KX_ACTION_MODE_PING_PONG = Play the action one direct then back the other way when it has completed.

The python command works a little more fluently with using libload I have found. this is just one solution, im sure somebody can explain why the actuator isn’t functioning correctly.

CTBM

Are you sure you are using LibLoad() with load_actions=True?

edit: Apologies, just re-read your problem and you stated that the actions are succesfully loading :confused:

Direct python animation really solves the problem and I managed to circumvent the priority system as well, which previously gave me hell! Thank you very much for the tip!