ENIGMA Forums
Contributing to ENIGMA => Proposals => Topic started by: Goombert on August 02, 2014, 07:21:57 pm
-
This is just a quick opinion topic I want to get you guys thoughts on some things.
First, script_thread should not automatically execute, like any other programming language we should be able to create the thread and then execute when want, so I propose the addition of the following function.
thread_start(threadid);
I would also like to propose syntax handling to allow inline threads like Java.
thread_create() {
show_message("Thread Running");
}.start();
// also the following
var thread = thread_create() {
show_message("Thread Running");
}
thread_start(thread);
-
I don't like the idea of a new syntax for threads. The new parser supports anonymous functions. If it doesn't, it will briefly.
function my_thread() {
for (int i = 0; i < 10; ++i) {
show_message("Thread Running");
sleep(1000);
}
show_message("Thread Done");
}
var thread = thread_function(my_thread);
Basically, leave the syntax modifications to supporting dynamic functions in general. A thread_start, thread_join, and thread_signal will follow from there.
-
Alright that all sounds good to me, so I should just not worry about the additional thread functions right now?
-
@Robert:
I like the idea. I'd like the ability to use threading for loading big assets into the background whilst in an animated game menu or during a game, or animated load screen,
currently script thread in ENIGMA only works with show message, it is broken for everything else.
-
Worry about them all you like. I doubt you would have much luck implementing either of those right now.
-
Threading has been seriously revamped in my latest commit, I was able to fully implement the threading functions and the implementation now more correctly mirrors most thread API's. I also fixed existing bugs in the thread functions.
http://enigma-dev.org/docs/Wiki/Game_State_Functions
https://github.com/enigma-dev/enigma-dev/pull/788