renderer = renderer !== void null ? renderer : null;
Can I maybe use Link for this?
var cur_stuff = [obj1, obj2];// new_stuff is not ever looped through, preventing the 'creation in same loop' issue// also new_stuff must contain same references to old_stuff, you'll see soon enoughvar new_stuff = [obj1, obj2, obj3]; // here obj2 from cur_stuff added obj_3 (but to new_stuff)// switch out to the array with the new stuffif (changes_made) { // ie: new_stuff.length > cur_stuff.length cur_stuff = new_stuff;}// then you can do deletions like normal, or whatever else you may want to do// it is important that before this step new_stuff at least contains the cur_stuffif (deletions_made) { cur_stuff.splice(deletion, 1);}// then reset new_stuff to do the process over again in case there are changes// if there were no changes made, well the worst is nothing (cur = new) and it's like nothing happened.new_stuff = shallow_copy(cur_stuff); // we need a new identity, but same object references// feel free to optimize this, but I think the shallow_copy above is the real trick here. You want to work on the same data, you just want to run an array with elements you are sure are made to be executed during that cycle. I'm sure there are better ways of doing this, but I hope this code here makes for a seamless transition between thread lists behind-the-scenes.
You'll have to come up with a way to do thread locking with semaphores or what-not, or a thread-level dependency resolution system.
Also, my engine is very slow when it runs your game -__-... you're testboxes render at 121FPS on my rig, but on Sphere they are like 600ish(?). Why must you draw to surfaces like that!?
Yeah, I should say SSFML only works up until it asks for player key input (unless you use a workaround for now).Quote from: Lord English on April 04, 2014, 01:15:03 amCan I maybe use Link for this?Yeah, but it doesn't make algorithm design a silver bullet. You'll have to come up with a way to do thread locking with semaphores or what-not, or a thread-level dependency resolution system. Or I guess you can have two arrays, one for the in-traversal array and the other for what to replace it with when finished. You just swap between the arrays like so when changes get made:
Code: (javascript) [Select]var cur_stuff = [obj1, obj2];// new_stuff is not ever looped through, preventing the 'creation in same loop' issue// also new_stuff must contain same references to old_stuff, you'll see soon enoughvar new_stuff = [obj1, obj2, obj3]; // here obj2 from cur_stuff added obj_3 (but to new_stuff)// switch out to the array with the new stuffif (changes_made) { // ie: new_stuff.length > cur_stuff.length cur_stuff = new_stuff;}// then you can do deletions like normal, or whatever else you may want to do// it is important that before this step new_stuff at least contains the cur_stuffif (deletions_made) { cur_stuff.splice(deletion, 1);}// then reset new_stuff to do the process over again in case there are changes// if there were no changes made, well the worst is nothing (cur = new) and it's like nothing happened.new_stuff = shallow_copy(cur_stuff); // we need a new identity, but same object references// feel free to optimize this, but I think the shallow_copy above is the real trick here. You want to work on the same data, you just want to run an array with elements you are sure are made to be executed during that cycle. I'm sure there are better ways of doing this, but I hope this code here makes for a seamless transition between thread lists behind-the-scenes.
Also, my engine is very slow when it runs your game -__-... you're testboxes render at 121FPS on my rig, but on Sphere they are like 600ish(?). Why must you draw to surfaces like that!? The way I particularly coded Sphere SFML, surfaces are very slow when modified in loops (but fast when modified outside of loops so they are only drawn when 'finished') it has to do with a lot of cpu->gpu bottlenecking that I can avoid if I were to go to straight-up hardware surfaces (which well, I'll need a more open GL library to do that first... maybe).
Quote from: Radnen on April 04, 2014, 05:14:56 amYou'll have to come up with a way to do thread locking with semaphores or what-not, or a thread-level dependency resolution system.Out of curiosity...why semaphores?
Quote from: Radnen on April 04, 2014, 05:14:56 amAlso, my engine is very slow when it runs your game -__-... you're testboxes render at 121FPS on my rig, but on Sphere they are like 600ish(?). Why must you draw to surfaces like that!?Some versions of Sphere 1.6 are even faster with surfaces than Vanilla Sphere.