Skip to main content

News

Topic: Making the upgrade to miniSphere (Read 5571 times) previous topic - next topic

0 Members and 2 Guests are viewing this topic.
Making the upgrade to miniSphere
Hi guys. So I recently came back to my Sphere game after a pretty long break (~7.5 years). I haven't been coding anything during this time so it takes me a while to get back but I think I'm starting to get the hang of things.

Anyways, I made my game back then in Sphere 1.5, and now when I got back and tried to upgrade it to miniSphere, I ran into some problems.

There are a number of old 1.5 functions which I used a lot in my code, that now don't work. For example, LoadSoundEffect(), which I changed into LoadSound() to not get an error message , but now whenever I use sound.play(), nothing happens I can only play one sound at a time. Another issue is, whenever I exit the engine, I get a crash message from windows telling me "miniSphere engine has stopped working". There are other things in the code that now just don't seems to work but I won't specify them, and instead I'll just ask, what do I need to learn in order to use miniSphere correctly. As someone who is not a coding expert (switched to sphere from RM2k, learned pretty much everything on the fly from the API and online guides), it feels almost like a different programming language.

I looked in the Sphere 2 API but I just don't know how to use most of what's in there. To use the sound example again, I saw in the API something about a mixer, with some dots and some hashtags and all I could think about is this.

TL;DR: after upgrading to miniSphere I'm back to being a complete noob, where can I learn how to Sphere?

Thanks :)
  • Last Edit: April 16, 2017, 07:02:32 am by East

  • DaVince
  • [*][*][*][*][*]
  • Administrator
  • Used Sphere for, like, half my life
Re: Making the upgrade to miniSphere
Reply #1
Hi! First off, welcome back to Sphere! :D It's always nice to see some interest in the engine return.
The thing with Sound.play() (as opposed to SoundEffect.play) is that if it's the same sound effect, it'll just resume (or effectively do nothing if it was already playing). One way to circumvent this is to stop() the sound and play() it again if it's the same sound, or to make an entirely new instance of LoadSound() and play that back separately.

As for the crash, well, that's a thing for fat cerberus to find out. The engine is never supposed to hard crash.

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: Making the upgrade to miniSphere
Reply #2

it feels almost like a different programming language.


Later RM's used the Ruby programming language, but the latest RM is now using JavaScript, so actually learning Sphere's JS would in fact help you out if you do decide to return to RM someday down the line. :) That said, I don't think RM2K had any programming besides logic statements in the action/event editor which is in fact a form of programming and a feature I would have liked to build into the editor someday (basically it turns RM2K style events from a point-and-click editor into Fat Cerberus's scenario.js scripts).
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

Re: Making the upgrade to miniSphere
Reply #3
... So apparently the crash was because of me using the sound mixer in some very bad way. I managed to fix it and even managed to make the sound effects work using the mixer! I actually love how easy it is to configure now.

I saw you guys speak about JSON in a lot of the miniSphere and Sphere Studio threads here, so I went and learned me a bit of JSON (had no clue what that is at all), and it helped me understand how some of the things in the v2 API work.

But... my game's battle system still doesn't work smoothly in the new engine. Lots of entity-movement stuff that I guess I need to rewrite. So for the moment I'm back at the 1.5 editor, I just don't have enough free time to make the upgrade AND work on the game right now, as much as the new editor looks good and comfy.

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: Making the upgrade to miniSphere
Reply #4
@East: Could you tell me exactly what you did with a Mixer that caused the crash?  In no case should the engine crash outright, even if there's a bug in your own code.  It's a sandbox environment, after all.

I definitely recommend looking into miniRT first, being new to Sphere v2.  The core v2 API is pretty low-level by design and not very beginner-friendly.  miniRT has a bunch of convenience stuff like the music module that make common game-development tasks much easier.
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

Re: Making the upgrade to miniSphere
Reply #5
I couldn't remember exactly what I did that caused the crash so it took me a while to find it, but there it is:

Code: [Select]
var mixer = new Mixer(44,16);
mixer = new Sound;


It causes an error message on test (obviously), and then when I close the engine I get the crash.


  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: Making the upgrade to miniSphere
Reply #6
Seems to be a bug in Allegro where creating a mixer with too low a sample rate succeeds (or at least returns a valid pointer), but then crashes when you later shut down the audio subsystem.  I've reported it.  Thanks!
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: Making the upgrade to miniSphere
Reply #7
@East: You probably already know this by now, but miniSphere 4.6 (release very soon now!) will include the legacy SoundEffect APIs, plus a new Sample class that works with mixers:
https://github.com/fatcerberus/minisphere/blob/master/docs/sphere2-api.txt#L1001-L1047
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Rhuan
  • [*][*][*][*]
Re: Making the upgrade to miniSphere
Reply #8

But... my game's battle system still doesn't work smoothly in the new engine. Lots of entity-movement stuff that I guess I need to rewrite. So for the moment I'm back at the 1.5 editor, I just don't have enough free time to make the upgrade AND work on the game right now, as much as the new editor looks good and comfy.
I'm curious what isn't working right from your battle system running under minisphere, most 1.5 code I've run in minisphere works better in minisphere than under 1.5.