Skip to main content

News

Topic: neoSphere 5.9.2 (Read 522290 times) previous topic - next topic

0 Members and 16 Guests are viewing this topic.
  • DaVince
  • [*][*][*][*][*]
  • Administrator
  • Used Sphere for, like, half my life
Re: minisphere 1.0.4
Reply #210
After some research, it seems that -lm needs to be added at the end of the gcc linker command. But I'm not sure how to do this with these scons files.

Edit: figured it out. I added a line after line 40 in SConscript with:
Code: [Select]
"m"


And now it's compiled. I like that you're showing a file dialog to ask for the sgm!
  • Last Edit: April 04, 2015, 05:35:10 pm by DaVince

  • DaVince
  • [*][*][*][*][*]
  • Administrator
  • Used Sphere for, like, half my life
Re: minisphere 1.0.4
Reply #211
I tried running Sir Boingers. It ran the main menu just fine (after changing all const keywords to var and resaving some scripts as UTF-8).

There is a bug, however: when I try entering the game, or other parts of it, it errors out. Except since I use the space bar, the window closes almost immediately and I can't read the error message at my leasure. Could you perhaps add a short delay (like half a second) before reading the space bar input, or only start checking for it once the last in-game keypress has been released?

Also, after taking a quick screenshot while the error displayed, it turns out it couldn't load the map. (default/tutorial.rmp). Do you know what's up with that? Is it because it's in a subfolder (maps/default/tutorial.rmp)? And do you think you could output the error to the console too?

Edit: just noticed it plays back the menu sound effects only once, too. Is it because I'm stopping the last instance and then immediately playing it back again, perhaps?
  • Last Edit: April 04, 2015, 05:50:12 pm by DaVince

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: minisphere 1.0.4
Reply #212

I tried running Sir Boingers. It ran the main menu just fine (after changing all const keywords to var and resaving some scripts as UTF-8).

There is a bug, however: when I try entering the game, or other parts of it, it errors out. Except since I use the space bar, the window closes almost immediately and I can't read the error message at my leasure. Could you perhaps add a short delay (like half a second) before reading the space bar input, or only start checking for it once the last in-game keypress has been released?

Also, after taking a quick screenshot while the error displayed, it turns out it couldn't load the map. (default/tutorial.rmp). Do you know what's up with that? Is it because it's in a subfolder (maps/default/tutorial.rmp)? And do you think you could output the error to the console too?

Edit: just noticed it plays back the menu sound effects only once, too. Is it because I'm stopping the last instance and then immediately playing it back again, perhaps?


Which OS is this?  If anything other than Windows, I'm impressed you got this far, it means I did something right! ;D  Still, I'd like to diagnose some of this stuff.  I'll go get the game in question and see what I can do.

As for the spacebar to close the error, I originally made it so you had to press Escape to close it, but added the spacebar option for convenience.  Maybe I should go back to just [Esc] to close out.
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: minisphere 1.0.4
Reply #213

Also, after taking a quick screenshot while the error displayed, it turns out it couldn't load the map. (default/tutorial.rmp). Do you know what's up with that? Is it because it's in a subfolder (maps/default/tutorial.rmp)? And do you think you could output the error to the console too?

Edit: just noticed it plays back the menu sound effects only once, too. Is it because I'm stopping the last instance and then immediately playing it back again, perhaps?


Figured out the map issue after stepping through the map load function with the debugger a few times.  The map itself loads just fine, it's actually the tileset that causes the load failure.  Good call on the subdirectory thing: It turns out the tileset filename stored in the RMP file is relative to the directory containing that map--whereas minisphere assumes it's always relative to <gamedir>/maps.  So yeah, having the map in a subdirectory tripped it up.  Shouldn't be too difficult to fix.  1.0.5, here we come!

As for the sounds, I have noticed a few issues with sound myself, but I haven't been able to pin down the cause yet.  Either I'm doing something wrong or Allegro's audio routines are glitched.  I'm thinking more the former, though... ;)  The sound stuff was actually one of the first things I implemented way back in the beginning of minisphere's development (yes, my priorities are odd, don't judge me! :) ), so the code could probably use another go-over.

Edit: So apparently minisphere doesn't like playing the same sound more than once, despite the explicit al_seek_audio_stream_secs(stream, 0.0); in js_Sound_stop().  Further investigation will be needed.  I didn't notice this before because all my sound-playing in Specs is done through Scenario's built-in playSound scenelet, which loads sounds anew each time they're played.  I never bothered to implement caching for that scenelet...

Edit2: Damn it, best I can tell it's a race condition in Allegro.  This is my working theory: Allegro apparently runs the stream in a separate thread. When you call the stream functions, it queues the operation to be done on the worker thread.  So even though I've queued a rewind, I also call play immediately afterwards.  I'm guessing Allegro processes the play operation before the seek, so it immediately stops again as it's still at the end of the stream.

Edit3: Aaand I was right.  When the stream ends "naturally" (manual starts and stops don't seem to affect it), the stream feeder thread terminates and never gets restarted unless you recreate the stream.  Looks like it was an Allegro bug after all!
  • Last Edit: April 04, 2015, 11:29:49 pm by Lord English
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: minisphere 1.0.4
Reply #214
Big problem. I can't run Blockman in it because it has trouble parsing all the code files. I got it to stop spewing syntax errors due to my use of const, but now it's giving me a 'not callable' issue that I cannot resolve.

Basically the minimal use case looks like this:
Code: (javascript) [Select]

function SuperClass() {
this.weight = 5;
}

function SubClass() {
SuperClass.call(this);
}

SubClass.prototype = new SuperClass(); // ERROR here.

var a = new SubClass();
Abort(a instanceof SuperClass);


The above works 100% in minisphere. Then why the error? In Blockman I use the above pattern on hundreds of files and at some point it starts saying not callable on a myriad of functions using this design pattern. This games runs just fine in Sphere 1.5 and SSFML, but it gives me not callable issues on what are seemingly normal function calls.

I do some tests and try to spout out some info:
Code: (javascript) [Select]

Abort(FuncInQuestion); // FuncInQuestion() { /*ecma code*/ }
Abort(typeof FuncInQuestion); // function
Abort(FuncInQuestion()); // TypeError: not callable


This happens because the analyzer thought these functions were somehow set to not callable, when in fact they are. I'm not sure if it's a scoping thing either because if it were, the first two tests would fail since the function in question could not be found. So this is really weird indeed.
If you use code to help you code you can use less code to code. Also, I have approximate knowledge of many things.

Sphere-sfml here
Sphere Studio editor here

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: minisphere 1.0.4
Reply #215
Odd, sounds like a Duktape bug.  I could post an issue on the Duktape repo, but I'd need a use case that can reproduce it reliably.  But from the sounds of things I'm guessing you can't reproduce it on command...?
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: minisphere 1.0.4
Reply #216
It's hard when it's a random function call in a many thousand line project. :/

Sometimes it's not just that pattern above but as simple as this:
Code: (javascript) [Select]

function Item() {
    this.inner_item = new Item2(); // not callable error
}


I mean, the Item2() in the example above had been loaded, I can print various qualities about it, but I just can't call it.
  • Last Edit: April 05, 2015, 02:01:44 am by Radnen
If you use code to help you code you can use less code to code. Also, I have approximate knowledge of many things.

Sphere-sfml here
Sphere Studio editor here

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: minisphere 1.0.4
Reply #217
Code: (javascript) [Select]
var Item = function() {
        return function Item() {
                this.weight = 5;
        }
}

var a = new Item();
Abort(a.weight); // undefined


No bug, no ES deficiency, this code is just broken:
Code: (javascript) [Select]
Abort(a); // function Item() {/* ecmascript */}


[forrestgump]And that's all I have to say about that.[/forrestgump] :P
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: minisphere 1.0.4
Reply #218
No, I'm mentally retarded there. But I'm still getting a not callable issue. Don't know what it could be tho.

It should be:
Code: (javascript) [Select]
var Item = (function() {
        return function Item() {
                this.weight = 5;
        }
})();

var a = new Item();
Abort(a.weight); // 5

If you use code to help you code you can use less code to code. Also, I have approximate knowledge of many things.

Sphere-sfml here
Sphere Studio editor here

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: minisphere 1.0.4
Reply #219
By the way: minisphere includes an Alert() function that just throws up a message box without terminating the game.  Might be useful for these little testcases.

edit: also where can I get the latest Blockman?  I have an older copy right now from the Spherical Downloads drive, which is actually one of the games I used for compatibility testing. :-). But that version seems to run just fine, so I'm unable to reproduce this issue with it.
  • Last Edit: April 05, 2015, 03:16:10 am by Lord English
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: minisphere 1.0.4
Reply #220
Oh, and by the way, your whodunnit game works flawlessly since 1.0.1. ;D
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: minisphere 1.0.4
Reply #221
I'll send you a D/L link in a PM since I still don't want this game to be released publicly yet.
If you use code to help you code you can use less code to code. Also, I have approximate knowledge of many things.

Sphere-sfml here
Sphere Studio editor here

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: minisphere 1.0.4
Reply #222
Interesting, I stepped through the internal call code inside Duktape for the offending call, and it successfully gets into the bytecode for constructor.  So this "not callable" error is very baffling, since it actually does call the function...

Dammit, I just figured out: the error is misleading.  I have an error callback that modifies the filename and line number for error messages starting with "not " because otherwise Duktape doesn't report that info for invalid parameters.  The callback uses the info from one step up the call stack, which means the error is actually inside the constructor.  I will keep investigating.

Edit: Yep, I sent us both on a wild goose chase.  I fixed the error callback to pass through "not callable" errors and here's the actual offending line of code:
Code: (javascript) [Select]
this.__defineGetter__("focusedControl", function() { return _focused_control; });


.......... *facepalm*

I'm going to go sheepishly add __defineGetter__/__defineSetter__ polyfills now... :-[
  • Last Edit: April 05, 2015, 10:07:28 am by Lord English
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: minisphere 1.0.4
Reply #223
Well, several fixes (and const removals) later I got it to get to the main menu, but I can't move the cursor or even confirm my selection.  Apparently something's borked with my input routines... which is odd, since input seems to work fine in every other game I've tested.
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • DaVince
  • [*][*][*][*][*]
  • Administrator
  • Used Sphere for, like, half my life
Re: minisphere 1.0.4
Reply #224
I'm on Linux, so nice work getting it to work this far! :)


As for the spacebar to close the error, I originally made it so you had to press Escape to close it, but added the spacebar option for convenience.  Maybe I should go back to just [Esc] to close out.

Nah, then the same problem would occur when the error message displays during an esc key press action. I like this short pause you added better.

Still errors out though. Compiled from latest source (updated "an hour ago").
  • Last Edit: April 05, 2015, 11:48:10 am by DaVince