Release Sandora 0.1.1


Status
Not open for further replies.

WaveHack

Still Fresh
Joined
Feb 21, 2011
Messages
45
Location
The Netherlands
Website
mineth.net
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:

Sandora readme
Last updated: 2011-03-11


Version: 0.1.1


--------------------------------------------------------------------------------


Sandora is a Falling Sand Game for the OpenPandora Ltd. Pandora. It's basically


a direct C port of SDL Sand (http://sourceforge.net/projects/sdlsand/). It's


being developed by WaveHack from the OpenPandora boards. For contacting, please


send me a PM through the forums or email to <email at wavehack dot net>.


Sandora 0.1.1 has been released as a prepackaged .pnd file for on your Pandora.


It should be playable on any standard Pandora. If you encounter any serious


performance issues or bugs, please contact me through one of the media below.


Please note that the framerate hasn't been limited yet. This will be fixed later


once performance is more stable.


Official website: http://mineth.net/projects/sandora/


SourceForge project page: https://sourceforge.net/projects/sandora/


Contact email: <email at wavehack dot net>


Controls:


- Start/ESC Exit Sandora


- M Clears the whole screen


Key Particle Description


- 1 Wall Standard building material.


- 2 Ironwall Wall made of iron. Rusts when in contact with water.


- 3 Torch Spawns fire.


- 4 Stove Boils water on top, separating saltwater.


- 5 Ice Melts on contact with Salt.


- 6 Rust Slowly disintegrates.


- 7 Ember See fire.


- 8 Plant Plants grow in and consume Water. Flammable.


- 9 Void Nullifies anything that touches it.


- 0 Electric Nothing spectacular.


- Q Water Standard liquid. Can combine with Salt and Dirt.


- W Sand It's just sand.


- E Salt Salt melts ice.


- R Oil Highly flammable!


- T Dirt Standard dirt.


- Y Acid Eats through everything but walls.


- U Saltwater Water+Salt combined.


- I Mud Water+Dirt combined.


- A Water spout Spawns water.


- S Sand spout Spawns sand.


- D Salt spout Spawns salt.


- F Oil spout Spawns oil.


- G Steam Result of Water+Fire/Stove.


- H Fire Ignites Oil and Plant.


You can draw particles by tapping and moving the stylus around the screen, or


holding down the left mouse button on Windows. The current selected particle


type is not properly visible yet, but you can use the above control list for


reference on selecting particles. A GUI will be added later from which you can


select particles.

Snippet from known-bugs.txt:

[...]

Bugs:


- Framerate is better than last version but still drops a lot when adding lots


of particles. More performance updates are required.


- Drawing too close to the edge on the Pandora causes the touchscreen


calibration to mess up and eventually crash.


[...]

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:
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:
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. :)

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).
 
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.
 
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.

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).
 
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).
 
This sounds like the sdl touchscreenbug, that was fixed In Scummvm first by djwillis.
 
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).

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:
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:
This sounds like the sdl touchscreenbug, that was fixed In Scummvm first by djwillis.

how did he fix it?
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.
 
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:
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.
 
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.

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. :)
 
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.
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.
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:
Status
Not open for further replies.
Back
Top