Jump to content

About Scripts


Skully
 Share

Recommended Posts

I'm a complete newby with leadwerks but the concept of the scripting language poses an interesting option in a game I'm currently creating a design doc for... my question is do scripts run in parallel or sequentially? If one object has a huge script and another a small one will the whole huge script run (until its exited) as well as the whole small one or does it thread them?

 

Context: If two objects have script that turns them to point at each other, but one script is inefficiently written (extra instructions) will the "lean" script object start turning first?

Link to comment
Share on other sites

They run sequentially, and each script should not take more than 0.15ms to run, since 15ms is 60 FPS, so with 0.15ms you can have 100 scripts running at 60 FPS, but since the rendering takes time also, you could still run 50 scripts (30 FPS cost).

 

You can use the Millisecs() command to measure the time a script runs, and make some alert if a script runs longer than you want.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

They run sequentially, and each script should not take more than 0.15ms to run, since 15ms is 60 FPS, so with 0.15ms you can have 100 scripts running at 60 FPS, but since the rendering takes time also, you could still run 50 scripts (30 FPS cost).

 

You can use the Millisecs() command to measure the time a script runs, and make some alert if a script runs longer than you want.

 

Nice to know thanks... I was really hoping the scripts ran in parallel... allocating a certain amount of system resource to progressively solve them. I'm sure that would be a nightmare in terms of inter-process communication goes lol... one can dream ;)

Link to comment
Share on other sites

That would be quite inflexible, since scripts might sometimes want to run faster and sometimes slower, so the best is if you write your scripts so that they are reentrant, if they do some loop-like behaviour. And you don't need to run each script in each frame either, in most cases it's fast enough to run a script every 1 or 5 seconds.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

That would be quite inflexible, since scripts might sometimes want to run faster and sometimes slower, so the best is if you write your scripts so that they are reentrant, if they do some loop-like behaviour. And you don't need to run each script in each frame either, in most cases it's fast enough to run a script every 1 or 5 seconds.

 

So long as the timing is reflected on all the objects equally the speed of processing would be consistent, but ya not predictable like it needs to be. Hmph ;) My idea will not work with today's technology (that I have)... get out the scribble pad LOL

Link to comment
Share on other sites

Version 1 of what? It would help if we knew what your idea or requirements are so we can better offer alternate solutions.

 

Sorry I wasn't fishing for a solution just asking a question about how the scripts ran.

 

Not trying to be rude but Its only at design doc stage and I don't want to come off as it being more than it is right now... its been in my head for a long time but I never really captured it... since I havent seen anything like it yet and its been years... I figure its a doable game for me to make... space empire type... thats all I'll say ;)

Link to comment
Share on other sites

The first object that happens to be in the list, which is random, will be turned first. However, both will be called before the UpdateWorld() functions exits, so when rendering occurs they will both have the same progress completed.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...