News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_zhulien

PNG to CPC for Open Street Maps mapping... Games using Maps Anyone?

Started by zhulien, 01:34, 04 October 21

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

zhulien

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


eto

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.

Bryce

#2
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

eto


ajcasado

Quote from: zhulien on 01:34, 04 October 21Something like this but in PHP, not GO

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

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

MiguelSky

El CPC Paint included on JavaCPC works quite well.


EDITO: Oh, I missed the PHP part of thew request  :picard:

zhulien

#6
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.

zhulien

#7
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)

zhulien

#8
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).




zhulien

To map RGB values from a PNG to the CPC pallet, what would be a good algorithm for colour reduction?

Powered by SMFPacks Menu Editor Mod