Upcoming obscure video modes

Topics related to the API, programming discussions & questions, coding tips, bugs, etc. should go here.
User avatar
Janka
Posts: 214
Joined: Fri Sep 21, 2012 10:46 pm
Location: inside Out

Re: Upcoming obscure video modes

Post by Janka »

D3thAdd3r wrote:Very interesting, I wonder though how sprites will work? What happens when an overlapping sprite on tile breaks the pair rules?
That's no problem as the RAM tiles are still direct video. They can have all possible colors in each pixel.
User avatar
D3thAdd3r
Posts: 3221
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: Upcoming obscure video modes

Post by D3thAdd3r »

Reading better, appears I imagined reducing actual ram tile size there
User avatar
Janka
Posts: 214
Joined: Fri Sep 21, 2012 10:46 pm
Location: inside Out

Re: Upcoming obscure video modes

Post by Janka »

My original idea for this 16x4 video mode was having smoother vertical scrolling and having fewer background tiles because of getting rid of the combinations. It was pure coincidence that it also allows a palette and half the flash size for background tiles, and this all at the original resolution of mode 3 and with only small tweaking to mode 3. :mrgreen:

To reflect my feeling about this, I now have to dress up only in a towel, run through the streets and shout EUREKA! :P
User avatar
D3thAdd3r
Posts: 3221
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: Upcoming obscure video modes

Post by D3thAdd3r »

Cool, I'd like to see what quality of graphics can be achieved and how easily within those rules. Are you considering an 8x8 text section like mode 4 has?
User avatar
Janka
Posts: 214
Joined: Fri Sep 21, 2012 10:46 pm
Location: inside Out

Re: Upcoming obscure video modes

Post by Janka »

D3thAdd3r wrote:Cool, I'd like to see what quality of graphics can be achieved and how easily within those rules.
I'm halfway through with my PCX->tileset/palette tool. I've used the background tileset of Würgertime for some tests.
tiles.png
tiles.png (5.21 KiB) Viewed 6909 times
The statistics for that tileset found out by my new tool are promising:

Code: Select all

Tileset statistics
==================
128x152px in 8x38 tiles -> 19456 bytes without palette mode.
289 palette entries, 131 color pairs above threshold of 10 occurences.

Coordinates of pairs below or at occurence threshold:
=====================================================
274a
	(38|22)px == (2.6|5.2) tile.intile

7f07
	(30|27)px == (1.14|6.3) tile.intile

1aa9
	(46|51)px == (2.14|12.3) tile.intile

3fa9
	(44|55)px == (2.12|13.3) tile.intile

0606
	(64|57)px == (4.0|14.1) tile.intile

ff92
	(26|73)px == (1.10|18.1) tile.intile

ff5b
	(110|87)px == (6.14|21.3) tile.intile

8584
	(12|88)px == (0.12|22.0) tile.intile

ff99
	(30|147)px == (1.14|36.3) tile.intile

e414
	(68|0)px == (4.4|0.0) tile.intile

14e4
	(122|0)px == (7.10|0.0) tile.intile

ff3f
	(106|5)px == (6.10|1.1) tile.intile
	(66|29)px == (4.2|7.1) tile.intile

[...]
Ok, there has to be a palette of 289 entries to allow this tileset to be used without any change in display. Not possible. But the tool found out there are only 131 color pairs which are used more than 10 times (this number is configureable in the tool). So there are 158 seldom used palette entries, which the graphics designer should review and replace by a more common pair. The tool gives coordinates. That way, a graphics designer can eliminate palette entries being seldom used and "don't care" for him, until finding the palette is small enough to fit into remaining RAM.

E.g. 274a (38|22)px == (2.6|5.2) tile.intile is the dot of the exclamation mark of the "HURRY!" text in the tileset and the background color pixel right of it. That one was accidentially coloured differently than the rest -> hooray, only 287 palette entries left. The next one is the yellow-red pair in the H of OUCH!, which could be colored yellow-yellow or red-red, too, without losing anything in semantics or artwork. And further...

And if you find it too tedious, I can even think of some automatic which tries to find the nearest color existing in one of the more common palette entries.

Are you considering an 8x8 text section like mode 4 has?
I think we could make it configureable per tile line if it should be 2 lines of 16x4 or one line of 8x8. That way the game designer can even do a split-screen.
How does the static overlay works in mode 3?
User avatar
Janka
Posts: 214
Joined: Fri Sep 21, 2012 10:46 pm
Location: inside Out

Re: Upcoming obscure video modes

Post by Janka »

Ok, after one hour of work I'm down to 255 palette entries -> feasible :) Do you see any important difference to the tileset above?
tiles.png
tiles.png (5.17 KiB) Viewed 6904 times
No? Well, then this mode now saves ~10KB of flash *without* notably reduced colours and *with* selective palette effects for color pairs by writing two palette entries (one for color pairs with two pixels of the same color). That all at the expense of 255 bytes RAM, which we could reduce further by putting more work into reducing seldom used color pairs.
User avatar
uze6666
Site Admin
Posts: 4801
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Upcoming obscure video modes

Post by uze6666 »

Image is a bit brighter(?) but otherwise no difference, great work! I'll have to read the thread again, I don't fully grasp your color-pair concept...
User avatar
Janka
Posts: 214
Joined: Fri Sep 21, 2012 10:46 pm
Location: inside Out

Re: Upcoming obscure video modes

Post by Janka »

uze6666 wrote:Image is a bit brighter(?)
Shouldn't be, must be a side effect of converting from xcf->pcx. I've only changed the colors of ~20 pixels to colors which look nearly the same. Most notable difference is with the spatula, it saved 5 palette entries just to skip the shadow on it. I "don't care".
User avatar
Janka
Posts: 214
Joined: Fri Sep 21, 2012 10:46 pm
Location: inside Out

Re: Upcoming obscure video modes

Post by Janka »

I have to correct myself, the calculation above was slightly wrong, as I always counted same-color pairs as only one palette entry, even there were more than 16 in the image. With respect to this, the original image needed 318 palette entries, and the one below needs 256. Still no big difference in how it looks.
tiles.png
tiles.png (5.16 KiB) Viewed 6876 times
User avatar
Janka
Posts: 214
Joined: Fri Sep 21, 2012 10:46 pm
Location: inside Out

Re: Upcoming obscure video modes

Post by Janka »

The direct video to palette video tool is completed :D. It's a Tcl script taking a PCX file as input and generating a C source with palette array and tiles array. Please see the attachment. Now we'd only need the 16x4 video mode.
Attachments
pcxto16x4palettedtiles.tcl.gz
(3.07 KiB) Downloaded 453 times
Post Reply