Pocket Burning Sand (Open Source)

neilnapier

Active Member
Licensed User
Longtime User
Pocket Burning Sand (Open Source)

OK... well the title speaks for itself. I have been working on a portable BS. Burning Sand is an application which is a physics toy. You have elements that interact with each other. To find more information on it go to here

I posted this on the Falling Sand Game forum so perople that I have gave thanks to may not be members here. due to the fact that it has not gained much publicity there I posted it here.

It is far from complete and I am quite a noob at the language myself. I only learnt the coding last week.

What I decided to do was make it open source so that people could contribute parts of the coding so hopefully it would be finished quicker and more efficiently.

BS Alpha Version 1
BS Interface created.
Drag Implemented.
PenSize Created.
Clear and Wall created.
Clear Screen works!
Added Filled Circle Pen
Added Circle Pen
Added Vertical Pen
Added Horizontal Pen
Element Indicator (using) created
Groups created

BS Alpha Version 2
Pause
Liquids, Solids & Gases
Reversable Gravity
Groups
Borders for elements
Much Faster
Reversable Gravity glitch sorted
Sources Created


If anyone feels that any of it should be rewritten feel free to do so. (I actually suggest trying to sort some of the stuff or even try different methods.)

Downloads

Pocket BS Alpha Version 0.01
Pocket BS Alpha Version 0.03
Pocket BS Alpha Version 0.045
Pocket BS Alpha Version 0.05
Pocket BS Alpha Version 0.06
Pocket BS Alpha Version 0.07
Pocket BS Alpha Version 2.15
Pocket BS Alpha Version 2.86


Thanks To...
Sieben
JoeMaximum
bbq
Erel
dzt
Colin9876
AGraham

Thanks for reading and I hope you will contribute.
 
Last edited:

colin9876

Active Member
Licensed User
I really like the idea of the program & would like to contribute.

I loaded it but no sand seems to move yet? (not near a PC so not able to try that version yet)

How many points do u need the sand to start from?
How many grains of sand
How do they interact?

I guess you just have to have an array of sand(x,y) coordinates and move one at a time. Might be slow if u have more than say 50 grains of sand?
 

neilnapier

Active Member
Licensed User
Longtime User
I have not been able to create liquids or solids yet. There are minor glitches that I have fixed but I have not updated this yet because I am wanting to have more things done in each version.

Once Liquid and gases work I will be hoping to make a config (like the pc version made by max nagl AKA Sieben) so that it is moddable.

Thanks for offering to contribute.
 

colin9876

Active Member
Licensed User
Ok I'll work on it.
Is it water that is supposed to flow or sand.
Whats the tap icon supposed to do.
Does the liquid start from the top or do u set the starting point?
 

neilnapier

Active Member
Licensed User
Longtime User
I suggest you type in Max Nagl to google and on the first result there is a page called Burning Sand 1. Click that and download it (also Burning Sand 2 has the tap but I feel that it is nesisary to add)

The tap is a sources toggle. This means that when the toggle is on, then 4 different lines of liquids fall down from the top... something like this
logostuff.gif


Once liquids and gases are implemented no new elements will be added but instead a config will be worked on (a txt file) that will instruct the program, so that elements can be made and added. the mod code will be done like this
B4X:
Element Nature Plant 0 255 0 0 1 1 1 0 Clear 0 File img\Plant.bmp

This is a clone of Burning Sand 1 (with some feature of BS2)

EDIT: Also in the new version that I am working on, mouse over has been removed because it does not work with a PDA as you can't hover.
 
Last edited:

colin9876

Active Member
Licensed User
BS coming along - should be able to post my demo tomorrow.
Had a really clever idea, the colour of the objects on the screen will determine the interactions with the liquid.
For example different lines which all look black could be drawn in colours RGB(1,0,0),RGB (0,1,0)...(0,0,1)(1,1,0)(2,0,0) etc and this saves storing the properties of the things on the screen, just need to look at the pixel colour
I need someones help on RGB function
1) if I do
hit=form1.getpixel(x,y+1) 'look at the color of the thing uve hit one pixel belowu
how do I get the RGB componets of the value hit

2) How do I delare hit as a double in the Global area - will just hit=RGB(0,0,0) automatically set it to the double variable type?
 

colin9876

Active Member
Licensed User
Thanks
Its good it doesnt need types. The only reason I thought it would have to be a double or something is becasue when I did
textbox1.text=hit
it displayed -1 on a white pixel so I thought it must be out of range??
 

neilnapier

Active Member
Licensed User
Longtime User
Good to know that people are willing to help!!! Once you make your update then i will edit yours with my minor glitch sorts. Also you can remove the mouse over indictaor before you post it because on a PPC there is no way to hover the pen over an element.

I was originally planning to have individual colours as elements because I could not think of any other way it could work.
 

colin9876

Active Member
Licensed User
game

just trying the physics - this little demo is more like 'Dripping Tap' than 'Burning Sands'
The problem is with lots of particles moving it will get slow. Really we need a way to alternate bitmaps (like in ur post above with the flashing colours) to emulate movement, because litterally moving thousands of pixels will not be fast enough

To try this game just load the demotap.sbp and you will need the tap.bmp in the same folder -FOR POCKETPC ONLY, NOT DESKTOP
To Play-
Use the stylus to plant bouncy pads on the screen, turn on the tap, and get the water to come to rest on the blue tray!
 

Attachments

  • demotap.sbp
    1.6 KB · Views: 308
  • tap.bmp
    822 bytes · Views: 321
Last edited:

neilnapier

Active Member
Licensed User
Longtime User
Could you possibly alter it so that it works with my BS program? There is no need for realistic bouncing action just gravity (different weeights if it is possible) and slide (in the air so that it sperates and on wall so that it slips of it, if possible)

I could alter it to work on it but I feel that you would do a better and quicker job at it.
 

colin9876

Active Member
Licensed User
Yes sure, Im away from home at the mo, but when I get back I will look at the PC version of burning sands and see if I can emulate it.

Also Ive just realised my game will only play properly on the pocketpc. I didnt use a timer, just let it run at maximum speed so Im sure it will go too fast if people play it on the computer!
 
Last edited:

neilnapier

Active Member
Licensed User
Longtime User
Ok no hurry, there are only 2 forums awaiting the next update ;)

As i said once you do your peice of magic then then next main priority is gasses (if not already done along side your liquids) then moddablity.

Moddabiliy will be the most difficult to accomplish I think because i am not to sure about the FILEREAD function and you would need to learn what the modding language is like...

for anyone who cares here are examples of the modding language:
B4X:
 Group Clear 0 File erase.bmp
Element Clear Clear 0 0 0 1 1 1 1 0 Clear 0 File erase.bmp
Interaction Water Salt saltwater Saltwater 2000
Message "Hello!!!  Whats up?"

If anyone wants to know what the coding actually means PM me and I will explain.
 

neilnapier

Active Member
Licensed User
Longtime User
Well with Burning Sand moddability you can make new elements by adding lines of code. Then using Interaction function you can make the elements react with one another. So if I wanted to make fire burn some wood then I would do
B4X:
Interaction Wood Fire BurningWood Fire 1000
The first two elements in that line are the things that react with eachother and the last two are what each of them turn into.

EDIT: This is a basic idea of the BS element code:
B4X:
Element [Group] [Name] [Colour-Red] [Color-Green] [Color-Blue] [Weight] [Spray] [Slide] [Viscosity] [Deathrate] [Die to] [Order] [Icon]

If someone implemented it I would gladly make the config for it (config is where the mods go)

EDIT2: go to here to learn about BS modding.
 
Last edited:

colin9876

Active Member
Licensed User
Oh yes I understand now.
I dont think its that difficult in theory.
Certainly you can open a file and read all the values in
Also variables like how fast it falls, viscosity etc would be things that would have to be represented in the physics engine anyway so it wouldnt be a problem to load those values in.

Ive done a bit of a demo going using 3 different substances, but the problem Im having is its slow if uve got a few elements moving round at the same time. Its more like 'sliding mud' than 'burning sand'. Im still working on it.

I think one question to Erel would be, for graphics programs, how much faster will a compiled exe run compared to running from Basic4ppc when version 6 comes out? Also when do u expect version 6 to arrive?
 

colin9876

Active Member
Licensed User
SDL.dll

Ok, Ive had a look at Burning Sands on the PC now, amazing. What blows me away is that you can have 400x400=160,000 different pixels moving and interacting and its so fast.

That program uses a dll file SDL.dll that does all the hard graphics work.
Is there such a thing for Basic4ppc or can we use SDL.dll? I know nothing about dlls. Another question for EREL ?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I think one question to Erel would be, for graphics programs, how much faster will a compiled exe run compared to running from Basic4ppc when version 6 comes out? Also when do u expect version 6 to arrive?
It will run faster, but I can't estimate how much faster.
Version 6.00 will be ready in a few months (2-3 months ?).

You can use .Net dlls with Basic4ppc.
Can you provide a link to SDL description ?
 

colin9876

Active Member
Licensed User
SimpleDirectmediaLayer.

Saw this posted on libsdl.org
Q: Can I build SDL for Windows CE?
A: SDL is not officially supported on Windows CE, but some people have successfully built and run SDL applications on Windows CE.
SDL 1.2.5 and newer contain project files and information on building SDL for Windows CE. Take a look at the file README.WinCE in the source archive for more information.


Ive been looking at how Burning Sands works, its by the same colour of the pixel method that I thought about using! The program runs over every pixel and depending on the colour of it knows what it is, and then moves it one pixel etc according to its characteristics.

What I find amazing is it does a whole scan of 160,000 pixels, and moves each one a tiny bit, within a fraction of a second.
 
Last edited:
Top