Yet Another Tilemap and Super Scaler Demo

Ask anything your want about the 32X Mushroom programming.

Moderator: BigEvilCorporation

Vic
Interested
Posts: 27
Joined: Wed Nov 03, 2021 6:01 pm

Yet Another Tilemap and Super Scaler Demo

Post by Vic » Sat Jan 08, 2022 4:43 pm

Download: https://github.com/viciious/yatssd/releases/tag/1.0
Source Code: https://github.com/viciious/yatssd

Image

Features:
- draws tilemap of arbitrary size, exported from Tiled
- scrolls in any direction, avoiding redraw as much as possible using the dirty rectangles approach
- uses the shift-register for smooth scrolling
- can handle an arbitrary number of sprites, all fully clipped
- adjustable clipping region for sprites: see the draw_setScissor call
- uses both CPUs to draw tiles and sprites
- sprites can be flipped on X and Y axis and/or scaled
- "imprecise" rendering: sprites can be scaled using a cheaper and faster algorithm, the X coordinate is also snapped to the nearest even value
- the code also supports flipping of tiles, although the tilemap format would need to be extended for that
- same for multiple tile layers: it can handle an arbitrary number of layers, albeit without parallax, which would should be easy to add
- the sprites and tiles can be of any size in either dimension, although if you to plan to use scaling, the size should be a power of 2
- sprites can be scaled to an arbitrary size
- works on real hardware

Press B to toggle the debug HUD on and off. Pressing C toggles between various flipping modes for sprites, then it switches to "imprecise" rendering.

ob1
Very interested
Posts: 463
Joined: Wed Dec 06, 2006 9:01 am
Location: Aix-en-Provence, France

Re: Yet Another Tilemap and Super Scaler Demo

Post by ob1 » Mon Jan 10, 2022 2:54 pm

So many great new stuff!
It's nothing short of Amazing Vic.

I'm not sure the 32X had such a good year since ... 1994 ?!

Vic
Interested
Posts: 27
Joined: Wed Nov 03, 2021 6:01 pm

Re: Yet Another Tilemap and Super Scaler Demo

Post by Vic » Mon Sep 05, 2022 12:45 pm

Since the original post I've added a few new features:
- Tiled plugins that allow exporting maps and tilesets in YATSSD-compatible format
- Support for Tiled parallax factor
- Support for up to 2 bitmap layers on the MD side: create a bitmap layer in Tiled and assign class "MD_PlaneA" or "MD_PlaneB"
- Sprites layer: sprites will be drawn in the object layer if there's one; this allow sandwiching sprites between different layers
- Tile flipping
- Global wrap attributes: assign custom properties "wrap-x" and/or "wrap-y" to your tilemap and the map will wrap around the specified coordinate value(s)
- Various optimizations and bugfixes

Tomahomae
Very interested
Posts: 56
Joined: Sat Jan 27, 2018 2:50 am
Location: Russia

Re: Yet Another Tilemap and Super Scaler Demo

Post by Tomahomae » Mon Sep 05, 2022 2:00 pm

Before the graphic convertation to 32X format, should I choose a Tiled parameters manually, or there is a ready templates for image covertation to form digestible for YATSSD? Must yatssd/extensions/ folder content be imported by Tiled, or this is a part of YATSSD by itself?

Vic
Interested
Posts: 27
Joined: Wed Nov 03, 2021 6:01 pm

Re: Yet Another Tilemap and Super Scaler Demo

Post by Vic » Mon Sep 05, 2022 2:28 pm

Copy the *.js files from extensions directory to Tiled plugins directory. You can locate the directory by clicking the "Open.." button Tiled's Plugins dialog: Edit -> Preferences -> Plugins

From there on you'd be able to export your tilesets and tilemaps in YATSSD-compatible format using File -> Export As...

Your tilemap graphics must be in 8-bit paletted format.

Tomahomae
Very interested
Posts: 56
Joined: Sat Jan 27, 2018 2:50 am
Location: Russia

Re: Yet Another Tilemap and Super Scaler Demo

Post by Tomahomae » Mon Sep 05, 2022 3:27 pm

Vic wrote:
Mon Sep 05, 2022 2:28 pm
Copy the *.js files from extensions directory to Tiled plugins directory. You can locate the directory by clicking the "Open.." button Tiled's Plugins dialog: Edit -> Preferences -> Plugins

From there on you'd be able to export your tilesets and tilemaps in YATSSD-compatible format using File -> Export As...

Your tilemap graphics must be in 8-bit paletted format.
What tile size must be?

Vic
Interested
Posts: 27
Joined: Wed Nov 03, 2021 6:01 pm

Re: Yet Another Tilemap and Super Scaler Demo

Post by Vic » Mon Sep 05, 2022 4:01 pm

Any power of 2 ought to work. Anything from 8x8 up to 32x32.

Tomahomae
Very interested
Posts: 56
Joined: Sat Jan 27, 2018 2:50 am
Location: Russia

Re: Yet Another Tilemap and Super Scaler Demo

Post by Tomahomae » Tue Sep 06, 2022 6:58 am

Is msx font the same that used for debug text output?

Vic
Interested
Posts: 27
Joined: Wed Nov 03, 2021 6:01 pm

Re: Yet Another Tilemap and Super Scaler Demo

Post by Vic » Tue Sep 06, 2022 7:24 am

Yes

Tomahomae
Very interested
Posts: 56
Joined: Sat Jan 27, 2018 2:50 am
Location: Russia

Re: Yet Another Tilemap and Super Scaler Demo

Post by Tomahomae » Tue Sep 06, 2022 8:18 am

Then what should I do, if I want to import own font file?

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Re: Yet Another Tilemap and Super Scaler Demo

Post by Chilly Willy » Tue Sep 06, 2022 9:35 am

Convert the font to 2 colors so each pixel is a bit. So 8x8 fonts become one byte wide by 8 tall. Convert the binary into strings of bytes like those in font.c. Make a new font.c file with your font. Note that it doesn't NEED to be character strings of bytes... you could do it as arrays of longs. What's important is the data itself. Each bit is a pixel, and each tile is 8 pixels (bits) by 8 lines. If you wish to make the font a different size, you'll have to change the code in hw_32x.c to match the font size. The drawing is done by debug_put_char_8 (which draws in 8 bit per pixel mode) or debug_put_char_16 (which draws in 16 bits per pixel mode).

Tomahomae
Very interested
Posts: 56
Joined: Sat Jan 27, 2018 2:50 am
Location: Russia

Re: Yet Another Tilemap and Super Scaler Demo

Post by Tomahomae » Tue Sep 06, 2022 11:35 am

Only 1 bit depth? But how then to use a 4bpp tile fonts (through the MD GFX layers withal)?

Vic
Interested
Posts: 27
Joined: Wed Nov 03, 2021 6:01 pm

Re: Yet Another Tilemap and Super Scaler Demo

Post by Vic » Tue Sep 06, 2022 3:08 pm

Tomahomae wrote:
Tue Sep 06, 2022 11:35 am
Only 1 bit depth? But how then to use a 4bpp tile fonts (through the MD GFX layers withal)?
4bpp MD fonts simply aren't supported.

Look, YATSSD is just a proof-of-concept demo with limited functionality, not a fully fledged SDK. If case you need some some functionality that's missing, you gonna have to write some code.

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Re: Yet Another Tilemap and Super Scaler Demo

Post by Chilly Willy » Tue Sep 06, 2022 11:06 pm

If you look at D32XR, it actually uses a MD side font for debug printing. This font uses a nibble per pixel, with 0 at the background color, and F as the foreground color. These are used so that you can just AND with the foreground and background colors to make the font use whatever color you want (part of the D32XR 68K code). So if you want a multi-color MD side font, look at D32XR instead of yatssd.

Vic
Interested
Posts: 27
Joined: Wed Nov 03, 2021 6:01 pm

Re: Yet Another Tilemap and Super Scaler Demo

Post by Vic » Wed Sep 07, 2022 7:57 am

Note that if you're planning to use MD planes for drawing font glyphs, you won't be able to use them in your tilemaps.

Post Reply