News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_redbox

Converting standard sprites to Plus hardware sprites

Started by redbox, 03:02, 02 February 10

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

redbox

I couldn't find a utility to convert normal CPC sprites to the Plus hardware sprite format and, as I didn't fancy re-painting all the sprites I wanted to convert, I wrote a utility to do it for me.  I found it quite interesting as I had to work out the pixel format and then use my new Z80 skills to read the data at bit level and write a routine to convert the pixels.

I wrote a wiki page about how I did it which includes a DSK image with the utility on to use.

Hopefully someone will find it useful.

MacDeath

It looks interesting.

maybe some uses may be found for that.

mr_lou

Neat! Any utilities that can help targeting more platforms, are most welcome. :)

Ygdrazil

Yeah, all stuff helping to develop for the CPC is needed!!

/Ygdrazil

Quote from: mr_lou on 07:57, 02 February 10
Neat! Any utilities that can help targeting more platforms, are most welcome. :)

MacDeath

Just a few question :

is this heavy on the system ?

I mean can it be done actually while running a game/programm/demo  as a (sub)part of it ?

As a result you may use it to convert the graphics "on the spot" and instead of saving them on a disc, put them directly in the ASIC sprites slots (or any part of the ram) while the main game/demo/whatever programm process it then.


The main advantages :

A possibility with such subprogramm would be to allows "easily" to a Mode0 piece of graphic to be displayed in a Mode1 or 2 area.

You don't have to "multiply" or to have multiple  raw graphics DATAs (the soft and the hard)... as your Hard Sprites may use the same Graphics as the Software graphic engine.

Also you may get simply different colours.



Evolution :
Perhaps a system to allow this but with Mode1 Datas, yet your main programm would need a part to deal with the Colours, through some kind of "colour attribute" like logic ?

Also a way to patchwork a hard  sprite slot with tiles in 8x8 format (or 4x8 in mode 0) and so on...

And also an application to deal with transparent colour.

Yet all those improuvment may be heavier on the system than to simply put the properly pre-converted graphical DATAs...

So yeah, this is simply usefull to ripp-off existant graphics.

How does it deal with the pixel size changes ?
Your mode0 16x16 graphic (sprite) may pass from wide pixel to square pixels by this mean ?
I suppose when using the sprite, you have to put it on size X=4 Y=1 to keep the Mode0 stuff.

Or this may just be a way to store Hard Sprites Datas using less Ram/Rom, in the mundane Mode0 format instead of the HardSprite format, so the piece of graphic may be used by soft AND hard ?

Also you have to be aware that while your Mode0 sprite is to be 16 colours, the Hard sprite display only 15 real colours (the 16th being for transparency effect).



redbox

Quote from: MacDeath on 16:17, 02 February 10
is this heavy on the system ?

Yes it is, but I wrote it as a utility instead of being for a game/demo etc.  I am sure it could be optimised quite a bit for other uses though.

I like the sound of your new uses and will have to think about possibly incorporating some of them.

Quote from: MacDeath on 16:17, 02 February 10
So yeah, this is simply usefull to ripp-off existant graphics.

It can be used for this purpose, but that wasn't really what I'm using it for.  The problem I faced was that there was no way to import a graphic from the PC to the CPC in the Plus sprite format.  The best utility available for converting PC graphics to CPC format is ConvImgCPC, but this program doesn't have a feature for exporting graphics in the hardware sprite format.

Therefore, I wrote this so that I can import a picture into ConvImgCPC, export it to the CPC, use SPRITER to rip the sprite and then convert it to a Plus hardware sprite using the utility.

Quote from: MacDeath on 16:17, 02 February 10
How does it deal with the pixel size changes ?
Your mode0 16x16 graphic (sprite) may pass from wide pixel to square pixels by this mean ?
I suppose when using the sprite, you have to put it on size X=4 Y=1 to keep the Mode0 stuff.

It doesn't really 'deal' with the pixel size changes; it uses MODE 0 so that you can import a 16 colour image from ConvImgCPC because the Plus hardware sprites support 16 colours (with 0 being transparent of course).  All 16x16 pixels are imported from the MODE 0 sprite in their 'wide pixel' format but then you can then use the magnification setting of the Plus hardware sprite to display it in either a MODE 0,1 or 2 type resolution on the screen.  Hardware sprites can be displayed at their own independent magnification and are not restricted to the MODE of the screen.

fano

Quote from: redbox on 20:43, 02 February 10The problem I faced was that there was no way to import a graphic from the PC to the CPC in the Plus sprite format.
Shame, i wrote a command line utility to convert PC to CPC GFX , you can find it here : http://cpcrulez.fr/forum/viewtopic.php?f=4&t=3818
It allows a lot of format for hard sprites like FLAT/RLE/PACKED/COMPILED/KEYFRAME or for soft sprites/image and utilities functions for Plus palette and DMA sound.
"NOP" is the perfect program : short , fast and (known) bug free

Follow Easter Egg products on Facebook !

redbox

Quote from: fano on 22:33, 02 February 10
Shame, i wrote a command line utility to convert PC to CPC GFX , you can find it here : http://cpcrulez.fr/forum/viewtopic.php?f=4&t=3818
It allows a lot of format for hard sprites like FLAT/RLE/PACKED/COMPILED/KEYFRAME or for soft sprites/image and utilities functions for Plus palette and DMA sound.

Hey that utility sounds great!  It would be good to make a CPCWiki page for it so non-Frenchies can find it.

The download link doesn't work on the forum page though.  Is there anywhere else I can download it?

fano

Didn't have time to translate '.txt' file, if someone would be kind enough to make it  :-*
"NOP" is the perfect program : short , fast and (known) bug free

Follow Easter Egg products on Facebook !

redbox

Quote from: fano on 07:54, 03 February 10
Didn't have time to translate '.txt' file, if someone would be kind enough to make it  :-*

That's great, thanks.  I will have a look and see if I can understand the French  :)

The reason I wrote the CPC utility is that I wanted to convert a 32x32 Atari ST sprite to Plus format.  Because I am using MODE 0 for the background and wanted the sprites to look the same, I thought the best solution for the Plus sprite was to use two 16x16 sprites (one on top of the other) and stretch the sprites horizontally x2 to emulate the MODE 0 pixels which will create a Plus sprite that is 32x32 in appearance.  ConvImgCPC takes care of converting the normal 32x32 sprite into MODE 0 double pixels, but unfortunately it doesn't export this back to a PC format, it only exports to CPC formats.  So then, I use my CPC utility to take care of the conversion.

If I was to use your PC utility for this, I would have to make sure that the PC sprites are already in the MODE 0 double pixel format before importing them to create this pseudo 32x32 imported sprite.

So I think there is a place for both the CPC and PC utility, but of course it's great to have both.  And the DMA sound import is very interesting too...  8)

Longshot

QuoteI couldn't find a utility to convert normal CPC sprites to the Plus hardware sprite format
Just look to B-Asic to do that from mode 0 with CATCH instruction.
http://www.cpcwiki.eu/index.php/B-ASIC
It's also useful to collect and organize sprites data without to lost ram & disk space
(e.g. two hardwares sprites are stored on 256 bytes)
(introducing the notion of fast and slow sprite copy)
( ;D)
Rhaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!!

TFM

Quote from: redbox on 03:02, 02 February 10
I couldn't find a utility to convert normal CPC sprites to the Plus hardware sprite format and...

You can at least grab sprites from OCP screens or normal 17 KB screens using GMSK and make Plus sprites out of them. Look GMSK article in the cpc wiki.
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

redbox

Quote from: Longshot on 17:52, 25 February 10
Just look to B-Asic to do that from mode 0 with CATCH instruction.

Quote from: TFM/FS on 01:26, 26 February 10
You can at least grab sprites from OCP screens or normal 17 KB screens using GMSK and make Plus sprites out of them. Look GMSK article in the cpc wiki.

Thanks guys, I will take a look at both utilities :)

Powered by SMFPacks Menu Editor Mod