Skip to main content

News

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

0 Members and 20 Guests are viewing this topic.
  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: minisphere 1.0.6
Reply #255

@Radnen: Curse you and your evil ways! :P  Apparently you delete persons in a command generator script?  minisphere doesn't particularly appreciate entities being pulled out from under it, and it leads to all sorts of random crashes.  Should be fun to fix...


I guess, I don't remember. I try not to do that in a command generator. In fact I never aim to use it because in Sphere1.5 it's really slow performing.

A pattern I do use is this:

1. I set person to a death animation.
2. I queue animation commands.
3. I queue a person script that destroys the person.

That way the death script is cleanly executed when the animation ends. Otherwise I'm set using an update script, continuously checking for a final state and then destroying the person, making sure I don't accidentally destroy an already destroyed person (which ought to just do nothing, come to think of it).
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.6
Reply #256
That's what's crashing it, the person script destroys the entity but the engine tries to read the next command and crashes because the underlying person structure has already been freed.  I didn't anticipate this eventuality, so minisphere doesn't handle it very well.
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: minisphere 1.0.6
Reply #257
Oh, I see what you mean by command generator, I use the person command queue. I've never been a fan of the GENERATE_COMMANDS command, I'm not sure what it does and SSFML does not have that implemented. I say I'm not sure because it slows down a lot when you put logic in it, like random movement. I found that an update script that iterates over the entities on the map is a 1000 times faster than using the GENERATE COMMANDS script area.

So here is my feature request: Does minisphere's executable icon change? I'm not sure how that works, but is there a way you can set up a build script such that you can build minisphere with your own icon? It's not something I imagine most people doing, but it could be great.

I found minisphere to be way easier than Sphere 1.6 to build, less dependencies and less odd code to go wrong.
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: minisphere 1.0.6
Reply #258
We should, at some point, try to document what all these commands really do. Some are self explanatory, but others like GENERATE_COMMANDS don't really make sense to me. Even COMMAND_WAIT doesn't seem clear to me.

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: minisphere 1.0.6
Reply #259

We should, at some point, try to document what all these commands really do. Some are self explanatory, but others like GENERATE_COMMANDS don't really make sense to me. Even COMMAND_WAIT doesn't seem clear to me.


COMMAND_WAIT you insert into the command queue if you want the entity to not do anything for one frame, but otherwise still be under programmatic control.  As for the command generator, the engine calls it for a person on any frame that there is nothing else in that person's queue. Youre supposed to use it to implement automatic movement, e.g. for NPCs.  As for why it's so slow, I have a theory that sphere recompiles it every time it's called.  It should be fast in minisphere since I pre-compile all person scripts.
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.6
Reply #260
ON_GENERATE_COMMANDS is used to run commands on each frame. (I used it to make people walk and look around in Pokemon GS/SS.)
COMMAND_WAIT is used to add a short pause where a character does nothing for a frame. Useful when you're inputting a list of commands and want to run it all (like walk north, wait a bit, then walk back south). I used that one in GS/SS too.

I wasn't exactly *good* back when I worked on that game, of course. :P But I think COMMAND_WAIT has its uses. ON_GENERATE_COMMANDS, not so much.

...Ninja'd.

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: minisphere 1.0.6
Reply #261
The perks of making a compatible engine: you learn how the original works inside and out. :P  up to and including all the annoying little idiosynchrosies that I nonetheless have to emulate to avoid breaking things.  I'm not shy about fixing outright bugs though.  For that reason minisphere will probably never be 100% compatible with Sphere, but that's fine.  If at the end of the day I'm only at 90% parity with vanilla due to bug fixes, I'll take it.

Of course it probably helps that I have a knack for picking up on little subtleties.  Great example being, it didn't take me long at all to figure out that Sphere doesn't destroy entities created before a MapEngine() call, which I believe bit Radnen during SSFML development.  And that even made sense to me: the flag is called `destroy_with_map`, and no map is destroyed in a map engine start since none is loaded yet.

Honestly I think I've had more fun with this project than if I just made a whole new, unrelated engine, which was my original plan.  Getting to see how Sphere works under the hood was worth it all by itself. :)

As for command generator scripts, I wouldn't give them up for anything.  It helps keep each entity self-contained without having to feed NPCs movement commands from somewhere else in the code (the update script, for instance).  Any time the engine offers to manage something for me, I'll jump at the chance.  Less bookkeeping to bloat my own code that way. :P
  • Last Edit: April 06, 2015, 09:10:22 pm 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.6
Reply #262
I just added the Allegro libs to the repo.  This makes it ridiculously simple to build the engine on Windows as everything needed is now included--you just need to provide MSVC, which is also simple thanks to VS Community.  One of the many benefits of having all your dependencies be MIT/zlib licensed--you can just throw the files in and not have to worry about licensing issues. :)

Obviously there are no issues on Linux or OS X thanks to the SCons script, but I know compiling in Windows can be hell (and I develop in Windows, so that's saying something! :P), so doing this will make everyone's life a lot easier.
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: minisphere 1.0.6
Reply #263
There is no NuGet for C projects? If so, I guess Allegro isn't there... I just took dependencies out of Sphere Studio and into NuGet packages to decrease the filesize of the git repo. Too bad though since it's been logged in the commit history, so those old DLL files will truly stay in it forever. :/
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.6
Reply #264
No Allegro on NuGet, I've already checked.  That was the first thing I tried, but no such luck.  No DLLs in mine though, just about 13MB worth of .lib files... Oh well.  Note that the debug build is static-linked now as well.  Maybe I'll think about adding console logging to it now...

Edit: Wait, no, make that 5MB.  Not too bad, then.  Not sure where I got 13 from...
  • Last Edit: April 07, 2015, 02:42:06 am by Lord English
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.6
Reply #265

Of course it probably helps that I have a knack for picking up on little subtleties.  Great example being, it didn't take me long at all to figure out that Sphere doesn't destroy entities created before a MapEngine() call, which I believe bit Radnen during SSFML development.  And that even made sense to me: the flag is called `destroy_with_map`, and no map is destroyed in a map engine start since none is loaded yet.


Actually, it seems like there's a bug regarding not destroying persons: when Sir Boingers switches to the next map, all the entities from the previous map are spawned at the entry point location. Which means I get to see this when starting level 2. Those objects (the flame, blue pad and spike ball above it) are all from level 1.



This causes "person does not exist" issues down the line (like when dying/restarting the level).

Edit: by the way, you can experience this quickly for yourself by pressing F7 (the skip level key). It accumulates with each level.

Edit 2: mp3 is not supported, the engine crashes with a playback error. Is that right?
  • Last Edit: April 07, 2015, 08:54:19 am by DaVince

  • DaVince
  • [*][*][*][*][*]
  • Administrator
  • Used Sphere for, like, half my life
Re: minisphere 1.0.6
Reply #266
Okay, I've found out what the "Invalid base value" error was. I suspect that my code had a bug in it - namely that it would try to access an array inside an array, except the outer array would sometimes be undefined. What I mean is that there's a possibility that x in this.options[ x ][ y ] might have been undefined. Original Sphere seemed to be able to handle this.options[undefined][0] but Duktape doesn't. (And really, why should it? :) )

After adding this line to my code, everything is fine again:
Code: [Select]
if (this.options[x] == undefined) continue;
  • Last Edit: April 07, 2015, 08:17:35 am by DaVince

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: minisphere 1.0.6
Reply #267
Is it bad that every time someone reports a major bug I rub my hands together excitedly in a "Let's get to work!" kind of way? :P

First, the simple one: That array thing is quite odd.  Here's a little test case:
Code: (javascript) [Select]
var hippo = [ [ "maggie" ] ];
var x, y = 0;
Abort(hippo[x][y]);


This fails in both minisphere and vanilla.  The errors are:
minisphere - TypeError: "invalid base value"
Sphere 1.5 - TypeError: "hippo[ x ] has no properties"

So, not sure what's going on, maybe behavior is different enough between the two engines that x ends up undefined sometimes in minisphere while it never does in Sphere.  I don't know.

As for the persons respawning at the start of the next level, I noticed that myself, but thanks to a lack of testing in Sphere 1.5 I didn't realize it was a minisphere bug--I thought it was a bug in Sir Boingers.  Are you exiting and restarting the map engine when switching levels by any chance?  Because I'm thinking that's what it is--minisphere normally removes transient persons when switching maps just like in Sphere, but this doesn't happen if you stop and restart the map engine.  Apparently it does in Sphere.

Oh and yes, no mp3 support sadly :(.  Allegro apparently doesn't include it, I assume due to licensing issues, and I haven't yet found any addons to re-add support for it.
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.6
Reply #268
Yep, I close and reopen the map engine. It ended up working out better (the map engine only runs when necessary - I can finish a map, run some code, then continue with the next one in a more convenient way). That must be the issue, then.

And my test case doesn't work in regular Sphere either (errors out with "has no properties" too). I'm not exactly sure why my fix worked and the game works fine in regular Sphere.

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: minisphere 1.0.6
Reply #269
I fixed the bug.  Try the latest master.  :D
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub