Skully Posted September 5, 2011 Share Posted September 5, 2011 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? Quote Link to comment Share on other sites More sharing options...
Canardia Posted September 5, 2011 Share Posted September 5, 2011 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. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Skully Posted September 5, 2011 Author Share Posted September 5, 2011 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 Quote Link to comment Share on other sites More sharing options...
Canardia Posted September 5, 2011 Share Posted September 5, 2011 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. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Skully Posted September 5, 2011 Author Share Posted September 5, 2011 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 Quote Link to comment Share on other sites More sharing options...
Laurens Posted September 5, 2011 Share Posted September 5, 2011 What's the idea then? I seriously doubt it cannot be done. It might help to get a different perspective. Quote Link to comment Share on other sites More sharing options...
Skully Posted September 5, 2011 Author Share Posted September 5, 2011 What's the idea then? I seriously doubt it cannot be done. It might help to get a different perspective. It can be done but not in version 1 Quote Link to comment Share on other sites More sharing options...
Laurens Posted September 5, 2011 Share Posted September 5, 2011 Version 1 of what? It would help if we knew what your idea or requirements are so we can better offer alternate solutions. Quote Link to comment Share on other sites More sharing options...
Skully Posted September 5, 2011 Author Share Posted September 5, 2011 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 Quote Link to comment Share on other sites More sharing options...
Josh Posted September 12, 2011 Share Posted September 12, 2011 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. Quote 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 More sharing options...
Recommended Posts
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.