Log In  

Hello, I'm currently making my first game and I'm using the compressor from dw817 to store png images in code. Then decompress it at precise moments (One image for intro screen and one for the background).
Everything is fine until I launch the game. The images appear but it's laggy as hell. On my intro screen I have to press the start button 10 times before the game launch, and so it display at max 1 FPS.

I think it's because the method i'm using for these images is way too heavy for the game. Do someone have an idea if there is a better way to display my images ?

In case of, here is my cartridge. The images are stored into draw_splash_screen() and draw_fujisan() functions.

Cart #sushigirl-0 | 2019-05-29 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

Thanks in advance.

P#64830 2019-05-29 12:26

You can't afford to decompress a full screen every frame. Rather than drawing directly to the screen, decompress to the sprite sheet when the game state changes (title screen to in-game, etc.) and draw from there.

P#64833 2019-05-29 15:22

dw817 to compress a single image is useless - you would better store the image bytes as a string and decode them using native pico functions (like sub/tonum)
another alternative is px9 compression from @zep.

P#64840 2019-05-29 18:56 ( Edited 2019-06-01 09:11)

So in fact dw817's tool work only on still cartridge ?

  • you would better store the image bytes as a string

How could I do it efficiently ?

Also PX9 tool seems daunting for someone starting from nothing. I'm starting to learn how pico8 is managing the memory, but where should I start for learning requisite stuff for understanding these parts ?

Thanks for your answers.

P#64883 2019-05-31 06:57 ( Edited 2019-05-31 06:57)
2

Cart #jafizajuse-0 | 2019-06-01 | Code ▽ | Embed ▽ | No License
2

Ping @SyntaxError: demo cart for real-time string to screen display.
How to:

  • import image in cart (import xxxx.png)
  • uncomment spritesheet to string code
  • run cart
  • copy clipboard in text editor (Sublime, VSCode...)
  • remove 0x and . char
  • put everything on 1 line
    Note: these 2 steps could be done in pico-8 code. Exercise left to the reader :]
  • copy string to splash variable
  • run!

Note: this is using poke4 to copy 8 pixels per loop while decoding the string.

P#64908 2019-06-01 07:58 ( Edited 2019-06-01 21:07)

Thanks for the cart, super usefull !

P#65363 2019-06-23 12:53

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2023-05-28 10:21:52 | 0.031s | Q:27