Skip to main content

News

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

0 Members and 21 Guests are viewing this topic.
  • DaVince
  • [*][*][*][*][*]
  • Administrator
  • Used Sphere for, like, half my life
Re: minisphere 1.0.9
Reply #300
Done. I also explained how I think this would work best while keeping it simple, in my opinion.

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: minisphere 1.0.9
Reply #301
Okay, functions-as-scripts is awesome and I have no idea why I didn't implement it sooner.  As part of my tests of SetDefaultPersonScript I wrote this bit of tomfoolery:

Code: (javascript) [Select]
SetDefaultPersonScript(SCRIPT_ON_ACTIVATE_TOUCH, function() {
food = GetCurrentPerson();
if (GetInputPerson() == 'maggie' && food != 'robert') {
new Scenario()
.playSound('Munch.wav')
.run();
DestroyPerson(food);
}
});


So much nicer than using a string for that; you don't get syntax highlighting for code in strings. :P  Also, yes: minisphere has SetDefaultPersonScript.  Sphere 1.5 apparently has it as well (I didn't think it did, but no unknown identifier errors when I call it), however it appears to be broken there as my test above didn't work in vanilla.  It works perfectly in minisphere. :D  So much eatiness...

Edit: Well, that explains that then.  Apparently Sphere's implementation of default person scripts is only partial: It only ever calls the default script for ON_CREATE, none of the other default person scripts are ever touched.  How did such an incomplete implementation like that ever make it into the official 1.5 release? ???
  • Last Edit: April 13, 2015, 02:10:57 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.9
Reply #302
Well, the next release is coming along.  This one is taking longer than usual since I want to get all the wrinkles ironed out first, as I'm planning for 1.0.10 to be the last 1.0 release before I start working on a few bigger changes for minisphere 1.1 (FollowPerson enhancements, config.exe...).

I finally fixed an audio deadlock bug that's been plaguing me since upgrading Allegro a few releases ago.  I assume nobody else ran into it as I received no bug reports of the sort, which I suppose is a good thing.  Here's what the changelog for 1.0.10 looks like thus far:

Code: [Select]
v1.0.10 - 
- Fixes IsKeyPressed() not recognizing modifier keys on right side of
  keyboard (#20)
- Improves SetPersonFrame compatibility (out-of-range frame is now
  wrapped instead of throwing an error)
- Fixes joystick assert error when running minisphere in OS X. (#19)
- Fixes wrong direction being rendered for 4-direction person sprites
  moving diagonally
- Fixes random deadlocks when playing sounds


So quite a few small but important fixes here.

Oh, also, @Radnen: Did you ever test out the SetPersonFrame fix I posted on GitHub?  I was waiting on you to test it before I merged it into master.
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: minisphere 1.0.9
Reply #303

Oh, also, @Radnen: Did you ever test out the SetPersonFrame fix I posted on GitHub?  I was waiting on you to test it before I merged it into master.


Yeah I saw it, I've literally had no time to test it. I'll test later today, sorry for the wait.
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.9
Reply #304
New plan for v1.1: a native x64 Windows build.  Now that I can compile Allegro myself on Windows, there's little stopping me from doing this. :)
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

Re: minisphere 1.0.9
Reply #305
It's always best to compile your dependencies yourself on Windows :)

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: minisphere 1.0.9
Reply #306

Oh, also, @Radnen: Did you ever test out the SetPersonFrame fix I posted on GitHub?  I was waiting on you to test it before I merged it into master.


Yes, it fixed it. Also, minisphere is too much like sphere 1.5 in that it has the same animation bug that future boy nil fixed. You notice it in my blockman game when picking up bushes, rockets, etc. It has a glitchiness due to the last frame not being respected (when the last frame is met, make sure to go through it entire delay stack before switching over to frame 0).
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.9
Reply #307
What exactly is the bug?  Odd that I would have replicated it, as I made sure to always initialize the delay when switching frames.  There must be oddities with the animation setup that make it easy to screw up...
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
Re: minisphere 1.0.9
Reply #308
Hm, I think I found the "bug".

Blockman: 5 frames (excluding east/west which have 4)
Held object: 4 frames

SetPersonFrame() now correctly modulus-wraps the frame index, HOWEVER GetPersonFrame() returns the real current frame.  This is the source of the problem.  To illustrate:

Suppose Blockman is currently on the fourth frame of his animation:

  • GetPersonFrame("hero") returns 3.  You pass that to SetPersonFrame() to set the frame of the held object to match.  3 % 4 == 3.  Good so far.

  • Blockman advances to the fifth frame; 4 % 4 = 0, which is still correct.

  • Blockman has gone through all 5 frames and starts the cycle over; GetPersonFrame() now returns 0.  0 % 4 = 0.  <-- There's your issue.



Not really sure how FBN would have "fixed" this, as I wouldn't consider it a bug in the first place. ???
  • Last Edit: April 14, 2015, 11:09:15 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.9
Reply #309
It's with QueuePersonCommand and COMMAND_ANIMATE.

Say you have 5 frames at 8 delay frames each, you can loop through like this to animate a direction:
Code: (javascript) [Select]

for (var f = 0; f < 5; ++f) {
    for (var d = 0; d < 8; ++d) {
        QueuePersonCommand(COMMAND_ANIMATE);
    }
}


You'll notice in Sphere 1.5 you get a strange glitch in the animation where f == 4, we are at frame 0 for 8 frames. In Sphere 1.6 when f ==4, it correctly animates frame 5 for 8 frames.
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.9
Reply #310
minisphere's COMMAND_ANIMATE implementation looks like this:

Code: (c) [Select]
switch (command) {
case COMMAND_ANIMATE:
    person->revert_frames = person->revert_delay;
    if (person->anim_frames > 0 && --person->anim_frames == 0) {
        ++person->frame;
        person->anim_frames = get_sprite_frame_delay(person->sprite, person->direction, person->frame);
    }
    break;
// ...
}


And for good measure, get_sprite_frame_delay:
Code: (c) [Select]
int
get_sprite_frame_delay(const spriteset_t* spriteset, const char* pose_name, int frame_index)
{
    const spriteset_pose_t* pose;
   
    if ((pose = find_sprite_pose(spriteset, pose_name)) == NULL)
        return 0;
    frame_index %= pose->num_frames;
    return pose->frames[frame_index].delay;
}


Looking at this code, I don't understand why this is happening, but I'm rather tired at the moment.  I'll have to investigate properly in the morning.
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: minisphere 1.0.9
Reply #311
Are you looking at Sphere 1.5's source or 1.6's? I'd compare the two to see what he did...
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.9
Reply #312

Are you looking at Sphere 1.5's source or 1.6's? I'd compare the two to see what he did...


I have the one from sphere-group on GitHub, I assume that's 1.6?  That's what I've been using as reference this whole time.
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: minisphere 1.0.9
Reply #313
I thought the github branch had branches for 1.5/1.6, but to me it seems to be all of 1.6. Maybe that code is the corrected version? But your engine still has the Sphere 1.5 animation bug. Hmm...
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.9
Reply #314

...but to me it seems to be all of 1.6.

I'm 99% sure that Sphere-Group/Sphere is 1.6, with some more work done after the official 1.6 beta binaries were made. Well, plus the work Raahkin and I did to make it work again on OS X and Linux, respectively. It's got the particle engine, the new sound effect object, and some other secret new stuff like the zlib API that shouldn't be in 1.5.