Jump to content
Sign in to follow this  
infection

Call or Spawn locking up game

Recommended Posts

Hello I'm currently in the works of optimizing our mission however I can't quite figure out when I should use spawn or call (before you say it, I'm aware several threads has been made regarding the subject). My issue is that I know spawn basiclly runs parallel and call waits for return. Below explained pretty well for me. (Taken from http://forums.bistudio.com/showthread.php?101275-Return-Value-From-SQF-File&p=1665038&viewfull=1#post1665038)

call means starts the code which can return a result -> Do this for me and tell me the result I'll wait for it.
spawn means start this code and run it in parallel. I'll continue doing whatever I was going to do.
loadFile reads a file and makes it a string; a piece of text.
preProcessFile reads a file and removes comment, applies preprocessor rules, and then return a string; the resulting text.
compile takes some string and turns it into code.
execVM is the equivalent of "spawn compile preProcessFile"

HOWEVER, I still have a few questions.

Currently I compile all my functions with Funcname = compile preprocessFileLineNumbers "name.sqf", my questions are

  • It says execvm is the same as spawn compile preprocessfile, if I use [] spawn function; after I used above code to turn my scripts into function variables is it still the same performance as a execvm? and is call better performance than spawn in general?
  • I've been testing a lot with call however game locks up on certain scripts, I understand a waituntil and sleep won't work in a call function correct? So what more would generally cause game to hang due to call function. (Where I would need spawn instead of call)
  • I'm not certain about this but I think I read it somewhere that only spawn can call for other functions and call can't?
  • Is spawn the only thing you can do within a .hpp file?

If Someone would be able to clarify this for me it would be great!

Edited by Infection

Share this post


Link to post
Share on other sites

Hello Infection,

i asked me the same questions a few months ago.

Because of that i wrote a little test .fsm to check the timings of the script interpreter.

You can find this .fsm and some results in this thread:

http://forums.bistudio.com/showthread.php?156542-optimization-for-script-interpreter-possible

The answer from *deadfast* in this thread is very interesting and helped me to understand some behavoir a bit better.

I think it is very important to understand this basics before start optimizing.

If you have some more detailed questions feel free to contact me via PM.

BTW: my little tool "Arma Server Monitor" is very helpful for optimizing tasks too, but is written for Arma 3.

It should work for Arma 2 OA too, but you have to install the included ASM.fsm manually in your missions init.sqf.

Regards,

Fred41

Hello I'm currently in the works of optimizing our mission however I can't quite figure out when I should use spawn or call (before you say it, I'm aware several threads has been made regarding the subject). My issue is that I know spawn basiclly runs parallel and call waits for return. Below explained pretty well for me. (Taken from http://forums.bistudio.com/showthread.php?101275-Return-Value-From-SQF-File&p=1665038&viewfull=1#post1665038)

call means starts the code which can return a result -> Do this for me and tell me the result I'll wait for it.
spawn means start this code and run it in parallel. I'll continue doing whatever I was going to do.
loadFile reads a file and makes it a string; a piece of text.
preProcessFile reads a file and removes comment, applies preprocessor rules, and then return a string; the resulting text.
compile takes some string and turns it into code.
execVM is the equivalent of "spawn compile preProcessFile"

HOWEVER, I still have a few questions.

Currently I compile all my functions with Funcname = compile preprocessFileLineNumbers "name.sqf", my questions are

  • It says execvm is the same as spawn compile preprocessfile, if I use [] spawn function; after I used above code to turn my scripts into function variables is it still the same performance as a execvm? and is call better performance than spawn in general?
  • I've been testing a lot with call however game locks up on certain scripts, I understand a waituntil and sleep won't work in a call function correct? So what more would generally cause game to hang due to call function. (Where I would need spawn instead of call)
  • I'm not certain about this but I think I read it somewhere that only spawn can call for other functions and call can't?
  • Is spawn the only thing you can do within a .hpp file?

If Someone would be able to clarify this for me it would be great!

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  

×