Jump to content
Sign in to follow this  
JDog

User animations faster in MP than in SP?

Recommended Posts

I let this issue sit for a while but I just added some radar animations to my carrier, which seem to run at the same speed either way, so I'm guessing its just user/scripted animations that run faster.

Both my JBDs and elevators animations are completing for clients in like 1/3-1/2 of the time it takes in SP or as host. I have no idea why. Here's my stuff for the JBD animation:

config.cpp

class ani_JBD1
           {    
               source="user";
               animPeriod=6;
               initPhase=0;
           };

model.cfg

class ani_JBD1
           {
               type = "rotation";
               source = "user";
               memory = "true";
               angle0 = "rad 0";
               angle1 = "rad 60";
               axis = "JBD1_axis";
               selection = "JBD1";
               minValue = 0;
               maxValue = 1;
           };

With that it takes around 2.5-3 seconds to complete normally, but like 1 second in MP as client. And they're called via scripts.

Share this post


Link to post
Share on other sites

Other than this, I'm wondering if its possible via scripts to set the position of a resource/image called via titleRsc or the like. Can't seem to find any way to do it.

Share this post


Link to post
Share on other sites

For your first post i got no answer, i never encountered that myself...

On the second one, do you mean the position of an image on the screen?

Share this post


Link to post
Share on other sites

Yea like say I have a marker that's a .paa, and I want to place it on the screen dependant on a script-found UI coordinate. For example I want the marker to loop and always update to being over a unit "Object1"'s position on the screen. Getting that is easy I can just use:

Obj1Pos = worldToScreen (position Object1);

And that'll return UI coordinates. What I'm not finding to be possible is to somehow pass that coordinate array to be used by the .paa defined in RscTitles, since its X/Y position is already defined there. Basically I suppose what I'm trying to achieve is the same thing as the green box that appears over an object when you're locked onto it. So any way of getting that to work, preferably with a custom image, would be grand.

Share this post


Link to post
Share on other sites
...For example I want the marker to loop and always update to being over a unit "Object1"'s position on the screen. Getting that is easy I can just use:

Obj1Pos = worldToScreen (position Object1);

And that'll return UI coordinates. What I'm not finding to be possible is to somehow pass that coordinate array to be used by the .paa defined in RscTitles, since its X/Y position is already defined there. Basically I suppose what I'm trying to achieve is the same thing as the green box that appears over an object when you're locked onto it. So any way of getting that to work, preferably with a custom image, would be grand.

Didn't test it, but this should work....

Relocate the Control with the script commands:

control ctrlSetPosition [x, y, w, h];

controlName ctrlCommit time;

Generic example:

// I assume following data
// Display IDD = 1099
// Marker Control IDC = 99

_MarkerCtrl = (finddisplay 1099) displayCtrl 99;
Obj1Pos = worldToScreen (position Object1);
_MarkerCtrl ctrlSetPosition [Obj1Pos select 0, Obj1Pos select 1];
_MarkerCtrl ctrlCommit 0.01;

Share this post


Link to post
Share on other sites

That looked pretty promising, thanks for the thought. Doesn't seem to do the trick though, or I'm doing it wrong. Here's what I'm going with:

class RscTitles
{
   class marker69
   {
   idd = 1099;
   movingEnable = 1;
   duration = 5;
   fadein = 0;
   fadeout = 0;
   name = "marker69";
   controls[] = {"image1"};

       class image1
       {
       x = 0;
       y = 0;
       w = 0.4;
       h = 0.4;
       type = 0;
       idc = 99;
       style = 48;
       colorBackground[] = {0, 0, 0, 0};
       colorText[] = {1, 1, 1, 1};
       font = BitStream;
       sizeEx = 0;
       lineSpacing = 0;
       access = ReadAndWrite;
       text = "marker69.paa";
       };
   };
};

disableSerialization;
TitleRsc ["marker69", "PLAIN", 0];

_MarkerCtrl = (finddisplay 1099) displayCtrl 99;
Obj1Pos = worldToScreen (position Object1);
_MarkerCtrl ctrlSetPosition [Obj1Pos select 0, Obj1Pos select 1];
_MarkerCtrl ctrlCommit 0.01;

Also if anyone has some input on the animations problem still trying to figure that one out :)

Share this post


Link to post
Share on other sites
That looked pretty promising, thanks for the thought. Doesn't seem to do the trick though, or I'm doing it wrong.

Add something like this to the onLoad event for your resource:

onLoad = "_display=_this select 0 ; uiNameSpace setVariable [""JDOG_RESOURCE"",_display]";

Then grab it in your script with:

uiNameSpace getVariable "JDOG_RESOURCE"

Both my JBDs and elevators animations are completing for clients in like 1/3-1/2 of the time it takes in SP or as host.

Are you ensuring the anim is only called locally to the object? Generally this gives better results, although I haven't tested it in Arma2. Not sure what would happen if you try and animate something on both the server and the client at the same time. Probably depends on how your animating it, for example if your incrementing the animPhase manually.

Share this post


Link to post
Share on other sites

Thanks I'll try adding that when I get the chance to work on it again.

As for the JBD/elevator animations... they're activated in reponse to a client activating an action. It's only called on that client's machine but everyone sees the animation. Also it doesnt matter if client or host calls it, clients will still see if perform faster.

Share this post


Link to post
Share on other sites
Also it doesnt matter if client or host calls it, clients will still see if perform faster.

So in theory, running a dedicated server, all clients will see the anim perform at the same speed?

That does sound a little irregular, can you reproduce it with a basic object and a simple linear anim? I ask becuase if you can get someone else to confirm it, then you should really post that up on the BI bug tracker.

Share this post


Link to post
Share on other sites

Well so far I've tested it with one friend of mine. So like if I'm host and an elevator is activated to go up while we're both on it, he will actually start floating higher in the air on my screen, on nothing, getting to the top faster than me in like 60% of the time it takes me to get up there. Same will happen with me on his screen if he is host. If I run a dedicated server, we both move up/down at the same speed.

Hope that clears it up. I will try with him sometime soon to see if we can reproduce the problem with another addon's animations perhaps.

Share this post


Link to post
Share on other sites

Bringing this up again too. I have a video just so you guys can see what I'm talkin about this time, not to say I wasn't clear earlier. At first I thought the animation speeds were multiplied but maybe it's just cutting a set time (like 3 seconds) off both animations? Anyway... the problem:

rHbcLkJorAk

Share this post


Link to post
Share on other sites

WHAT!!!!! probably not with the elevators but the JBDs go up CRAZYFAST in online play :(

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×