MrGriggs
 Joined: Dec 2010
Posts: 128
|
 |
Posted on: January 27, 2011, 02:12:38 PM |
|
|
|
I don't know if there's any point discussing this, if it's even considered.
I know not of the validity in my statement but I propose that it would give advantage to ENIGMA if it used a single thread for each process, such as the Draw process being on a seperate thread, the sound process, and step process.
Collision process maybe? I know there's many things that could be assigned to different threads, but i'd like it as follows.
Step
Draw
Sound
Collisions
|
|
|
luiscubal
 Joined: Jun 2009
Posts: 452
|
 |
Reply #1 Posted on: January 27, 2011, 02:46:17 PM |
|
|
|
I believe sound(OpenAL) is already in a separated thread.
Multithreading would break compatibility with GM, although some kind of limited multithreading support might be possible in the physics subsystem(hspeed, vspeed, gravity, friction and collisions).
Multithreading the draw event might be problematic, even if no sane person would make the Draw event change variables like position, etc.
|
|
|
MrGriggs
 Joined: Dec 2010
Posts: 128
|
 |
Reply #2 Posted on: January 27, 2011, 03:22:36 PM |
|
|
|
It wouldn't break compatabillity as multi threading is not addressed until the information is parsed to ENIGMA, the .Gmk or whatever, would remain the same, the user has no access to defining threads, just an .exe compiled with ENIGMA uses pre-defined threads as determined in the engine.
|
|
|
luiscubal
 Joined: Jun 2009
Posts: 452
|
 |
Reply #3 Posted on: January 27, 2011, 05:31:51 PM |
|
|
|
Let me put it this way. Say 2 instances access each other x and y.
var tmp = other_inst.x; other_inst.x = self.x; self.x = tmp;
In GM, this means the two x are swapped. Since the code is executed twice(2 instances), this code effectively does nothing in GM. Now, consider a perfect parallel synchronized execution. inst1.x = 5; inst2.x = 10; Now, each instance reads the x of the other to its own local tmp variable. Now, each instance changes the position of the other. Right now, we have inst1.x = 10; inst2.x = 5; Now, they are going to set their own x from the tmp variable. So we now have inst1.x = 10; inst2.x = 5; again.
So the end results are different. Therefore, compatibility with GM is broken.
|
|
|
IsmAvatar
LateralGM Developer
 Joined: Apr 2008
Posts: 877
|
 |
Reply #4 Posted on: January 27, 2011, 05:58:18 PM |
|
|
|
Not to mention, different behaviors each run if they aren't in perfect parallel sync.
|
|
|
|
|
Josh @ Dreamland
Prince of all Goldfish
 Joined: Feb 2008
Posts: 2,950
|
 |
Reply #6 Posted on: January 28, 2011, 05:48:07 AM |
|
|
|
What I was thinking about doing is adding threading by the same mechanism that I can add instance deactivation. Basically, I would keep a new tree and shit for each thread (deactivated instances get placed in thread -1, which is never processed).
Threading an object would be as simple as saying instance_thread(inst,thread). Users would be allowed to figure out for themselves that sometimes life isn't as easy as putting everything in its own thread and hoping depth and shit stay in order.
|
|
|
MrGriggs
 Joined: Dec 2010
Posts: 128
|
 |
Reply #7 Posted on: January 28, 2011, 10:05:32 AM |
|
|
|
I understand how a thread functions, and the inconsistencies it may cause when used with particular methods.
But if things such as sound/particles and the like where to be put into seperate threads it wouldn't matter if there was a slight deviation from the norm.
|
|
|
|