Skip to main content

News

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

0 Members and 12 Guests are viewing this topic.
Re: miniSphere 4.5.11
Reply #1590
Yes, that's what I meant because doing
Code: (javascript) [Select]

while(someCondition)
    (new Sound("file.ogg")).play();

isn't very effective :P

  • Rhuan
  • [*][*][*][*]
Re: miniSphere 4.5.11
Reply #1591

Yes, that's what I meant because doing
Code: (javascript) [Select]

while(someCondition)
    (new Sound("file.ogg")).play();

isn't very effective :P
Hence my sound queue...

Code: [Select]
function SoundEffect(filename)
{
  this.queue = [LoadSound(filename)];
  this.name = filename;
}

SoundEffect.prototype.play = function()
{
  if(this.queue[this.queue.length-1].isPlaying()==false)
  {
    this.queue.unshift(this.queue.pop());
    this.queue[0].stop();
  }
  else
  {
    this.queue.unshift(LoadSound(this.name));
  }
  this.queue[0].play();
}

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: miniSphere 4.5.11
Reply #1592
The latest GitHub master implements the Sphere 1.5 SoundEffect API.  SE_SINGLE is not yet implemented (it's treated as SE_MULTIPLE regardless of which constant you pass in), but otherwise all the functions should be present.  (SE_SINGLE isn't that difficult to implement, but requires some internal refactoring, so I held off on including it for now.)
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: miniSphere 4.5.11
Reply #1593
Update to above: SE_SINGLE sound effect mode is now implemented.

The only part of the v1 SoundEffect API I didn't implement is CreateSoundEffect(), mainly because it wasn't clear to me even after reading the Sphere 1.x source, exactly what the byte array is expected to contain.  Raw waveform data?  The verbatim contents of an audio file?  Some other format?  Sphere just seems to pass the byte array data to Audiere as-is, and I don't know enough about how Audiere works internally to divine what happens from there.
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Rhuan
  • [*][*][*][*]
Re: miniSphere 4.5.11
Reply #1594
Good work.

Also - I've been doing some more fiddling/testing, the surface blend modes don't seem to work - generally you get the same resultant image whatever you set before drawing.

(I've been trying to lighten an image and then draw it using surface_object.blitMaskSurface(surface, x, y, mask [, mask_blend_mode]) and the ADD drawing mode - but it gives me the same result as the BLEND drawing mode i.e. can only make the image darker, giving it 255,255,255 returns the original image, anything else darkens it.

I looked into your code and my best guess is that al_draw_tinted_bitmap ignores blend modes and a different function is needed.

I've been able to script a work around in sphere by setting the blend mode for the surface to ADD then drawing a rectangle over the top of the image - this gives the expected effect.

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: miniSphere 4.5.11
Reply #1595
Thanks, that looks like a bug.  Sphere 1.x uses the blend mode passed in as a parameter:
https://github.com/sphere-group/sphere/blob/master/sphere/source/engine/script.cpp#L12878-L12882

Wheres miniSphere incorrectly uses the blend mode set using .setBlendMode() instead:
https://github.com/fatcerberus/minisphere/blob/v4.5.11/src/minisphere/vanilla.c#L4277-L4280
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Rhuan
  • [*][*][*][*]
Re: miniSphere 4.5.11
Reply #1596

Thanks, that looks like a bug.  Sphere 1.x uses the blend mode passed in as a parameter:
https://github.com/sphere-group/sphere/blob/master/sphere/source/engine/script.cpp#L12878-L12882

Wheres miniSphere incorrectly uses the blend mode set using .setBlendMode() instead:
https://github.com/fatcerberus/minisphere/blob/v4.5.11/src/minisphere/vanilla.c#L4277-L4280
I tested that and that wasn't a sufficient fix - adding in setBlendMode(ADD) doesn't fix the issue.

I then read about al_draw_tinted_bitmap on the allegro wiki and it sounds like it ignores blend modes and always multiplies the colours.

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: miniSphere 4.5.11
Reply #1597
Ah, I see, it specifies how to combine the mask color with the bitmap, whereas the surface blend mode specifies how the final image is combined with the surface contents.  I think I didn't implement that because, as you say, Allegeo doesn't have a way to do it.  It might be possible to do it with shaders, not sure.

I posted a feature request on the Allegro repository:
https://github.com/liballeg/allegro5/issues/768

So we'll see what happens.
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Rhuan
  • [*][*][*][*]
Re: miniSphere 4.5.11
Reply #1598
You can get the same effect by setting the blend mode to Add then drawing both the image and a rectangle with the colour you wanted as your mask onto the surface; so assumedly you could put that into the source though I (or any other game developer using sphere) can obviously do it in the JS - just depends if you're shooting for 1-1 with sphere 1.5.

  • DaVince
  • [*][*][*][*][*]
  • Administrator
  • Used Sphere for, like, half my life
Re: miniSphere 4.5.11
Reply #1599
Coming back to MiniSphere for the first time in a while, I find that the PPA does not want to function any longer. I'm running Ubuntu 17.04 and getting the following error when trying to install MiniSphere:

Code: [Select]
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
minisphere : Depends: liballegro-acodec5.0 (>= 2:5.0.6) but it is not installable
              Depends: liballegro-audio5.0 (>= 2:5.0.6) but it is not installable
              Depends: liballegro-dialog5.0 (>= 2:5.0.9) but it is not installable
              Depends: liballegro-image5.0 (>= 2:5.0.6) but it is not installable
              Depends: liballegro5.0 (>= 2:5.0.7) but it is not installable
E: Unable to correct problems, you have held broken packages.


Edit: seems to be the case because Ubuntu 17.04 offers Allegro 5.2 only. I'll just compile from source for now.
  • Last Edit: June 03, 2017, 12:36:36 pm by DaVince

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: miniSphere 4.5.11
Reply #1600
Yep, known issue, the last supported Ubuntu version is currently Xenial: https://github.com/fatcerberus/minisphere/issues/139

The Allegro packages include the version number in their package IDs, so the upgrade to 5.2 broke the dependencies.  And Yakkety stupidly removed the 5.0 packages.  Supporting 5.2-only means I give up support for 16.04 and earlier, which since that's the current LTS release, isn't really an option.  So I have to maintain two separate builds for Linux, one for Allegro 5.0 and one for 5.2, and I've been too lazy to do it.  I need to get on that ASAP. :)

What you can do for now is install Allegro 5.2 PPA (ppa:allegro/5.2) and build from source (git checkout v4.5.11 if you want stable), then the usual "sudo make install" to install it.
  • Last Edit: June 03, 2017, 12:41:15 pm by Fat Cerberus
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 4.5.11
Reply #1601
That's exactly what I did. Running just fine. Maybe you should add a little note to your release, though... ;)

  • DaVince
  • [*][*][*][*][*]
  • Administrator
  • Used Sphere for, like, half my life
Re: miniSphere 4.5.11
Reply #1602
I encountered another unimplemented legacy Sphere function: GradientLine(). One of the old Fallacious Gear demos seems to be using it for its battle system.

Edit: casiotone's Final Fantasy V engine also quits when starting a battle, with the error message "scripts/Battle.js:437 RangeError: area of effect extends past image (0,0,400,20)".

Also, just a random thought, but how feasible would it be to have MIDI support using fluidsynth + perhaps even custom loaded soundfonts? That would be kind of neat, but maybe a little complex?
  • Last Edit: June 03, 2017, 01:27:56 pm by DaVince

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: miniSphere 4.5.11
Reply #1603
GradientLine should be easy, I already implement it as part of the prim module:
https://github.com/fatcerberus/minisphere/blob/master/assets/system/modules/prim.js#L79-L98
So it's just a matter of adapting that code to C.

Where's the FFV engine?  I couldn't find it in the Downloads drive.  Based on the error message, it seems to be related to either Surface#applyColorFX() or .applyLookup(), so it's possible that Sphere 1.x clamps the coordinates you give it rather than checking them strictly (which in hindsight, seems to be the norm for v1 APIs).  I'll double-check the correct behavior and make it compatible.

MIDI support is possible, would be a bit more work than the formats currently supported because for those I can just tell Allegro to load the file.  Here I would have to decode the file myself.  Now that all the mp3 patents have expired and the format is public domain, it might be a good time to look into implementing that too (although the lack of non-[L]GPL decoders may get in the way of that).
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: miniSphere 4.5.11
Reply #1604
Huh, so what I found out from looking at Sphere 1.x code is that applyLookup() throws a hard error if the rectangle extends outside the image (miniSphere does the same), HOWEVER applyColorFX does some kind of clamping instead:
https://github.com/sphere-group/sphere/blob/master/sphere/source/common/Image32.cpp#L315-L338

I don't really like that clamping behavior because it shifts the gradient, but I have to emulate it if I want full compatibility. :-\
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub