Log In  

Cart #fast_256_colors-0 | 2019-07-31 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
5

-- 256-colors rehashed
-- i think this is as fast as
-- i can get the code.
-- you will notice that the
-- loop only moves a section
-- of memory per frame now.

mode=0
p=0
cls()

function _update60()
  p=1-p
  if mode==0 or mode==1 then
    sfx(0) -- confirm drawing
    fillp(23130)
    if(p>0)fillp(-23131)
    for i=0,15 do
      for j=0,7 do
       rectfill(i*8,j*8,i*8+7,j*8+7,i+j*16)
      end
    end
    if mode==0 then
      memcpy(0,24576,4096)
      mode=1
    elseif mode==1 then
      memcpy(4096,24576,4096)
      mode=2
    end
  else
    if p==0 then
      memcpy(24576,0,4096)
    else
      memcpy(24576,4096,4096)
    end
  end
end

This is a puzzle. If you let it run for about 10-seconds, it DOES clear up and show you a near flawless 256-colors using memory swap of two half-screens - but it doesn't stay. After another 10-seconds it garbles, then fixes itself again. But does not stay.

I had hoped by removing the loop for redrawing the colors and writing a loop of memory moves only would speed it up, but apparently it still can't perfectly synchronize.

I noticed online (running in an internet window) it seems to run better with less flicker, so something good is happening there.

Can some Coding Wizard figure out how to get this to run flawlessly (in IDE and as EXE) each time with no period of it messing up ? I think this could be of use to others as it would mean more colors for opening logos to PICO-8 carts.

P#66233 2019-07-31 03:56 ( Edited 2019-07-31 03:59)

I'm using this method to get a new blue on the title screen of the game I'm currently testing out. It seems no matter how simple I try to make things it will always stutter a bit. I put in some code to detect when the game isn't running near 60fps to stop the effect which helps slightly. I too am curious about what can be done to keep things more consistent.

P#66357 2019-08-04 14:51

Still hurts my eyes to look at, so still unusable.

The best suggestion I've heard was to add to PICO-8 a simple memory location that when poked, blends the next frame on top of the previous one.

P#66370 2019-08-04 23:43

This sounds interesting, @Xii. Code ?

P#68552 2019-10-06 00:46 ( Edited 2019-10-06 00:57)

@dw817 I meant as a feature request to add to PICO-8. It doesn't exist yet :)

P#68582 2019-10-06 17:20 ( Edited 2019-10-06 17:20)

Oh darnit, but yeah, whatta good idea. I can definitely see that, run at 60fps, play back at 30fps with color merges.

I have a list of suggestions I'm working on HERE. Will definitely add yours now:

https://www.lexaloffle.com/bbs/?tid=35330

P#68601 2019-10-07 00:26
1

@dw817 i kind of like how there is tiny glithes, but my eyes dont(.
also i used fillp(-23131) pattern in my game, i hope its ok.

P#121231 2022-11-23 13:20
1

Hi @ioil13.

I have since succeeded this method:

https://www.lexaloffle.com/bbs/?pid=102333

And yes, you are welcome to any of my code with my thanks. :)

P#121236 2022-11-23 14:47

Sorry if this comes in a little late, @Xii. But someone after my own heart:

https://www.lexaloffle.com/bbs/?tid=47549

P#121237 2022-11-23 14:49

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-28 16:11:43 | 0.053s | Q:26