Pocket Burning Sand (Open Source)

neilnapier

Active Member
Licensed User
Longtime User
I didn't realise how popular this program would be when I released it... So far it has about 4 times as many posts as the others.

The creator of the PC version did warm me of the slowness that may occur but it sounds god that you seem to have sound a fairly fast way.

would it be possible to use the liquids with the pensizes and such and so be able to make it release the liquids in a more circular format first. (it is not spread out when created like in the PC version)

Also these things don't need to be implemented straight away... As long as the basis of the game is created that is all that matters at the moment, then things like moddability, speed and other things will be implemented later.
 

colin9876

Active Member
Licensed User
wider pen

Easy to change the pens, do u mean like this? Ive just used Agrahams superfast library with a bigger pen footprint. U need to run this from the same folder with the bithandler.dll done for ttt

Note to AGraham.
I want to give Neil what Ive done so far so we can integrate it into his nice BS program, and require a change to the bithandler?
Now I know u said u werent that keen on graphics, but I notice that uve only been off doing Maths (boring lol!) instead so ur talents would be appreciated here!

need varible 'spread' sent to bithandler and
px(i)=px(i) + rnd(-spread,spread)
in the loop before the pixels are plotted.

e.g. Spread might be say 0.6 so all pixels get num ranging from -.6 to +.6 added to px each move down

1) N.B. dont need any variation on y velocity just that change on px.
2) Im not sure how the random num generator works in C, does it just give u a num between 0 & 1?
if so I guess it will be px(i)=px(i) +(RND-0.5)*2*spread or something like that. Im sure u know how to do it as u like Maths so much!

If u can do it will u add it to the bigpenttt below, Ive changed the way boundry checking is done so its faster
 
Last edited:

neilnapier

Active Member
Licensed User
Longtime User
Where is the BMP handler? I can't find it in the libraries?

Hold on i read your post and i'll go try it out.

EDIT: pretty fast but when I use blnDRAG = 1 thing tomake it draw it when the stylus is down and no when it was up, then it works on the computer but when on a PPC it waits untill you let go. Why is that?
 
Last edited:

colin9876

Active Member
Licensed User
Agraham Bitmaphandler.dll

I actually tried to do the library change myself but no progress. I downloaded the microsoft free c# sdk, and the .net sdk (VisualStudio2003) but cant even get hello world to run yet. Its not user friendly. This just confirms my allegence to Basic4ppc!

Just out of interest tho would Agraham post the c# from the bithandler.dll? Would be interested to see how u did it?

Would still like the one line added if u will do it?
 
Last edited:

colin9876

Active Member
Licensed User
.Net library or C command

Thanks - nasty stuff C language by the looks of it!
whats the rnd function in C?
I see .Net framework has
double RandomNumber = RandomClass.NextDouble();
so extra line could be
public int timer(int[]x, int[]y, int n, double spread)
..
px(i)=px(i)+(2*RandomClass.NextDouble()-1)*spread

Is it better to use the c# function for generating a random number or the .Net RandomClass function - or are they both the same thing?
 
Last edited:

agraham

Expert
Licensed User
Longtime User
nasty stuff C language by the looks of it!
Not all. It's beautifully elegant, very safe to code but just not what you are used to. BTW you keep typing C - this may be shorthand on your part but this is C# - which is different to C in many ways

whats the rnd function in C?
As this is C# not C there are no standard functions/libraries - it relies upon the .NET Framework.

I see .Net framework has
double RandomNumber = RandomClass.NextDouble();
That's the one (or one of several)

More completely and with correct syntax. You need a new Random object to create the numbers and the C# compiler will complain that it can't convert a double to an int (because doubles are larger than ints so information can be lost) so you will need to cast it to an int yourself

B4X:
Random rand = new Random();

public int timer(int[]x, int[]y, int n, double spread)
{
    ... 
    x[i]=x[i]+(int)((2*rand.NextDouble()-1)*spread);
    ...
}

Here I've done it for you, with source. I haven't time to test it as I have lost the B4PPC test prog I used but as it got through the compiler it is probably OK.
 

Attachments

  • BitmapHandlerDll.zip
    2.4 KB · Views: 298

colin9876

Active Member
Licensed User
fab

Looks much better! Thanks Agraham - Im sure Neil will think its a step in the right direction
 

Attachments

  • bstest.sbp
    714 bytes · Views: 280

neilnapier

Active Member
Licensed User
Longtime User
Much better, well done!

I have altered it slightly so that the mousedown function is on but i'm not sure if it will work on PPC as I havene't tested it on it yet.

All that I have done is add a few lines

EDIT: Also has anyone noticed that sometimes when a stuck one falls then ir reappears at where it was stuck at and falls again. Is there any way to sort that?
 

Attachments

  • test2.sbp
    869 bytes · Views: 282

colin9876

Active Member
Licensed User
Neil, dont worry about the stray pixels, its just because I didnt clear a value - I will correct it
As to ur changes - What did u hope to achieve? They dont make any difference on the PPC because you have to do a MouseDown before u can do a MouseMove. Are u wanting this program to run on the desktop aswell or is it soley aimed at the ppc?
If it is just a ppc app I would say leave those lines out because all its doing is (fractionally) slowing it down?
 
Last edited:

neilnapier

Active Member
Licensed User
Longtime User
What I was hoping to achieve was the ability to see the pixels as soon as you made it. I forgot that this would not be needed so yes you are right, it wouldn't be necissary.

When I move the code and dlls to the original file it works apart from the fact that it is very very slow and flickers a lot. Do you knwo what i am doing wrong?

Also where is it in that code where you set the colour? It used to use cYellow didn't it but now I can't find it?

It also would be good to have it work on a computer but that is not the main priority so does not need to be worked on until a satble ppc version is released.

EDIT: Oops... i get why it was taking so slow... I had made amistake in the timer.
 

Attachments

  • Open Source Code.sbp
    6.8 KB · Views: 275
Last edited:

colin9876

Active Member
Licensed User
Neil, Ive just seen how uve merged the two codes - not efficient because its doing all the processing for pensize, drawing lines etc in the loop thats moving the pixels. I'll merge the code, u work on the dll?


do u have Visual C# 2008 compiler, Express edition is free from Microsoft, if not can u download it because then u can maintain the dll library?

To get rid of those stray pixels I need an extra line in the C# routine

If u can be the C# guy on this we wont have to keep asking Agraham to bail us out?
 
Last edited:

neilnapier

Active Member
Licensed User
Longtime User
I could do it but I know no C# whatsoever. So as long as you give me code then I will do it.

EDIT: I have Visual C++ 2005 Express edition... will that do?
 

RandomCoder

Well-Known Member
Licensed User
Longtime User
Neil, I was just checking out your open source code to see how your getting on but it's not possible without the images. Can you please upload the image file zipped or if you prefer PM me a copy so that I may take a look.

Thanks,
RandomCoder
 

neilnapier

Active Member
Licensed User
Longtime User
OK here it is... just paste the img folder. It reads from inside the img folder in the program.

Also I don't undertand all that stuff in the dll. There is like 30 folders in it!
 

agraham

Expert
Licensed User
Longtime User
I've found time to look at this again. The previous dll versions were quick and dirty and the loop ends and indexing weren't quite right as I hadn't bothered too much, also it left pixels behind.

Here's what should be a clean version with bounds limiting so it won't error and won't leave pixels behind. Note that there are changes in bstest.sbp. At pixel creation you were effectively indexing from base1 - it is now base 0 and your bounds checking is gone.

Visual C++ 2005 Express edition might do for the desktop as I believe that you can create managed assemblies with it - but I have never used it. However none of the Express editions can compile for a device. You need Visual Studio or SharpDevelop for that or roll your own at the command line with the free Microsoft SDK.
 

neilnapier

Active Member
Licensed User
Longtime User
That is amazingly fast!!!

Well done. I wish I was of some help as it is my project but you guys are supreme compared to my simple knowledge of the language.
 
Last edited:

colin9876

Active Member
Licensed User
Thanks again

Neil - ur interface is nice, & ur an enthusiastic project manager!

Free Expess edition - no dlls .. shame - I knew it was too good to be true!
 
Last edited:

agraham

Expert
Licensed User
Longtime User
Could you change it so that there is a variable in the code or in the dll so that you can change the colour of the pixels.
Look at it closely Neil ;) But its all or nothing I'm afraid. You could always pass the colours in as another array like in this version!
 
Top