Jump to content




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

game lua

10 replies to this topic

#1 CosmoConsole

  • Members
  • 13 posts

Posted 09 July 2013 - 03: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


Click here to access the Minus gallery



#2 Yevano

  • Members
  • 376 posts
  • LocationUSA

Posted 09 July 2013 - 07: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.

#3 ETHANATOR360

  • Members
  • 423 posts
  • Locationyour hardrive

Posted 09 July 2013 - 09:11 PM

looks fun, nice work +1

#4 CosmoConsole

  • Members
  • 13 posts

Posted 10 July 2013 - 03:48 AM

View PostYevano, on 09 July 2013 - 07:54 PM, said:

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.

#5 Zudo

  • Members
  • 800 posts
  • LocationUK

Posted 10 July 2013 - 10:03 AM

I thought this was going to be falling sand blocks!

#6 Nyarlathotep

  • Members
  • 14 posts

Posted 10 July 2013 - 10:14 PM

Absolutely brilliant, one of the most impressive things I've seen on computercraft yet

#7 Win7yes

  • Members
  • 110 posts

Posted 07 June 2014 - 02: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

#8 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 07 June 2014 - 04: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.

#9 Beeskee

  • Members
  • 27 posts

Posted 01 July 2014 - 08: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 by Beeskee, 01 July 2014 - 08:08 AM.


#10 ry00000

  • Members
  • 244 posts
  • LocationComputer, Base, SwitchCraft, Cube-earth, Blockiverse, Computer

Posted 07 May 2015 - 12: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.

#11 RadiationAlert

  • Members
  • 17 posts

Posted 26 May 2015 - 06: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.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users