Log In  

So, I'm expanding my previously released map generator. I've added stuff like biomes, biome generation types, so on so on.
The thing is, I'm making this generator because I want to start an RP community with stuff like being able to claim territory.
My problem: The map is too small. 128x128 is not a high enough resolution for this map. I've modified for the map generator to work on 256x256 pixels, but that would mean I would have to take four screenshots and manually stitch them together, which is a very frustrating process.
So, my question is, is it possible to take a 256x256px screenshot?
Cheers.
EDIT: I think it's worth noting that for automatically taking screenshots in my code is done with

extcmd('screen')

which could be a slight problem.

P#88404 2021-03-02 09:37 ( Edited 2021-03-02 09:39)

:: merwok

You can write 'screenshot_scale 2' in the config file to achieve this.

Edit: I misunderstood your request! Would a map export fix your problem? 'export game.map.png'
(that won’t include sprites, text or other shapes)

P#88425 2021-03-02 22:06 ( Edited 2021-03-02 22:08)

@merwok Unfortunately, no. The map generator puts pixels on screen using pset and circfill, and I'm entirely sure you can't save that to the map, especially persistently.

P#88441 2021-03-03 10:28
:: merwok

The only automated way I see is to use one of the serial channels (standard output or '-o filename' parameter, only for standalone pico8 program (not HTML export)), have the game draw one screen then send screen data to the channel, repeat for 4 parts of the screen, then have another script (in python or lua or anything you know) that receives the data and stitches it together.

P#89733 2021-03-30 01:10
:: merwok

Oh! Actually it should be possible to save a screenful of pixels to the map. Put pixels on screen like you’re doing, then copy screen memory to spritesheet memory, then you can set the map memory to be sprite 1, sprite 2, etc. up to 256 (can use mset in a loop to start simply, then find the right parameters to use with memset).

P#100355 2021-11-18 18:59
:: dw817
P#100363 2021-11-18 20:01
:: merwok

That tool seem to be the equivalent of 'export game.map.png', but the request here is for a 256x256 capture of the screen (containing arbitrary pixels).

That’s why I suggested copying screen to spritesheet, then make a map with sprites, then you can get an image of the map.

P#100378 2021-11-18 23:08 ( Edited 2021-11-18 23:09)
:: dw817

Well if that's the case, @merwok, then it does seem like my map program was a good idea after all since I wrote it 2-years ago prior to current export .map ability.

@zep always has these wonderful ideas. :)

However, @wallgraffiti, you can certainly create an array thus:

bigscrn={}
for i=0,255 do
  bigscrn[i]={}
  for j=0,255 do
    bigscrn[i][j]=0
  end
end

Then access via:

for i=0,127 do
  for j=0,127 do
    bigscrn[j+128][i]=sget(j,i)
  end
end

That would save your current 128x128 sprite set to the top-right of your 256x256 pixel array.

If you want to copy the actual screen screen, change SGET() to PGET() thus:

for i=0,127 do
  for j=0,127 do
    bigscrn[j+128][i]=pget(j,i)
  end
end

And once again this copies your 128x128 screen to the top-right-hand corner of your 256x256 array.

P#100381 2021-11-18 23:46
:: merwok

Yes, I wasn’t saying your program was not useful (before pico8 added the feature), but that it wasn’t answering the original request :)

Code for a 2D table can be useful, but something more is needed to go from table to picture!

P#100465 2021-11-20 02:54
:: dw817

Well ... How about this ? I could write two programs. One in Pico-8 to take the raw data from the 256x256 array and copy it to clipboard.

Then write a 2nd program that takes the Pico-8 clipboard data and saves a proper PNG or JPG that is 256x256 pixels from the clipboard data.

P#100468 2021-11-20 03:10
:: merwok

That would be one way!

The technique I suggested would work with pico8 only. But it needs to be written in full ;)

P#100482 2021-11-20 07:40
:: dw817

@wallgraffiti, you write the code you need that will fill up the arrays with pixels. Here, go and use this to start if you like:

function _init()
  hex="0123456789abcdef"
  scrn={}
  for i=0,255 do
    scrn[i]={}
    for j=0,255 do
      scrn[i][j]=0
    end
  end
-- here have your code fill up the
-- 256x256 pixel array using single
-- values of 0-15 per pixel.
end

Post your p8.png app in a reply where you have scrn[][] filled with the pixels you want.

Then I'll take your code, finish it for you where it will output a true single 256x256 pixeled .PNG image saved.

P#100502 2021-11-20 20:24 ( Edited 2021-11-20 20:25)

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2022-01-20 17:45:08 | 0.052s | Q:25