Pocket Burning Sand (Open Source)

colin9876

Active Member
Licensed User
quantum tunneling?

Whats quantum tunneling?

that reminds me - spread should always be 2 or less otherwise it can jump thro thin walls!
 

agraham

Expert
Licensed User
Longtime User
Im utterly convinced that using 32bits each to store the spread, gravity etc is a waste - and by fitting these into less bit can get the whole rule into a Double so the array of rules is a simple array of Doubles.
You are missing the point Colin. It is not a waste of anything. They have got to be unpacked to be usable so why bother packing them in the first place. You are unnecessarily wasting processor time, restricting the range of parameters and not even saving a memory as your packed array of rules is a waste of space once they are unpacked to be usable - and don't even think of unpacking them in the timer loop -there is no processing time to spare in there so they will have to be present as ints and doubles ready for use.
 

colin9876

Active Member
Licensed User
rules() as Double very efficient?

AG, but this way I dont have to unpack anything. gravspread is an INT and its transfered directly from the second half of the Rule Double. Nothing could be faster!
e.g. No colour table, no unpacking rules before hand!

e.g. if collision between col1 & col2
pgravspread= last 16 bits of Rule(col1*64+col2)


and things like is grav negative is just
if gravbits&10000000 ==1 etc
all fast and simple
 
Last edited:

agraham

Expert
Licensed User
Longtime User
its transfered directly from the second half of the Rule Double. Nothing could be faster!
Wrong. This IS unpacking and it takes time you cannot afford. You cannot just pick an int from a double. Ints don't live in doubles! You obviously know nothing about how a number is represented as a floating point double.

pgravspread= last 16 bits of Rule(col1*64+col2)
You can't afford the time to pick out the 16 bits which don't necessarily exist in the format you believe. You need to unpack it first.

and things like is grav negative is just if gravbits&10000000 ==1 etc
You cannot do bit operations on a double without transforming it to an int!

all fast and simple
No it's not. You just don't understand the costs in time of what you are saying. You are making assumptions that are outside your sphere of knowledge and I am fed up with trying to explain that.

You have the library source code ,feel free to use it. I'm off beta testing version 6.0.
 

colin9876

Active Member
Licensed User
..... c'est la Vie

ok dont call it a double, call it a pointer to 4 bytes of memory.

I cant believe its not possible to get the bits out of 4 bytes of memory

Bit shifting and pointers is what C (# ++ * or whatever) is good at!

Storing a gravity value thats at most 1d.p. resolution in 32 bits is a waste to me! Especially when u have 10'000's of them.
Anyway lets have a break for a while.

Neil, where its at at the moment is pretty good, and the library is good, so well done for pushing it to this stage.
Im off to beta test some French 1.0 lol! ...as Im well behind on my coursework.!
 
Last edited:

neilnapier

Active Member
Licensed User
Longtime User
Your system of 1, 2 and decimal places is quite different from that of BS.

BS does the weight and reactions in fractions of 32768 (1000 being max though)

Spray, Visc and Slide are all max at 20.

decimal places do nt work in Bs1 coding
 

neilnapier

Active Member
Licensed User
Longtime User
Colin, the liquids reove solids when you make a mountain of a liquid so that the liquid continuasly falls from a source onto the hill and then splits up untill it falls from either side... so it it the max amount of the liquid, the solid can hold, then draw a solid where the liquid is falling from either side.
 

colin9876

Active Member
Licensed User
?

Explain that last post again Neil as I cant find that problem with it?

By the way Im all for changing the way spread is stored, getting rid off the decimal point means it can be stored in the byte that I wanted.

The spread value: does it go 0 - 20 in integers. e.g. decimal points not allowed?

with gravity (or weight) - what is the value of something that rises. what is the value of something that would neither fall or rise?

Also whats the FPS meter that u want?
 
Last edited:

neilnapier

Active Member
Licensed User
Longtime User
It is hard to explain the fault but i am usre you will encounter it eventually as we progress.

0 weight is solid
<0 is gas
>0 is liquid.

it goes from -32768 to 32768.

There are no decimals in BS at all (exept BS2 coding which again is not going to be implemented any time soon)

FPS as in frames per second. If you look at the bottom of BS it says FPS: 100 etc. It changes regularly depending on how quickly things activate. (ie how quick the liquids fall)
 

neilnapier

Active Member
Licensed User
Longtime User
To see that glitch draw a line right accross the screen horizontally through the sources. As you will see the line is perfect apart from one or two pixels of black from underneath where the sources were. (please allow the sources to have fallen first)
 

colin9876

Active Member
Licensed User
FPS easy - would be quite useful actually to get an idea of refresh rate.

Globals
Frame=0
Lasttime=Now


In the timer put

Frame=Frame+1
If Now >= Lasttime+ 10000000 then
FPS.text= Frame*10000000/(Now-Lasttime)
Frame =0
Lasttime=Now
end if

Update, re ur glitch - in the same way u cant place elements over solids, u cant draw solids over the moving pixel and expect it to stay when it moves on. Unless we add another line in the code - but then that will have a speed cost for each pixel!
 
Last edited:

neilnapier

Active Member
Licensed User
Longtime User
That doesn't work... it does it to decimal places (remember the no dec rule) and just rises and never decreeses
 

neilnapier

Active Member
Licensed User
Longtime User
How do you stop it from having lots of dec places?

Also in BS lquids and solid can be drawn over each other as it is all in one layer. Wouldn't this be easier that this multiple layer situation that we use?

EDIT: alo the end if statement at the bototm of your code is not needed.
 

colin9876

Active Member
Licensed User
which end if isnt needed? In the bit of code u just added. The end if should be there. If its not there it wll be slower. e.g u only want to update the textbox if the second has changed

Edit - the if, end if should go round all 3 lines of code otherwise it will work it out wrong Neil. ALL 3 lines are only done if its gone up a second since it last did it

update do it like this - slightly faster, and no decimals

If Now >= Lasttime+ 10000000 then
FPS.text= Frame
Frame =0
Lasttime=Now
end if
 
Last edited:

neilnapier

Active Member
Licensed User
Longtime User
OK... Works well, on my computer I am always above 20FPS. For your next release use
B4X:
Frame=Frame+1
If Now >= Lasttime+ 10000000 then
FPS.text= "FPS:" & Frame
Frame =0
Lasttime=Now
end if

As then we have the letters FPS there as well.
 

colin9876

Active Member
Licensed User
If u want it FAST posible, have the letters FPS as a permanent label on the form and just write the number to a textbox after it. Concatenating the word to the number takes a few clock ticks so quicker that the 'FPS' word already there, especially as the letters never change!


did u add the lines about making the top item active?
e.g. in stone group click add
wall.transparent=false

If so can u post it all here as v2.90 then I can add my collisions
 
Last edited:

neilnapier

Active Member
Licensed User
Longtime User
I have not done them yet and I need to get some work done this afternoon so can't do it right now.

I have added resolution and FPS. I will post it in about an hour.... is this ok?
 

colin9876

Active Member
Licensed User
Yes sure, as long as the RES is written at the start of the program and not in the middle of a running loop!

Personally I would take the res from the form.height and form.width as it saves adding another dll but its up to u
 

colin9876

Active Member
Licensed User
Vga

Also Neil with a little work we could have all the panels and icons set relative to the screen, so it will work if u have the pda landscape, or portrait, and if its on a VGA screen (640x480), or even 240x240 pda
Probably worth doing as more VGA screen PDAs comming out now.

Would need code section (called at the beginning - not in the main loop) saying stuff like
Rlabel.left= burningscreen.width - 30
sandicon.left= burningscreen.width -25 ect

also draw.top = burningsand.height - 20 or whatever will all have to be set
 
Last edited:
Top