Log In  
:: Unfold ::

Cart #17762 | 2015-12-14 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

P#17763 2015-12-13 19:41 ( Edited 2015-12-19 12:09)

:: Unfold ::

Cart #17482 | 2015-12-04 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

Hello, this is my first attempt to code anything in this great virtual console.

It's just four effects I coded in my first few evenings since I bought the Pico-8.
I try to use the special modes at 0x5f2c to mirror some of the effects so that I have to draw less pixel.
Although, one can use the keys to go through all the modes, and based on the mode more or less pixels are drawn and the text are aligned accordingly.

A: changes mode
B: changes part

P#17484 2015-12-04 16:52 ( Edited 2016-06-06 00:40)

:: Unfold ::

Hi, I am new to Pico-8 and I love it.

I yesterday tried to benchmark filling every pixel individually. At first I used pset. I tried something very simple like pset(x,y,c) where c = x + y + nframe, where nframe += 1 every update. I got 15fps, then I got 30 when I put it inside, like pset(x,y,x+y+nframe)

Then I tried to see if pset per pixel matters. I tried to poke at 0x6000, of course it's faster because I was poking two pixels at once. But if one needs to still control individual pixel, has to do bit manipulation with band and mul by 16, so it will be slow again. It would work for copying screen areas with memcpy, like a game I had seen that makes cool glitches.

Then I tried to make a buffer
vram = {}

for i=1,8192 do
vram[i] = fill with stuff..

but memcpy(0x6000,vram,8192) did nothing (black screen)
is there a symbol to get the pointer of vram? I also tried vram[0], vram[1] at the function.
Now if I copy some of the contents at 0x3400 and then do memcpy(0x6000,0x3400 it works, my array has stuff.
Do I need a special symbol before vram, like &vram? I couldn't find for sure.

So, at the end my question is, is it worth it to have a separate buffer (and does it fit in memory?) of 8k or even 16k chunky pixels, and copy from there to vram? Or is pset the only I need for speed? Afterall, I am not sure if pset was slowing down, or simply that even c = x+y+nframe took time from 30fps to 15fps.

The other thing is to just reduce resolution. from128128 plasma to 6464 blocky (either with 4 pset or with rect function) I got 30fps from 15fps. Well, 15fps is still not bad for full pixel effect in this tiny machine, I just want to investigate if it's possible to improve performance in pixel effects or I search in vain.

Any other techniques that can improve performance in general? I did my plasma test with initing precalced sines, although I haven't tested if the sin functions are slow or not. I was searching for a thread to say common pitfalls in Pico-8 performance, what to avoid, what to prefer.

Also, I guess there is no emulated CPU. But is there a restriction on speed, like counting imaginary cycles for every token and have a maximum theoritical cycles per frame? Or does Pico-8 runs the fastest possible, and subsequent version of Pico-8 might be more optimized and change speed in some of the cartidges? So, maybe some effect I code now, will have faster speed in the future because of improvements or faster PC processor? How does this affect when the cartidges run on browser?

P#17435 2015-12-03 08:22 ( Edited 2015-12-03 20:37)

Follow Lexaloffle:          
Generated 2023-09-25 12:11:20 | 0.068s | Q:12