Skip to main content
Topic: neoSphere 5.10.1 (Read 8514286 times) previous topic - next topic
0 Members and 140 Guests are viewing this topic.

Re: minisphere 1.0.10

Reply #345
Awesome stuff. A way to enable filtering for images would be good.



Re: minisphere 1.0.10

Reply #348
Ah, bilinear filtering for scaling.  That'd be easy enough to add an API function or two for.

Re: minisphere 1.0.10

Reply #349
I just started working on adding constructors for Sphere objects.  I posted an issue on GitHub to track the progress of the implementation.

Re: minisphere 1.0.10

Reply #350
I thought of two other things that I find useful additions to the API. These are additions I added for use by my map engine, so I have an actual use for them as opposed to SetTileName.

RawFile.read(), with no argument, reads the entire file.
RawFile.readString() works the same as read, but returns a string. This can save on memory usage, when otherwise an ArrayBuffer or ByteArray would have to be garbage collected. Until then, you have at least two entire copies of the read in memory.

Re: minisphere 1.0.10

Reply #351

I thought of two other things that I find useful additions to the API. These are additions I added for use by my map engine, so I have an actual use for them as opposed to SetTileName.

RawFile.read(), with no argument, reads the entire file.
RawFile.readString() works the same as read, but returns a string. This can save on memory usage, when otherwise an ArrayBuffer or ByteArray would have to be garbage collected. Until then, you have at least two entire copies of the read in memory.


RawFile.readString I probably would have done myself at some point.  I already did that for sockets, in fact.  :D  I like the idea of .read() with no args slurping the whole file, it saves the step of getting the length first.  Thanks!

As for garbage collection, do note that that's not as big an issue in minisphere as Duktape's primary GC method is refcounting.  It only resorts to mark and sweep in case of circular refs.

Re: minisphere 1.0.10

Reply #352
Let me just say how awesome it is to be able to do this:

Code: [Select]
var red = new Color(255, 0, 0);
Abort(red instanceof Color);  // true!


You have no idea how much and how often I wished to be able to do that in Sphere.  Instead all we got was the clunky toString() methods for type checking.

;D

instanceof works with the old-style methods too!

Re: minisphere 1.0.10

Reply #353
So I noticed a missing effect in the Sir Boingers intro screen: the backgrounds are supposed to fade in and out to and from black, but they're not. They're scrolling and a new background is shown without any transition whatsoever.

The fade effect is performed by overlaying a fullscreen black rectangle that changes its opacity - code at line 465-481 in start.js. For some reason this doesn't seem to render in minisphere (and I made sure to compile the latest version - works full speed even on an old laptop, good work!)

Re: minisphere 1.0.10

Reply #354
Thanks for the report, I'll look into it. :)

Re: minisphere 1.0.10

Reply #355
Well, this has been a massive undertaking, but definitely worth it.  In minisphere 1.1, all Sphere objects will have proper constructors and, where applicable, actual properties in addition to the old-style get/set methods.  I even took some cues from TurboSphere when implementing a few of the constructors. :D  Amazingly, the engine executable hasn't grown much, if at all.  The 32-bit engine is still 1.5MB and 64-bit 1.75MB.  Pretty awesome.

I'll be honest though, if I had tried to implement things this way from the start, I can guarantee it would have been a failure.  minisphere 1.0 had to be what it was, a drop-in Sphere 1.5 replacement, legacy warts and all.  It gave me something to work towards, the entire existing Sphere catalog.  If I had gone for the modern approach right out of the gate, it wouldn't have been compatible with anything and would have gotten very boring very fast since the only thing I would have had is, at best, a bunch of contrived tests.  But now that I have that compatibility, I can freely build on it to create something great. ;D

 

Re: minisphere 1.0.10

Reply #356

So I noticed a missing effect in the Sir Boingers intro screen: the backgrounds are supposed to fade in and out to and from black, but they're not. They're scrolling and a new background is shown without any transition whatsoever.

The fade effect is performed by overlaying a fullscreen black rectangle that changes its opacity - code at line 465-481 in start.js. For some reason this doesn't seem to render in minisphere (and I made sure to compile the latest version - works full speed even on an old laptop, good work!)


Apparently the copy of Sir Boingers I have doesn't have this effect?  I have the one from the Downloads repo, and the lines in question look like this:
Code: (javascript) [Select]
      while (AreKeysLeft()) key = GetKey();

      if (key != undefined)
      {
        if (key == KEY_BACKSPACE)
          playername = playername.slice(0, playername.length-1);
        else if (key == KEY_ENTER && !lastpressed && playername != "")
          break;
        else if (playername.length <= 20)
          playername += GetKeyString(key, shift);
      }

      key = "";

      if (IsAnyKeyPressed()) lastpressed = true;
      else lastpressed = false;
      if (IsKeyPressed(KEY_SHIFT)) shift = true;


Input code.  I did a search for all Rectangle() calls in start.js too, they all used a constant color.  No ApplyColorMask() calls either.  This effect must be a recent addition.

That said, drawing a full-screen translucent rectangle should definitely work, short of a regression in the primitives code, which I don't think I've touched in quite a while...

Re: minisphere 1.0.10

Reply #357
Oh! I never noticed that Boingers 2.0/2.1 isn't on the repo. I'll post it soon. The game's expanded a fair bit!
Edit: now on the repo and http://boingers.tengudev.com/

Edit: also, lines 459-473. 472 especially. I referenced line numbers from my WIP next version, silly me.

Re: minisphere 1.0.10

Reply #358
Yeah, I see the Rectangle() call.  I added some prints before the primitive call and used a debug build of minisphere (which shows the console window), the alpha values are correct, but the Rectangle apparently isn't being rendered.  Definitely something weird going on here.

Re: minisphere 1.0.10

Reply #359
So I took a closer look at the print() output and figured out the issue: The alpha values on your mask rect are negative.  minisphere clamps colors to [0-255].  Sphere modulo's them, which I chose not to emulate because it screws up color tweening.  You can fix the effect by changing the alpha math to ensure the alpha is always in the range of [0-255].  It's not a bug, it's a feature! ;)

Also, tip: If you put a 32x32 icon.png in the project root, minisphere will use it for the game's taskbar icon. :)