multi threaded scripting??
ive been thinking about this abit lately but everytime i do, i see big giant flashing warning signs. but it would a requirement if you wanted scripted cut scenes and such. of course some scripts need to be run on the spot.
soooo, would it be wise to spawn threads for the particular scripts i mentioned?
the big thing this brings up is that everything that script wants to effect in the game basically becomes a critical section and i''d have to make sure that somehow, mutexes were being activated and such.
it all sounds like one giant debugging nightmare... but please, any thoughts/opinions would be nice.
Get busy livin'' or get busy dyin''... - Shawshank Redemption
If a man is talking in the forest, and no woman is around to hear him, is he still wrong? - Unknown
Fulcrum
Get busy livin' or get busy dyin'... - Shawshank RedemptionIf a man is talking in the forest, and no woman is around to hear him, is he still wrong? - UnknownFulcrum
February 25, 2004 06:29 PM
Multi thread is a must have for script, every entity should have its own script up and running.
But it''s by no mean real thread. Your scripting system must use some kind of non-preemptive multi thread system : each thread tells the system when it give the power back to the engine.
It''s completely mandatory for determinism...
Please note that both LUA and Python have built-in coroutines features that are EXACTLY what you need...
But it''s by no mean real thread. Your scripting system must use some kind of non-preemptive multi thread system : each thread tells the system when it give the power back to the engine.
It''s completely mandatory for determinism...
Please note that both LUA and Python have built-in coroutines features that are EXACTLY what you need...
I wouldn''t use real processor threads for this. The synchronization could become a huge management nightmare.
Use a non-preemptive system (sometimes called "coroutines"). Basically, you can have many scripts loaded up, and they can execute some code and then pause or yeild execution when needed.
Check out Lua for a good example. You could probably have it integrated in your game in a matter of hours.
Use a non-preemptive system (sometimes called "coroutines"). Basically, you can have many scripts loaded up, and they can execute some code and then pause or yeild execution when needed.
Check out Lua for a good example. You could probably have it integrated in your game in a matter of hours.
im using python atm. So you would be referring to yeild and micro threads, right?
ive only looked into them briefly... but i''ll take another gander at them soon.
thanks all.
ive only looked into them briefly... but i''ll take another gander at them soon.
thanks all.
Get busy livin' or get busy dyin'... - Shawshank RedemptionIf a man is talking in the forest, and no woman is around to hear him, is he still wrong? - UnknownFulcrum
read this thread
http://gamedev.net/community/forums/topic.asp?topic_id=205985
http://gamedev.net/community/forums/topic.asp?topic_id=205985
You don''t need micro threads, just generators.
[ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost
Asking Questions | Organising code files | My stuff | Tiny XML | STLPort]
[ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost
Asking Questions | Organising code files | My stuff | Tiny XML | STLPort]
quote: Original post by Syrillix
im using python atm. So you would be referring to yeild and micro threads, right?
If you do a lot of microthreading, consider using Stackless Python.
“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” — Brian W. Kernighan (C programming language co-inventor)
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement