Release Sandora 0.1.1

Discussion in 'Software Releases' started by WaveHack, Mar 12, 2011.

Thread Status:
Not open for further replies.
  1. WaveHack

    WaveHack Still Fresh

    Joined:
    Feb 21, 2011
    Messages:
    45
    Location:
    The Netherlands
    My first contribution, a falling sand game for the Pandora! More specifically, I used the base from SDL Sand (rewrite, pretty much). Here's the readme:

    Snippet from known-bugs.txt:

    https://www.youtube.com/embed/Xv5eje_wo2s?feature=oembed
    Video, showing off. Please note that this is an older video. You can run the game from a prepackaged PND now and it uses a different key layout for selecting particles (see the readme).


    PND Download: http://sourceforge.net/projects/sandora/files/0.1.1/sandora-0.1.1.zip/download


    Source available through SF SVN+SF Files, for those who are interested.


    Would love some feedback on this. :)
     
    Last edited by a moderator: Mar 12, 2011
    Tags:
  2. maplesugarlover

    maplesugarlover Member

    Joined:
    Apr 21, 2010
    Messages:
    377
    Location:
    maine,usa
  3. gruso

    gruso thunderbox

    Joined:
    Feb 28, 2008
    Messages:
    7,461
    Location:
    Sydney, Australia
    Very cool! I was going to report the touchscreen calibration bug, but you already know it. I did find that touching the very top left corner resets it somewhat.


    I was also going to suggest starting off on the Sand (W) setting, so people who don't RTFM (hello!) get to see sand falling straight away instead of what appears to be a grey paintbrush. Then I realised the screen is 'bottomless' until you draw a floor of some kind, so all the sand would fall off the screen. Not sure if the solution here is to give the screen a solid base by default - that may not fit with your vision for the game. Just thought I'd throw that stream of consciousness out there anyway.


    Looking forward to the particle selection GUI. :)


    [edit] Needs gunpowder/exposives. :D I'd love to see creatures in a future version too. Swarms of dots/birds/gnats.
     
    Last edited by a moderator: Mar 12, 2011
  4. WaveHack

    WaveHack Still Fresh

    Joined:
    Feb 21, 2011
    Messages:
    45
    Location:
    The Netherlands
    Hey, thanks for your swift reply. :) I like the idea of having Sand particle as default, I will probably use that for the next release. About particles falling 'off' the screen, it's commonly used with falling sand games and I like it that way. It requires you to actually build some walls and prevents cluttering on the bottom.


    I also forgot to mention that I'll make the brush size adjustable (drawing 'size', basically) and need to fix a little bug where particles loop across the horizontal screen (fall off the right side, re-enter at the left side. That happens if you use a 1d-array for particles).
     
  5. gruso

    gruso thunderbox

    Joined:
    Feb 28, 2008
    Messages:
    7,461
    Location:
    Sydney, Australia
    I just wandered off for a while, came back, browsed some web, then realised Sandora was still sitting there particle-ing away. It made me look at it in a different way, like it's a living desk toy (take that, stainless steel balls on strings). It makes me think that the future GUI should be a popup only, so it can be completely hidden.
     
  6. WaveHack

    WaveHack Still Fresh

    Joined:
    Feb 21, 2011
    Messages:
    45
    Location:
    The Netherlands
    That was my intention. A vertical bar on the right side of the Pandora when you press (and hold) the L button (and a vertical bar on the left side when holding the R button for left-hand users, perhaps).
     
  7. gruso

    gruso thunderbox

    Joined:
    Feb 28, 2008
    Messages:
    7,461
    Location:
    Sydney, Australia
    I suspected you'd be a step ahead of me there. That implementation sounds nice. Perhaps add the same function to d-pad l/r, for when it's sitting flat on a desktop (as mine is now).
     
  8. mcobit

    mcobit Advanced Member

    Joined:
    Jul 28, 2008
    Messages:
    6,755
    This sounds like the sdl touchscreenbug, that was fixed In Scummvm first by djwillis.
     
  9. WaveHack

    WaveHack Still Fresh

    Joined:
    Feb 21, 2011
    Messages:
    45
    Location:
    The Netherlands
    Good idea! Although I'd probably use the B-button for left-handed users. Else they'd have to reach all over the keyboard.
     
    Last edited by a moderator: Mar 12, 2011
  10. cosurgi

    cosurgi http://janek.kozicki.pl/

    Joined:
    Jul 30, 2008
    Messages:
    1,098
    Location:
    Gdansk, Poland
    how did he fix it?
     
  11. cosurgi

    cosurgi http://janek.kozicki.pl/

    Joined:
    Jul 30, 2008
    Messages:
    1,098
    Location:
    Gdansk, Poland
    In my opinion, the water isn't horizontal enough, so I made this patch:



    Code:
    
    diff -ur ./sandora/trunk/src/particle.c ./sandora-new/trunk/src/particle.c 
    
    --- ./sandora/trunk/src/particle.c      2011-03-12 20:48:14.000000000 +0100
    
    +++ ./sandora-new/trunk/src/particle.c  2011-03-12 20:46:43.000000000 +0100
    
    @@ -700,6 +700,82 @@
    
                                            secondParticleDown = &PARTICLE_LEFT(x, y+1);
    
                                    }
    
    
    +                               if(PARTICLE(x, y) == PT_MOVEDWATER) { // special handling of water
    
    +                                       particleType_t *firstParticle2      = NULL;
    
    +                                       particleType_t *secondParticle2     = NULL;
    
    +                                       particleType_t *firstParticleDown2  = NULL;
    
    +                                       particleType_t *secondParticleDown2 = NULL;
    
    +
    
    +                                       particleType_t *firstParticle3      = NULL;
    
    +                                       particleType_t *secondParticle3     = NULL;
    
    +                                       particleType_t *firstParticleDown3  = NULL;
    
    +                                       particleType_t *secondParticleDown3 = NULL;
    
    +
    
    +                                       particleType_t *firstParticle4      = NULL;
    
    +                                       particleType_t *secondParticle4     = NULL;
    
    +                                       particleType_t *firstParticleDown4  = NULL;
    
    +                                       particleType_t *secondParticleDown4 = NULL;
    
    +
    
    +                                       if (ONEIN(2)) {
    
    +                                               firstParticle2      = &PARTICLE_LEFT(x-1, y);
    
    +                                               secondParticle2     = &PARTICLE_RIGHT(x+1, y);
    
    +                                               firstParticleDown2  = &PARTICLE_LEFT(x-1, y+1);
    
    +                                               secondParticleDown2 = &PARTICLE_RIGHT(x+1, y+1);
    
    +
    
    +                                               firstParticle3      = &PARTICLE_LEFT(x-2, y);
    
    +                                               secondParticle3     = &PARTICLE_RIGHT(x+2, y);
    
    +                                               firstParticleDown3  = &PARTICLE_LEFT(x-2, y+1);
    
    +                                               secondParticleDown3 = &PARTICLE_RIGHT(x+2, y+1);
    
    +
    
    +                                               firstParticle4      = &PARTICLE_LEFT(x-3, y);
    
    +                                               secondParticle4     = &PARTICLE_RIGHT(x+3, y);
    
    +                                               firstParticleDown4  = &PARTICLE_LEFT(x-3, y+1);
    
    +                                               secondParticleDown4 = &PARTICLE_RIGHT(x+3, y+1);
    
    +                                       } else {
    
    +                                               firstParticle2      = &PARTICLE_RIGHT(x+1, y);
    
    +                                               secondParticle2     = &PARTICLE_LEFT(x-1, y);
    
    +                                               firstParticleDown2  = &PARTICLE_RIGHT(x+1, y+1);
    
    +                                               secondParticleDown2 = &PARTICLE_LEFT(x-1, y+1);
    
    +
    
    +                                               firstParticle3      = &PARTICLE_RIGHT(x+2, y);
    
    +                                               secondParticle3     = &PARTICLE_LEFT(x-2, y);
    
    +                                               firstParticleDown3  = &PARTICLE_RIGHT(x+2, y+1);
    
    +                                               secondParticleDown3 = &PARTICLE_LEFT(x-2, y+1);
    
    +
    
    +                                               firstParticle4      = &PARTICLE_RIGHT(x+3, y);
    
    +                                               secondParticle4     = &PARTICLE_LEFT(x-3, y);
    
    +                                               firstParticleDown4  = &PARTICLE_RIGHT(x+3, y+1);
    
    +                                               secondParticleDown4 = &PARTICLE_LEFT(x-3, y+1);
    
    +                                       }
    
    +
    
    +                                       // Handle diagonal falling first...
    
    +                                       if        (*firstParticleDown   == PT_NONE) { *firstParticleDown   = PARTICLE(x, y); PARTICLE(x, y) = PT_NONE;
    
    +                                       } else if (*secondParticleDown  == PT_NONE) { *secondParticleDown  = PARTICLE(x, y); PARTICLE(x, y) = PT_NONE;
    
    +
    
    +                                       // ...before horizontal sliding
    
    +                                       } else if (*firstParticle  == PT_NONE)      { *firstParticle       = PARTICLE(x, y); PARTICLE(x, y) = PT_NONE;
    
    +                                       } else if (*secondParticle  == PT_NONE)     { *secondParticle      = PARTICLE(x, y); PARTICLE(x, y) = PT_NONE;
    
    +
    
    +                                       // .. water loves to move horizontally - so let it move.
    
    +                                       } else if (*firstParticleDown2  == PT_NONE) { *firstParticleDown2  = PARTICLE(x, y); PARTICLE(x, y) = PT_NONE;
    
    +                                       } else if (*secondParticleDown2 == PT_NONE) { *secondParticleDown2 = PARTICLE(x, y); PARTICLE(x, y) = PT_NONE;
    
    +                                       } else if (*firstParticle2      == PT_NONE) { *firstParticle2      = PARTICLE(x, y); PARTICLE(x, y) = PT_NONE;
    
    +                                       } else if (*secondParticle2     == PT_NONE) { *secondParticle2     = PARTICLE(x, y); PARTICLE(x, y) = PT_NONE;
    
    +                                       // .. and move even more ...
    
    +                                       } else if (*firstParticleDown3  == PT_NONE) { *firstParticleDown3  = PARTICLE(x, y); PARTICLE(x, y) = PT_NONE;
    
    +                                       } else if (*secondParticleDown3 == PT_NONE) { *secondParticleDown3 = PARTICLE(x, y); PARTICLE(x, y) = PT_NONE;
    
    +                                       } else if (*firstParticle3      == PT_NONE) { *firstParticle3      = PARTICLE(x, y); PARTICLE(x, y) = PT_NONE;
    
    +                                       } else if (*secondParticle3     == PT_NONE) { *secondParticle3     = PARTICLE(x, y); PARTICLE(x, y) = PT_NONE;
    
    +
    
    +                                       } else if (*firstParticleDown4  == PT_NONE) { *firstParticleDown4  = PARTICLE(x, y); PARTICLE(x, y) = PT_NONE;
    
    +                                       } else if (*secondParticleDown4 == PT_NONE) { *secondParticleDown4 = PARTICLE(x, y); PARTICLE(x, y) = PT_NONE;
    
    +                                       } else if (*firstParticle4      == PT_NONE) { *firstParticle4      = PARTICLE(x, y); PARTICLE(x, y) = PT_NONE;
    
    +                                       } else if (*secondParticle4     == PT_NONE) { *secondParticle4     = PARTICLE(x, y); PARTICLE(x, y) = PT_NONE;
    
    +                                       }
    
    +
    
    +                               } else {
    
    +
    
    +
    
                                    // Handle diagonal falling first...
    
                                    if (*firstParticleDown == PT_NONE) {
    
                                            *firstParticleDown = PARTICLE(x, y);
    
    @@ -717,6 +793,8 @@
    
                                            PARTICLE(x, y) = PT_NONE;
    
                                    }
    
    
    +                               }
    
    +
    
                            // Same story with steam, although upwards
    
                            } else if (PARTICLE(x, y) == PT_MOVEDSTEAM) {
    
                                    particleType_t *firstParticle    = NULL;
    
    
    

    I hope you will like it :)
     
    Last edited by a moderator: Mar 12, 2011
  12. WaveHack

    WaveHack Still Fresh

    Joined:
    Feb 21, 2011
    Messages:
    45
    Location:
    The Netherlands
    Hey. That's a pretty cool idea actually! Although - after testing - I would say it needs a bit tweaking, since with that, water can slip through walls of 3 pixels wide.
     
  13. WizardStan

    WizardStan Mega GP Mania

    Joined:
    May 24, 2008
    Messages:
    16,697
    The "bug" (actually designated a feature. Some valid reasons are given but I still disagree... I digress) occurs when the mouse cursor is set to be invisible. You normally set the mouse cursor to be invisible when you want to use your own custom cursor: you don't want the default cursor appearing overtop of your custom cursor, eh?


    The fix is to not make the cursor invisible. :p Instead, leave it visible, but give it a size of 0x0. It ends up effectively the same, the default cursor is not drawn, but it uses the regular not-invisible code. Pretty simple fix.
     
  14. cosurgi

    cosurgi http://janek.kozicki.pl/

    Joined:
    Jul 30, 2008
    Messages:
    1,098
    Location:
    Gdansk, Poland
    It is crashing when you try to draw near the top edge, or bottom edge (EDIT: with water or acid). The fix is very simple, although adds some extra calculations..



    Code:
    
    --- particle.c  (revision 9)
    
    +++ particle.c  (working copy)
    
    @@ -22,11 +22,12 @@
    
    
     #define PARTICLECANVAS_WIDTH     (SCREEN_WIDTH / PARTICLE_ZOOM)
    
     #define PARTICLECANVAS_HEIGHT    (SCREEN_HEIGHT / PARTICLE_ZOOM)
    
    +#define TABLE_SIZE               (PARTICLECANVAS_WIDTH*PARTICLECANVAS_HEIGHT)
    
    
     #define ONEIN(i)                 ((rand()%(i))==0)
    
     #define SQR(x)                   ((x)*(x))
    
    
    -#define PARTICLE(x,y)            particleScreen[(x)+((y)*PARTICLECANVAS_WIDTH)]
    
    +#define PARTICLE(x,y)            particleScreen[((x)+((y)*PARTICLECANVAS_WIDTH)+TABLE_SIZE)%(TABLE_SIZE)]
    
     #define PARTICLE_ABOVE(x,y)      PARTICLE(x,y-1)
    
     #define PARTICLE_BELOW(x,y)      PARTICLE(x,y+1)
    
     #define PARTICLE_LEFT(x,y)       PARTICLE(x-1,y)
    
    

    alternatively this could be done with ?: for checking out-of-boundary conditions. I don;t know if that would be faster.
     
    Last edited by a moderator: Mar 13, 2011
  15. cosurgi

    cosurgi http://janek.kozicki.pl/

    Joined:
    Jul 30, 2008
    Messages:
    1,098
    Location:
    Gdansk, Poland
    yeah, checking if there's a wall along the way will make it a bit more complex.
     
  16. Silent-Hunter

    Silent-Hunter Hardcore Member

    Joined:
    May 29, 2010
    Messages:
    3,049
    How close to the edge is too close?
     
  17. cosurgi

    cosurgi http://janek.kozicki.pl/

    Joined:
    Jul 30, 2008
    Messages:
    1,098
    Location:
    Gdansk, Poland
    try with water or acid.
     
  18. moz

    moz load *,8,1

    Joined:
    Jun 10, 2003
    Messages:
    2,804
    I love these types of games. Powder Toy is one that I enjoy on my desktop.


    EDIT: Source code avaiable, hint, hint.


    anyway thanks for game.
     
  19. WaveHack

    WaveHack Still Fresh

    Joined:
    Feb 21, 2011
    Messages:
    45
    Location:
    The Netherlands
    You're welcome. :) I've looked at Powder Toy already, but I think it would be a bit too overkill for on the Pandora, especially seeing Sandora barely runs.


    Someone actually mailed me the other day that he got Sandora working on a Nokia N900 (maemo5). That's pretty awesome, isn't it? :p He also said that he tried compiling Powder Toy, but that PT had very awful performance and Sandora ran fine.


    Anyways guys, thanks a lot for the code snippits/diffs! I'll see what I can do to add them. :)
     
  20. Silent-Hunter

    Silent-Hunter Hardcore Member

    Joined:
    May 29, 2010
    Messages:
    3,049
    Barely runs? It runs fine! Although I can never remember what button is for what. Also, you should make pixel doubling optional. And an option to show the cursor would be a lovely addition, since I use an external mouse a lot. One last suggestion: Add the options to have particles wrap around, or build up, instead of simply falling off the screen.
     
    Last edited by a moderator: Mar 17, 2011
Thread Status:
Not open for further replies.

Share This Page

Loading...