Log In  

Cart #28376 | 2016-09-12 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

Watch sand fall in interesting patterns.

Looking for advice on optimising (and profiling?) this. On my old macbook pro it runs at around 10fps at best. I can't see any profiling tools built in to p8 but maybe I missed something? What's generally considered slow? I've sped this up by reducing the size of the simulation and mirroring, so it's really only running a 45x64 sim.

Things I'm thinking about:

  • some sort of "active islands" system for not updating the whole sim every update
  • not clearing the screen but remembering the part of the screen that are unstable, to reduce rendering costs, but I think (again, no way to measure) that it's update-bound.
P#28377 2016-09-12 04:50 ( Edited 2016-09-12 20:48)

This is something I haven't been happy about in PICO. There is a command called FLIP() which maintains perfect speed - and yet to update every 128x128 pixel on the screen is actually slow no matter how fast your computer may truly be.

I would like to see a future command called RELEASE() or something which will let your program run flat out top speed slowed down only by FLIP() or functions designed for time splicing.

Then your Sand Toy, TENPN, and other great programs like this will run full speed.

P#28396 2016-09-12 11:16 ( Edited 2016-09-12 15:16)

@tenpn Blokatt did exactly that a few weeks ago, have a look:
Sandbox-8 by Blokatt

P#28401 2016-09-12 12:12 ( Edited 2016-09-12 16:12)

UB, great minds run in the same channel. Never repress curiosity or creativity. :)

P#28405 2016-09-12 12:55 ( Edited 2016-09-12 16:57)

curiosity is what I'm talking about, dw. Blokatt's sandbox runs fast. there might be a trick or two in there.

P#28407 2016-09-12 13:03 ( Edited 2016-09-12 17:03)

Fair enough. I know years ago, Richard Garriott had released ULTIMA for the Apple computer. At the time I was using Floating Point BASIC to draw my own tiles and images.

He, however, was using machine-language. Were it not for me looking to his code and understanding it, I might've delayed my entry into the world of machine-language coding and hindered my game writing process.

As it was after looking at his, I was able to write my own, and it in turn was faster than his by determining what tiles were already updated and didn't need to be redrawn.

A year later Richard released Ultima ][ using the very method of speeding up tile plotting that I developed.

And no, he couldn't have known about it as I never posted it. It was just - great minds run in the same channel. :)

P#28409 2016-09-12 13:29 ( Edited 2016-09-12 17:29)

Thanks for the link @ultrabrite!

Kinda bummed that someone's already made such a polished sand toy thing, but eh, whatever. I'll see if I can figure out how they got it so slick.

P#28423 2016-09-12 16:48 ( Edited 2016-09-12 20:48)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-28 20:58:07 | 0.017s | Q:23