Convert image to V9990 P1 mode

ページ 2/4
1 | | 3 | 4

By aoineko

Paladin (904)

aoineko さんの画像

11-11-2022, 19:36

In B1 mode you have plenty of VRAM to put all your data there when your level start.
Then, you should have zero Z80>VRAM transfert during gameplay and only use VDP commands (to build your background and move your sprites) and registers setting (for scrolling).
I would recommend 512x1024 mode. 512 pixel in vertical for scrolling on 2 screens and 512x812 to put all your data (and temporary buffers).

I don't know exactly what you want to achieve, but if I imagine a vertical shooter with big spaceship, I'd probably go with that option.

By albs_br

Champion (468)

albs_br さんの画像

13-11-2022, 20:45

All the sprites that will be used on the game play don't fit in the vram, so some of them will need to be loaded on demand from ROM. I'm not sure if it will be possible at all.

By assembler

Champion (414)

assembler さんの画像

14-11-2022, 08:29

This is a lot of sprites.

In P1 You can use the second half of VRAM (the one for B plane tiles) to store Sprites, and you can copy on demand to the first half.

By aoineko

Paladin (904)

aoineko さんの画像

14-11-2022, 09:07

albs_br wrote:

All the sprites that will be used on the game play don't fit in the vram, so some of them will need to be loaded on demand from ROM. I'm not sure if it will be possible at all.

In a 512x812 pixels space, you can put 1624 16x16 sprites. I am very surprised that this is not enough.
That said, if you renew a small portion of the VRAM each frame, it is possible to use even more.

Again, you know best what you want to do, but to summarize my advice:
- Lots of small objects (16x16 or less) => P1 mode
- Less big objects (especially if they are really big) => B1 mode (64/256 colors)

And if you choose P1 mode, you can easily have 30 colors by having one palette per layer and compositing your image with tiles from these two layers.

If you want to do this at the pixel level, it's not very complicated, but for the moment there is no tool to do it.

By albs_br

Champion (468)

albs_br さんの画像

14-11-2022, 21:04

aoineko wrote:

Here is the command line I'm using:
MSXimg.exe img\data_bg.png -out %Dest%\v9990\data_v9_bg.h -pos 0 0 -size 256 48 -num 1 1 -name g_DataV9BG -trans 0xFF00FF -bpc 4 -pal custom --pal24

So far I managed to create the BG layer perfectly using your utility, but I'm having a hard time generating the sprites:

I have a 128x144 px image to be converted to V9990 sprites (actually is a bit smaller: 123x142).

The command line I'm using is:
MSXimg.exe frame_1.webp -out output_1.asm -pos 0 0 -size 16 16 -num 8 9 -name g_DataV9BG -trans 0xFFFFFF -bpc 4 -pal custom --pal24

The parameter "-mode sprt" seems to be generating V99x8 sprites, am I right?

By albs_br

Champion (468)

albs_br さんの画像

14-11-2022, 21:47

Update:
-The transparency is now working, with a green bg;
-The sprites are ok using a width of 256, as you said before.

But the palette is still showing crazy colors.

By assembler

Champion (414)

assembler さんの画像

14-11-2022, 22:11

You can specify the palette for each sprite. Which palette are you using for the "sprites bitmap"? You should use that palette in SC5 and SC4 bits for each sprite.

By aoineko

Paladin (904)

aoineko さんの画像

15-11-2022, 00:32

albs_br wrote:

But the palette is still showing crazy colors.

With the V9990 you have 4 palettes of 16-colors to be used by the 2 tiles layers or/and each sprite.
Load your palette with an offset then set the wanted palette in the layers/sprites parameters.

For the MSXgl sample program, I export 3 images with each one its own 16-colors palette which I place at different offset in the 64 entries palette.
- Image 1 (tiles) at offset 0 (palette 0)
- Image 2 (sprites) at offset 16 (palette 1)
- Image 3 (font) at offset 32 (palette 2)
Check the code at : https://github.com/aoineko-fr/MSXgl/blob/main/projects/sampl...

By albs_br

Champion (468)

albs_br さんの画像

15-11-2022, 01:15

Thanks for all help guys.
As always was a small mistake: I was pointing to the wrong MegaROM page when loading the palette Sad

I hope I can show some cool results before the weekend.

By assembler

Champion (414)

assembler さんの画像

16-11-2022, 07:52

Which assembler are you using?

ページ 2/4
1 | | 3 | 4