Page MenuHomeFeedback Tracker

[Feature Request] Faster animationPhase command
New, NormalPublic

Description

Based on a quick test I made, it seems that animations are stored as arrays internally, because the performance of animationPhase seems to vary linearly with the index of the animation in animationNames array.

If I'm right, it means the game searches for the animation name first before returning the phase, which is a bit wasteful since object animations don't change indices.

This gets way much worse with objects that have many animations, such as vehicles. Especially if someone desires to do this every frame.

So I would like to ask for 2 features to make things faster:

  1. A command that returns all animation phases in the same order as animationNames array would be extremely helpful (same as doing: animationNames _obj apply {_obj animationPhase _x}; which is very slow in SQF)
animationPhases _obj;

returns an array of numbers:

[0, 1, 0, 1, ...];
  1. In addition would it be possible to make the animate and animationPhase commands also accept animation indices? (i.e. obj animationPhase index)

Indices would be the same as the index in animationNames array.

Sample code:

_phases = [];
{
    _phases pushBack (_obj animationPhase _forEachIndex);
} forEach animationNames _obj;

which should be faster than:

_phases = [];
{
    _phases pushBack (_obj animationPhase _x);
} forEach animationNames _obj;

Details

Severity
Feature
Resolution
Open
Reproducibility
N/A
Operating System
Windows 10 x64
Category
Scripting

Event Timeline

Leopard20 created this task.Jun 7 2022, 5:06 PM
Leopard20 updated the task description. (Show Details)Jun 7 2022, 5:10 PM
Leopard20 updated the task description. (Show Details)
Leopard20 renamed this task from [Feature Request] Make animate and animationPhase commands use animation indices to [Feature Request] Make animate and animationPhase commands work faster, using indices.Jul 25 2022, 12:13 AM
Leopard20 updated the task description. (Show Details)
Leopard20 renamed this task from [Feature Request] Make animate and animationPhase commands work faster, using indices to [Feature Request] Faster animationPhase command.Jul 25 2022, 12:17 AM
Leopard20 updated the task description. (Show Details)
Leopard20 updated the task description. (Show Details)
Leopard20 updated the task description. (Show Details)Jul 25 2022, 12:19 AM
Leopard20 updated the task description. (Show Details)Jul 25 2022, 1:06 AM
Leopard20 updated the task description. (Show Details)
h- added a subscriber: h-.Jul 27 2022, 3:46 PM