Author Topic: PNG to CPC for Open Street Maps mapping... Games using Maps Anyone?  (Read 523 times)

0 Members and 1 Guest are viewing this topic.

Offline zhulien

  • 6128 Plus
  • ******
  • Posts: 917
  • Country: au
  • aka Vorax
    • 8bitology
    • Awards
Hi,has anyone written logic for PNG loading on a CPC,or better still... in PHP taking a PNG file and converting it to CPC (Mode 1 is preferable, but possibly mode 0).


Something like this but in PHP, not GO


https://github.com/jeromelesaux/martine 

Julian

« Last Edit: 18:09, 05 October 21 by zhulien »
like
0
No reactions

Offline eto

  • Supporter
  • 6128 Plus
  • *
  • Posts: 509
  • Country: de
    • Awards
Re: PNG to CPC
« Reply #1 on: 09:43, 04 October 21 »
I've done something in JAVA that accepts any 160x200 image and converts it into a SCR file (MODE 0). Very simplistic and not much more than a script. I can post the source code if that helps to understand the process.
like
0
No reactions

Offline Bryce

  • The Hardware Guy.
  • Supporter
  • 6128 Plus
  • *
  • Posts: 12.500
  • Country: wf
  • It's not broken, it just hasn't been fixed yet.
    • index.php?action=treasury
    • Awards
Re: PNG to CPC
« Reply #2 on: 09:54, 04 October 21 »
I had a program (not written by me) that converted BMP to CPC. I'll see if I can find that.

Bryce.


Edit: Found it: https://www.cpcwiki.eu/index.php/ConvImgCPC
« Last Edit: 09:59, 04 October 21 by Bryce »
like
0
No reactions

Offline eto

  • Supporter
  • 6128 Plus
  • *
  • Posts: 509
  • Country: de
    • Awards
Re: PNG to CPC
« Reply #3 on: 11:03, 04 October 21 »
like
0
No reactions

Offline ajcasado

  • Supporter
  • CPC664
  • *
  • Posts: 91
  • Country: es
    • Awards
Re: PNG to CPC
« Reply #4 on: 11:46, 04 October 21 »
Something like this but in PHP, not GO

https://github.com/jeromelesaux/martine 
You can run the martine shell executable from PHP.
like
0
No reactions
CPC 664

Empiezas a envejecer cuando dejas de aprender.
You start to get old when you stop learning.

Offline MiguelSky

  • 464 Plus
  • *****
  • Posts: 401
  • Country: es
    • CPCGamesCD
    • Awards
Re: PNG to CPC
« Reply #5 on: 12:29, 04 October 21 »
El CPC Paint included on JavaCPC works quite well.


EDITO: Oh, I missed the PHP part of thew request  :picard:
like
0
No reactions

Offline zhulien

  • 6128 Plus
  • ******
  • Posts: 917
  • Country: au
  • aka Vorax
    • 8bitology
    • Awards
Re: PNG to CPC
« Reply #6 on: 15:39, 05 October 21 »
I have put in place some image processing for PNG to an output, the output i can write whatever i choose - either a CPC sprite in a given mode.
« Last Edit: 18:10, 05 October 21 by zhulien »
like
0
No reactions

Offline zhulien

  • 6128 Plus
  • ******
  • Posts: 917
  • Country: au
  • aka Vorax
    • 8bitology
    • Awards
Re: PNG to CPC
« Reply #7 on: 18:01, 05 October 21 »
This is only a POC, it is doing the first bit consisting of a bit of my code and another service. 


I was thinking if Open Street Maps is available for CPC, it could be useful for some games.  I have specifically locked the coordinates, for now but you can play with the zoom level.

It is retrieving a PNG, but ultimately it would have the option to retrieve a CPC-compatible sprite.  I have fixed the tile size to 200x200pixels which fits nicely in Mode 1.  I am thinking Mode 1 has enough colours to make the map recognisable still.


https://8bitology.net/poc/cpcmap/cpcmap.php?zoom=16  (zoom is valid between 0 and 19).

The terrain option uses a different 3rd party service again that likely I cannot redevelop.

https://8bitology.net/poc/cpcmap/cpcmap.php?zoom=15&style=terrain (zoom is valid between 0 and 15)






« Last Edit: 18:02, 05 October 21 by zhulien »
like
0
No reactions

Offline zhulien

  • 6128 Plus
  • ******
  • Posts: 917
  • Country: au
  • aka Vorax
    • 8bitology
    • Awards
Re: PNG to CPC
« Reply #8 on: 18:09, 05 October 21 »
btw, if i were to make a game, I would either use Mode 1 with the map to the right or left leaving 120 pixels for menus, scoring, statuses etc (thinking Red Alert on a global scale)...  or a vertical orientation like Arkanoid could work too.  Being Vertical would make it easier to switch between tiles of eg: streets (4 colours) vs terrain (16 colours) with a split mode for scores etc.


Once converted to CPC sprite and compressed (RLE?) then the file sizes should be very small, and the M4 can quickly transfer them to SD Card for CPC's local caching.

https://8bitology.net/poc/cpcmap/cpcmap.php?zoom=8&style=terrain  (perhaps terrain would look better in mode 0?)


The 3rd image below is equivalent to the 200x200 one, but double-width pixels of mode 0 (on CPC it would be 100x200).






« Last Edit: 18:17, 05 October 21 by zhulien »
like
0
No reactions

Offline zhulien

  • 6128 Plus
  • ******
  • Posts: 917
  • Country: au
  • aka Vorax
    • 8bitology
    • Awards
To map RGB values from a PNG to the CPC pallet, what would be a good algorithm for colour reduction?
like
0
No reactions