Does AngelCode have the ability to pause a script mid-function? Like a function executes until it reaches a sleep/wait, then it pauses for the allotted time before resuming?
Also does it have the ability to thread off multiple functions? Not literally threading them to separate processors, but rather keeping track of which function should be the one currently executing, while having multiple threads wait simultaneously until it is their turn?
Thanks.
Does AngelCode support waits or threads?
Basically I have been asking myself the same question a while ago.
You can easily use the windows sleep function by registering it and exposing it to the script. Unfortunately this approach will lock the current thread and you will be unable to process anything until the sleep returns. You can solve this by having multiple threads running, but this has some drawbacks too. Personally I would advise against using windows threads because they're rather inefficient. The real solution here is to have a single thread monitor and manage the execution of multiple contexts. So if you want a sleep function, have the script call a similar registered function which suspends the context and passes the execution to the next virtual thread/context. The current context/thread remains suspended until it is time to resume it. I'm afraid you will have to code your own logic here, but there are already a few interesting examples available in the SDK to get you started (see context manager among others).
~Biz
You can easily use the windows sleep function by registering it and exposing it to the script. Unfortunately this approach will lock the current thread and you will be unable to process anything until the sleep returns. You can solve this by having multiple threads running, but this has some drawbacks too. Personally I would advise against using windows threads because they're rather inefficient. The real solution here is to have a single thread monitor and manage the execution of multiple contexts. So if you want a sleep function, have the script call a similar registered function which suspends the context and passes the execution to the next virtual thread/context. The current context/thread remains suspended until it is time to resume it. I'm afraid you will have to code your own logic here, but there are already a few interesting examples available in the SDK to get you started (see context manager among others).
~Biz
AngelScript gives you the functionalities to do what you want, but as most developers have their own specific needs I haven't put in built-in capabilities so it needs to be registered from the application side. The context manager add-on that Bismuth mentioned implements most of what you mentioned.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement