Author Topic: Converting standard sprites to Plus hardware sprites  (Read 3489 times)

0 Members and 1 Guest are viewing this topic.

Offline redbox

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.751
  • Country: gb
    • redbox
  • Liked: 326
  • Likes Given: 267
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.

Offline MacDeath

  • Chaotic post writer and mock-up specialist
  • Supporter
  • 6128 Plus
  • *
  • Posts: 4.061
  • Country: fr
  • Liked: 1171
  • Likes Given: 653
Re: Converting standard sprites to Plus hardware sprites
« Reply #1 on: 06:34, 02 February 10 »
It looks interesting.

maybe some uses may be found for that.

Offline mr_lou

  • 6128 Plus
  • ******
  • Posts: 3.164
  • Country: dk
    • index.php?action=treasury
    • 8-bit Memoirs - a Blu-ray diskmag-like eBook about the 8-bit era
  • Liked: 1329
  • Likes Given: 2635
Re: Converting standard sprites to Plus hardware sprites
« Reply #2 on: 08:57, 02 February 10 »
Neat! Any utilities that can help targeting more platforms, are most welcome. :)

Offline Ygdrazil

  • Global Moderator
  • 464 Plus
  • *****
  • Posts: 493
  • Country: dk
  • Liked: 48
  • Likes Given: 259
Re: Converting standard sprites to Plus hardware sprites
« Reply #3 on: 11:21, 02 February 10 »
Yeah, all stuff helping to develop for the CPC is needed!!

/Ygdrazil

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

Offline MacDeath

  • Chaotic post writer and mock-up specialist
  • Supporter
  • 6128 Plus
  • *
  • Posts: 4.061
  • Country: fr
  • Liked: 1171
  • Likes Given: 653
Re: Converting standard sprites to Plus hardware sprites
« Reply #4 on: 17:17, 02 February 10 »
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).


« Last Edit: 17:28, 02 February 10 by MacDeath »

Offline redbox

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.751
  • Country: gb
    • redbox
  • Liked: 326
  • Likes Given: 267
Re: Converting standard sprites to Plus hardware sprites
« Reply #5 on: 21:43, 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.

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.

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.
« Last Edit: 21:45, 02 February 10 by redbox »

Offline fano

  • Supporter
  • 6128 Plus
  • *
  • Posts: 835
  • Country: fr
  • Easter Egg Programmer
    • Easter Egg
  • Liked: 278
  • Likes Given: 614
Re: Converting standard sprites to Plus hardware sprites
« Reply #6 on: 23:33, 02 February 10 »
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.
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 !

Offline redbox

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.751
  • Country: gb
    • redbox
  • Liked: 326
  • Likes Given: 267
Re: Converting standard sprites to Plus hardware sprites
« Reply #7 on: 01:21, 03 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?

Offline fano

  • Supporter
  • 6128 Plus
  • *
  • Posts: 835
  • Country: fr
  • Easter Egg Programmer
    • Easter Egg
  • Liked: 278
  • Likes Given: 614
Re: Converting standard sprites to Plus hardware sprites
« Reply #8 on: 08:54, 03 February 10 »
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 !

Offline redbox

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.751
  • Country: gb
    • redbox
  • Liked: 326
  • Likes Given: 267
Re: Converting standard sprites to Plus hardware sprites
« Reply #9 on: 11:45, 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)

Offline Longshot

  • CPC664
  • ***
  • Posts: 102
  • Country: fr
    • Logon System Web Site
  • Liked: 101
  • Likes Given: 21
Re: Converting standard sprites to Plus hardware sprites
« Reply #10 on: 18:52, 25 February 10 »
Quote
I 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)
Rhaaaaaa

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1983
  • Likes Given: 4650
Re: Converting standard sprites to Plus hardware sprites
« Reply #11 on: 02:26, 26 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

Offline redbox

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.751
  • Country: gb
    • redbox
  • Liked: 326
  • Likes Given: 267
Re: Converting standard sprites to Plus hardware sprites
« Reply #12 on: 12:14, 26 February 10 »
Just look to B-Asic to do that from mode 0 with CATCH instruction.

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