|
Goombert
|
|
Reply #1 Posted on: June 26, 2014, 10:46:15 pm |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
I tested and can not reproduce your problems. I tested on Windows 8.1 I added the following script to my project. show_message(argument0); Then I added an object with the following code for the create event. script_thread(scr_0, "From thread"); show_message("From object create event"); I placed it in a room and ran the game and it behaved as expected showing both messages asynchronously. You can download the source for this here. https://www.dropbox.com/s/iyz1hgxxhujzqst/threadarguments.gm81
|
|
« Last Edit: June 26, 2014, 10:50:09 pm by Robert B Colton »
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
|
Goombert
|
|
Reply #3 Posted on: June 26, 2014, 10:52:55 pm |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
You mean file_bin_* functions? Yeah I don't know if those work in threads because of mutual exclusion, but since they are most likely implemented using the standard library I see no reason for that, they should be working, but the issue is definitely not threads.
|
|
« Last Edit: June 27, 2014, 12:26:10 am by Robert B Colton »
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
TheExDeus
|
|
Reply #4 Posted on: June 27, 2014, 05:07:56 am |
|
|
Joined: Apr 2008
Posts: 1860
|
Everything should work in threads. If something doesn't because of things like race conditions, then you will get wrong results (or crashes), but it would still work asynchronously. So your problem is somewhere different probably. I will test.
edit: I just tested and I also have some problems with sprite loading. The data it loads is pure white (1,1,1,1) for every pixel when loading from a thread, but loads fine otherwise. It could be a problem with data locality, as it might not be allocated correctly outside the thread. Should be investigated. But it seems to be a problem with sprites function and it works with _bin function (as it returns data directly instead of in the background like resource functions do).
Darkstar2, remember that you cannot use local variables in threaded scripts. For example:
//Create of object a = 0;
//Script a = file_text_read_real(...); //Object.a is still 0, because this a is local for the thread
//Correct script obj_someObject.a = file_text_read_real(...) //Now you specify the variable correctly So you must either specify the object, make the variable global or pass the object as an argument (you can do "argument0.a" and call it by "script_thread(script,self.id)".
|
|
« Last Edit: June 27, 2014, 05:27:24 am by TheExDeus »
|
Logged
|
|
|
|
Goombert
|
|
Reply #5 Posted on: June 28, 2014, 02:09:48 pm |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
In contrast with what Harri just said, the new compiler does support atomic types however.
|
|
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
edsquare
|
|
Reply #6 Posted on: June 28, 2014, 03:15:20 pm |
|
|
Location: The throne of ringworld Joined: Apr 2014
Posts: 402
|
In contrast with what Harri just said, the new compiler does support atomic types however.
What new compiler?
|
|
|
Logged
|
A child of five would understand this. Send someone to fetch a child of five. Groucho Marx
|
|
|
Goombert
|
|
Reply #7 Posted on: June 28, 2014, 05:07:03 pm |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
JustDefineIt, or JDI, by JoshDreamland is the new compiler, and it can parse the Standard Template Library and allow use of vector and other collections. It also has the capability of compiler scripts essentially allowing var access functions and dynamic execution such as execute_string() only if the user wants it of course. The biggest feature is proper pretty printers, meaning it can properly export your code to JavaScript allowing us to do HTML5.
|
|
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
edsquare
|
|
Reply #8 Posted on: June 28, 2014, 05:32:24 pm |
|
|
Location: The throne of ringworld Joined: Apr 2014
Posts: 402
|
JustDefineIt, or JDI, by JoshDreamland is the new compiler, and it can parse the Standard Template Library and allow use of vector and other collections. It also has the capability of compiler scripts essentially allowing var access functions and dynamic execution such as execute_string() only if the user wants it of course. The biggest feature is proper pretty printers, meaning it can properly export your code to JavaScript allowing us to do HTML5.
You mean this?: https://github.com/JoshDreamland/JustDefineIt/tree/master/srcOver a year without commits, is it finished?
|
|
|
Logged
|
A child of five would understand this. Send someone to fetch a child of five. Groucho Marx
|
|
|
Josh @ Dreamland
|
|
Reply #9 Posted on: June 28, 2014, 06:01:23 pm |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
The newer commits are not in the master branch. There haven't been any in a while for a number of reasons both legal and related to my own indecision, but the newest is much more recent than a year.
JDI is a C++ parser and object definition framework; it powers the new compiler. The new compiler itself is in a branch of ENIGMA's repository.
My current task, which anyone is welcome to pick up, is modifying the lexers used in JDI so that ENIGMA can more easily extend them. I plugged JDI into ENIGMA a little prematurely last time, and the maintainability suffered for it. I'm trying to avoid repeats of this mistake.
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
TheExDeus
|
|
Reply #10 Posted on: June 29, 2014, 07:11:35 am |
|
|
Joined: Apr 2008
Posts: 1860
|
In contrast with what Harri just said, the new compiler does support atomic types however. How is that "in contrast" when I didn't even mention atomic types? I didn't mention anything tied to compiler. I mentioned that in my test sprite_add indeed doesn't seem to work correctly in threads. edit: Josh, what "legal reason" you are talking about? Something to do with google? Like if you work on ENIGMA your 1 day off, then they own it?
|
|
« Last Edit: June 29, 2014, 07:27:55 am by TheExDeus »
|
Logged
|
|
|
|
Darkstar2
|
|
Reply #11 Posted on: June 29, 2014, 11:13:48 am |
|
|
Joined: Jan 2014
Posts: 1238
|
lol - most people are dying to ask Harri It's probably some exclusivity thing, but given ENIGMA is a FREE project that would be doubtful, or it could have something to do with a company starting with Y......... Since this new compiler is just a mirage in the desert maybe we should stop referencing it, if it's not likely to happen at all anyway This will only encourage more people to learn C++ and do the stuff they can't compile directly in C++ and wrap it in a function in the enigma space. If that actually works that's what I will do anyway. Now everyone can still have wet dreams about a new compiler.......but it's time to get back down to earth Yeah basically when you work for such large scale companies they basically own your soul and even the air you breath.
|
|
|
Logged
|
|
|
|
Josh @ Dreamland
|
|
Reply #12 Posted on: June 29, 2014, 12:19:11 pm |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
I had to file some paperwork so that I am able to freely contribute code to this project. It's to make sure personal projects don't compete with existing Google products in a way that would cause a conflict of interest. Apparently the review board found that a massive game design platform was far enough from mainstream Google to not warrant concern, but they advise me to contact them again if ENIGMA grows closer into Google territory. I have no idea how this would happen, considering game design is an extremely inclusive field as it is. They probably just say that to everyone.
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
|
Josh @ Dreamland
|
|
Reply #14 Posted on: June 30, 2014, 07:27:11 am |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
I forgot we maintained a search engine, for a minute, there.
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
|