This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
CosmoConsole's profile picture

CCSand [v0.5] - Falling sand game for ComputerCraft

Started by CosmoConsole, 09 July 2013 - 02:04 PM
CosmoConsole #1
Posted 09 July 2013 - 04:04 PM
CCSand

A falling sand simulator, like Powder Toy, Powder Game and Pyro Sand,

created for ComputerCraft.


Version 0.5

DOWNLOAD

pastebin get RbKvzJqp ccsand

Known Caveats:

Large amount of particles will cause flickering and graphical glitches. (If you have Redirect API and v0.5

this is no longer a problem.)

Rarely, elements might glitch (such as TNT refusing to explode or even burn). I myself cannot

reproduce and therefore fix this issue, but it can be avoided by opening CCSand in an editor,

saving it, and closing. (But not editing anything)


Changelog (v0.5):
  • Support for Redirect API (forum thread) created by GopherAtl.
  • If Redirect API is downloaded along with this, the flickering should be gone.
  • Some rendering optimizations.
  • Use fps = xx (with your own risk!) from debug console to change simulation FPS.
  • Load & save
  • More elements, such as CO2, H2 and LAVA!
Upcoming features:

More elements!


Help

Select a material from the right. Press < and > to browse pages.

Select your material by left-clicking.

Paint it into the playfield by left-click and remove with right-click.

(Mouse dragging supported)

Middle-click a particle on the playfield to get information about it.

Press Ctrl or press Menu to open the menu.

Press <Backspace> to open debug console.

Press [ II ] or <Space> to toggle pause. If the [ II ] is black text on white

background, pause is on, but if vice versa, pause is off.


Screenies


Yevano #2
Posted 09 July 2013 - 08:54 PM
This reminds me of when I played with PowderToy all the time. :P/>

A little constructive criticism:
I played with this a bit and it's a tad slow (maybe you did that intentionally?). As far as performance goes, I noticed that your render function loops through particles (using getParticleAt) to find what particle goes at what position. It would be faster to just loop through all particles once and draw them at whatever position they contain. Also, I think drawing to a backing buffer and then drawing the buffer to the terminal should fix the flickering issue.
ETHANATOR360 #3
Posted 09 July 2013 - 10:11 PM
looks fun, nice work +1
CosmoConsole #4
Posted 10 July 2013 - 04:48 AM
A little constructive criticism:
I played with this a bit and it's a tad slow (maybe you did that intentionally?). As far as performance goes, I noticed that your render function loops through particles (using getParticleAt) to find what particle goes at what position. It would be faster to just loop through all particles once and draw them at whatever position they contain. Also, I think drawing to a backing buffer and then drawing the buffer to the terminal should fix the flickering issue.
It's kinda supposed to run at max 10 fps, but it's not supposed to slow down with every particle. The next version will optimize the rendering in a way as you said, but if it still flickers, I am also going to code double buffering then.
Zudo #5
Posted 10 July 2013 - 11:03 AM
I thought this was going to be falling sand blocks!
Nyarlathotep #6
Posted 10 July 2013 - 11:14 PM
Absolutely brilliant, one of the most impressive things I've seen on computercraft yet
Win7yes #7
Posted 07 June 2014 - 03:56 AM
For some reason is not working, just clears the screen and nothing else. Also it tries to call nil in line 113 (it says term.restore() in that line) If I comment that out it still doesn't work. Im running this on CCEmuRedux
Bomb Bloke #8
Posted 07 June 2014 - 05:57 AM
term.restore() was removed from ComputerCraft by version 1.6 (well after the release of this script) - the laundry list of other changes it brought would also break a lot of older scripts, so if that's what CCEmuRedux is mimicking, then that's likely the problem.

Or it could just be that CCEmuRedux is in an incomplete state. Can't say I know much about it.
Beeskee #9
Posted 01 July 2014 - 09:06 AM
Rarely, elements might glitch (such as TNT refusing to explode or even burn). I myself cannot

reproduce and therefore fix this issue, but it can be avoided by opening CCSand in an editor,

saving it, and closing. (But not editing anything)


I encountered this issue. I tried editing and saving file and got an error, "Error saving to ccsand" most of the time. I even tried downloading the raw, saving it locally, making sure it was in the expected format, and uploading it as a new pastebin.

After many retries it finally did save. Running ccsand then gives this error: bios: 337: [string "ccsand"]:1066: unexpected symbol. - The copy worked fine beforehand.

I viewed the file on the local computer and it was cut off after that point.

I hope this helps!


Edit: Sorry, I didn't realize this thread had been necroed lol
Edited on 01 July 2014 - 07:08 AM
ry00000 #10
Posted 07 May 2015 - 01:23 PM
Heh, heh, I know a lot about FSG's, because I play TPT (The Powder Toy, a free FSG, no registration required, but I have an account, same username), so feel free to PM me on the CC forums about anything.
RadiationAlert #11
Posted 26 May 2015 - 07:42 PM
The error at line 113 can easily be fixed by replacing "term.restore ()" with "term.clear ()". "term.restore ()" has been removed as mentioned above.