Gconvert: Tileset generator tool

Topics on software tools like TileStudio, comments on documentation and tutorials (or the lack of) should go here.
User avatar
uze6666
Site Admin
Posts: 4449
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Gconvert: Tileset generator tool

Post by uze6666 » Fri Mar 04, 2016 4:44 am

Nebososo contributed a nice little update to gconvert to support custom defines for tiles indexes. This is very useful to get static pointers to tiles in your source image that wont be affected by the tileset duplicates removal.

Code: Select all

<?xml version="1.0" ?>
<gfx-xform version="1">
	<input file="../data/tiles.png" type="png" tile-width="8" tile-height="12" />
	<output file="../data/tiles.inc">
		<tiles var-name="lode_tileset"/>
		<maps pointers-size="8">
			<map var-name="title3" top="4" left="23" width="1" height="1"/>
			<map var-name="title4" top="6" left="1" width="9" height="1"/>
		</maps>
		<defines>
			<define def-name="SKY_TILE" left="0" top="1"/>
			<define def-name="GROUND_TILE" left="10" top="1"/>
		</defines>
	</output>
</gfx-xform>

User avatar
D3thAdd3r
Posts: 2422
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: Gconvert: Tileset generator tool

Post by D3thAdd3r » Sat Mar 05, 2016 9:02 am

Nice, this is a very handy addition to have.

User avatar
L4rry
Posts: 239
Joined: Sun Dec 28, 2014 7:19 am
Location: Cape Town, South Africa

Mega tile compression using gconvert

Post by L4rry » Thu Jun 16, 2016 1:06 pm

I've implemented mega tile level compression in the gconvert tool. This allows a user to define a big level map that would normally be too large to be practical (eg. when doing big scrolling levels). The tool will then automatically create a 'mega map' with de-duplicated mega tiles. The original level map will then index the mega map instead of the tile map. The mega map in turn indexes the tile map. Now you can draw out your entire scrolling level in your favorite graphics editor and gconvert will perform this compression for you automatically on request. Below is an example configuration and conversion. I hope the community finds this useful.

Code: Select all

        <mega-map var-name="map_level_mega_tiles" mega-tile-width="5" mega-tile-height="5">
            <map var-name="map_level_1" left="0" top="10" width="255" height="25"/>
            <map var-name="map_level_2" left="0" top="62" width="255" height="25"/>
            <map var-name="map_level_3" left="0" top="88" width="255" height="25"/>
            <map var-name="map_level_4" left="0" top="114" width="255" height="25"/>
            <map var-name="map_level_5" left="0" top="140" width="255" height="25"/>
        </mega-map>
        <mega-map var-name="map_extra_mega_tiles" mega-tile-width="4" mega-tile-height="5">
            <map var-name="map_level_6" left="0" top="36" width="32" height="25"/>
        </mega-map>
Example conversion:

Code: Select all

...
#define MAP_LEVEL_6_WIDTH 8
#define MAP_LEVEL_6_HEIGHT 5
const char map_level_6[] PROGMEM ={
8,5
,0x0,0x1,0x2,0x3,0x4,0x5,0x6,0x7,0x8,0x9,0x0,0xa,0xb,0x0,0x3,0xc,0xd,0xe,0xf,0x10
,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x6,0xc,0x1d,0x3,0x1e,0x1f,0x3,0x20};
#define MAP_EXTRA_MEGA_TILES_MEGA_TILE_WIDTH 4
#define MAP_EXTRA_MEGA_TILES_MEGA_TILE_HEIGHT 5
#define MAP_EXTRA_MEGA_TILES_MEGA_TILE_COUNT 33
const char map_extra_mega_tiles[] PROGMEM ={
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1d,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x1d,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
...
The code has been tested and works fine.

I've opened a pull request (https://github.com/Uzebox/uzebox/pull/60) from the fork I used to build this. Hope that's the correct way of contributing. Let me know if you want me
to approach this differently or of course any comments, changes or fixes you would like me to apply to the pull request.

User avatar
D3thAdd3r
Posts: 2422
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: Gconvert: Tileset generator tool

Post by D3thAdd3r » Fri Jun 17, 2016 11:54 pm

Very handy feature, I think this will help people to make actual scrolling games or just big games in general when everything is all built into the standard tool. I will test it and report back.

User avatar
nicksen782
Posts: 667
Joined: Wed Feb 01, 2012 8:23 pm
Location: Detroit, United States
Contact:

Re: Gconvert: Tileset generator tool

Post by nicksen782 » Thu Nov 17, 2016 6:19 pm

Lee, have you had a chance to look at this? I'm pretty sure I could implement something like this in my gconvert rewrite. Lots of saved flash!

User avatar
D3thAdd3r
Posts: 2422
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: Gconvert: Tileset generator tool

Post by D3thAdd3r » Fri Nov 18, 2016 9:39 pm

Bah, I really should get a bit more done on the scrolling game..so far graphics resources only...and have not yet generated real map data to convert and scroll. Before long I should be using it, and I'd say definitely would be a great thing to have in your HTML 5 Uzebox IDE.

User avatar
Artcfox
Posts: 944
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: Gconvert: Tileset generator tool

Post by Artcfox » Thu Feb 23, 2017 5:22 am

Has anyone else had a chance to test this? Should I merge it?

User avatar
nicksen782
Posts: 667
Joined: Wed Feb 01, 2012 8:23 pm
Location: Detroit, United States
Contact:

Re: Gconvert: Tileset generator tool

Post by nicksen782 » Thu Feb 23, 2017 4:00 pm

I have my own re-write of gconvert (intended for mode 3 and some special features I've added.) An important feature is that tiles that are that NOT used by a tilemap are NOT included in the resulting tileset. That, and it is web-based and 100% Javascript. It's part of my UAM suite (the 0.60 rewrite) I could make a direct demo video of the features.

I am interested in megatiles/metatiles because I think it will take less data to store a screen map (around 150 bytes vs 600.) I use the SD card for maps so I'm not terribly worried but it would be nice to cut the space usage in half anyway.

If you look at the Block Boy code (thanks again, Lee!) you'll see that he is using metatiles and doing some math with offsets. He's said that much of it was by hand. I would rather write a tool to do that instead. I'm using a tool to 'recompile' the binary file for my game by just clicking a button. This metatile and binary data file stuff is too complex to do by hand all the time.

So, the whole idea of metatiles is really just a sort of compression in a way, right? A metatile index would expand to the tiles that make up that metatile and you provide the dimensions? That is what I saw in Block Boy. It's kinda like DrawMap2 then, isn't it?

User avatar
D3thAdd3r
Posts: 2422
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: Gconvert: Tileset generator tool

Post by D3thAdd3r » Sat Feb 25, 2017 1:10 am

nicksen782 wrote: So, the whole idea of metatiles is really just a sort of compression in a way, right?
Basically yes. Most Uzebox/NES games etc are based on these 2x2 tile(I have seen is referred to as something like "Tile Squaroid"?! in the NES circle), 16x16 pixel constructs since it is smaller, and faster to deal with larger/fewer logical chunks, quicker to make maps, and is generally some relevant size in comparison to the main player movement speed. 4x4 is not unheard of either.
nicksen782 wrote: I use the SD card for maps so I'm not terribly worried but it would be nice to cut the space usage in half anyway.
It's good thinking not to waste space even when the SD provides so much. Eventually the shared medium is not so infinite. For 4 way scrolling, you really want the data small since then it takes less time to read from the SD card. You can do a lot of decompressing in the amount of time it takes to read from the SD.
Artcfox wrote:Has anyone else had a chance to test this? Should I merge it?
This doesn't really conflict with any of the existing tools right, as it is all your web based development environment? I have checked out your stuff several times and I think it would be good to have it merged. Some people will find this environment appealing, and it will probably get developed more and more well known being there. It can potentially be a much more friendly way to get people making games. Any other opinions?

User avatar
L4rry
Posts: 239
Joined: Sun Dec 28, 2014 7:19 am
Location: Cape Town, South Africa

Re: Gconvert: Tileset generator tool

Post by L4rry » Mon Mar 06, 2017 10:30 pm

Artcfox wrote:Has anyone else had a chance to test this? Should I merge it?
D3thAdd3r wrote:This doesn't really conflict with any of the existing tools right, as it is all your web based development environment? I have checked out your stuff several times and I think it would be good to have it merged. Some people will find this environment appealing, and it will probably get developed more and more well known being there. It can potentially be a much more friendly way to get people making games. Any other opinions?
I think the question might be referring to the pull request for the Mega/Meta tile compression I did for the C++ gconvert tool instead of the new Javascript based level design tool being designed by 'nicksen782'.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest