Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - 3bpp tile editor

Reply to topic
Author Message
  • Joined: 06 May 2012
  • Posts: 52
  • Location: France
Reply with quote
3bpp tile editor
Post Posted: Sun Jun 03, 2012 7:57 pm
Last edited by jmimu on Mon Jul 23, 2012 7:46 pm; edited 1 time in total
Hi,
I'd like to present a little tile editor that I made because I couldn't find an editor working in 3bpp mode.

http://jmimu.free.fr/mastertileconverter

My goal was to modify Alex sprite in Alex Kidd in Miracle World.
Maybe it already exists in some editors, but I didn't see it, or didn't understand.

I named id "Master tile converter", maybe because my only SMS for 17 years was a master gear converter...
You can download a Windows binary version or the sources there:

https://github.com/jmimu/Master-Tile-Converter

It works well under GNU/Linux and uses GPL License.

My editor is a little different from what I saw because you can't actually draw tiles. You export a BMP file of a section of the ROM and after a modification in a real bitmap editor you can import it in the ROM.

I like that because it makes saving files easy, and you can also use your modified images to patch several ROMs (like PAL or KR versions).
You can find more information in the readme file on github.
  View user's profile Send private message Visit poster's website
  • Joined: 06 May 2012
  • Posts: 52
  • Location: France
Reply with quote
Post Posted: Mon Jul 23, 2012 7:44 pm
Hi,
I'm still working on my little tile editor and I added compressed tiles importation (using TileDecoder to compress).
It works, but I have some wrong colors at the bottom of the tiles.

Here is an example of the modifications I made in Alex Kidd and the result in game.

The horizontal lines you can see on the character shows the last lines of the tiles.

Do anyone have an idea about what went wrong ? Is it a case of bigger-than-the-original compressed tiles ?
I also tried with the original tiles, and there is the same problem. This may be a difference in compression method, but since TileDecoder can decompress it correctly I assumed it was OK...

Thank you !
mange_travail.png (3.82 KB)
work on eat animation
mange_travail.png
Screenshot-7.png (6.84 KB)
image in game
Screenshot-7.png

  View user's profile Send private message Visit poster's website
  • Joined: 06 May 2012
  • Posts: 52
  • Location: France
Reply with quote
Post Posted: Thu Aug 30, 2012 6:32 pm
I think I haven't used TileDecoder correctly.

I implemented tile compression and decompression in my software and all is working good.
I have to update the documentation...
  View user's profile Send private message Visit poster's website
  • Joined: 06 May 2012
  • Posts: 52
  • Location: France
Reply with quote
Post Posted: Sat Feb 23, 2013 9:58 am
Hi!

There is a new version of Master Tile Converter!
You can download it here (windows exe):
http://jmimu.free.fr/mastertileconverter/downloads/mastertileconverter_win_v07.zip

To get the source and the documentation it's always here:
http://jmimu.free.fr/mastertileconverter/

I made many changes, after Maxim's remarks http://www.smspower.org/forums/viewtopic.php?t=13956

Some of the new features:

    - browse using scrollbar
    - make bookmarks
    - load palette from ROM
    - find where a palette may be in ROM
    - save your work as a project
    - bug fix


I hope it may be useful.
  View user's profile Send private message Visit poster's website
  • Joined: 12 Feb 2013
  • Posts: 80
Reply with quote
Post Posted: Sun Feb 24, 2013 7:10 pm
Thank you. Very nice tool.
  View user's profile Send private message
  • Joined: 06 May 2012
  • Posts: 52
  • Location: France
Reply with quote
Post Posted: Mon Apr 22, 2013 8:30 am
Version 0.8 of Master Tile Converter is finished.

After this year's coding competition I wanted to be able to use MTC for homebrew developement.

Now you can:
    - Export tiles of a ROM into asm (1, 2 , 3 or 4 bpp)
    - Export a palette into assembly
    - Transform a BMP file into asm (1, 2 , 3 or 4 bpp)


You can download it here (windows exe):
http://jmimu.free.fr/mastertileconverter/downloads/mastertileconverter_win_v08.zip

To get the source and the documentation it's always here:
http://jmimu.free.fr/mastertileconverter/
  View user's profile Send private message Visit poster's website
  • Joined: 19 Mar 2013
  • Posts: 16
Reply with quote
Post Posted: Wed Apr 24, 2013 9:30 am
This i will be trying out! I still gotta title screen to hack in Golden Axe Warrior and then i am done my translation.
  View user's profile Send private message
  • Joined: 23 Mar 2013
  • Posts: 573
  • Location: Copenhagen, Denmark
Reply with quote
Alex Kidd hack w. Master Tile Converter
Post Posted: Mon May 27, 2013 9:10 pm
Hello!

I'm experimenting with hacking the graphics of Alex Kidd in Miracle World. I have used Master Tile Converter to locate and export the Alex tiles into Photoshop, where I have successfully painted his fist blue (wow! :) and applied the hack back to the ROM.

I think that Master Tile Converter is a really handy tool, and I want to use it in my attempt to work with the Alex tiles as a base for creating a knight-like hero (see attached image).

I have a question related to the palette: Is there a way for me to extract the full sprite palette (16 colors) for Alex Kidd from MTC? This way I can play with more then just the 7 colors that happens to make up his skin, red outfit and hair.

Can I change the palette - modify some of the colors? Can I write changes to the palette directly into the ROM? The documentation describes a process of palette hacking I do not fully comprehend. I need some grey colors for knight armor, sword, etc.
light souls sprite sheet 1.1.png (4.25 KB)
Alex ... and/or a mysterious knight-like fellow
light souls sprite sheet 1.1.png

  View user's profile Send private message Visit poster's website
  • Joined: 14 Apr 2013
  • Posts: 546
Reply with quote
Post Posted: Mon May 27, 2013 10:34 pm
Hi hang-on,

the ingame palette of Alex Kidd starts at 1fc9e in the rom. So the first visible color of the sprite palette is located at 1fcaf.

Have fun
Calindro
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 13727
  • Location: London
Reply with quote
Post Posted: Tue May 28, 2013 12:52 am
See also http://www.smspower.org/Development/AlexKiddInMiracleWorld-SMS
  View user's profile Send private message Visit poster's website
  • Joined: 23 Mar 2013
  • Posts: 573
  • Location: Copenhagen, Denmark
Reply with quote
Post Posted: Tue May 28, 2013 9:34 am
Thank you guys! This is great!
  View user's profile Send private message Visit poster's website
  • Joined: 14 Apr 2013
  • Posts: 546
Reply with quote
Post Posted: Tue May 28, 2013 4:22 pm
Maxim wrote
See also http://www.smspower.org/Development/AlexKiddInMiracleWorld-SMS


Wow that's great stuff! Is there already any tool (map editor or something like that) based on this information?
  View user's profile Send private message Visit poster's website
  • Joined: 06 May 2012
  • Posts: 52
  • Location: France
Reply with quote
Post Posted: Tue May 28, 2013 6:47 pm
Hi,
Thanks for using MTC!

You can modify palette by changing bytes in correct place.
When you know where the palette is in ROM, choose the color you wan in the 64-color SMS palette (http://www.smspower.org/maxim/HowToProgram/Palette).

Then create an ascii file with just one line like this :
1fcaf:15 *comment
where 1fcaf is the adress of the byte you want to change in ROM (palette adress + 1 byte / color index), and 15 is the hex value of the color (gray).

You can apply it with MTC Hacks>Apply Hack menu.
(you can also use an hex editor, but with the file you have a trace of what you did).



And Alex sprite is only 3bpp, so you can only use the first 8 colors of the sprite palette.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 13727
  • Location: London
Reply with quote
Post Posted: Tue May 28, 2013 7:24 pm
Calindro wrote
Maxim wrote
See also http://www.smspower.org/Development/AlexKiddInMiracleWorld-SMS


Wow that's great stuff! Is there already any tool (map editor or something like that) based on this information?


No :) Some people have made level hacks though. I'd love to see a proper editor.
  View user's profile Send private message Visit poster's website
  • Joined: 23 Mar 2013
  • Posts: 573
  • Location: Copenhagen, Denmark
Reply with quote
Post Posted: Tue May 28, 2013 9:27 pm
I have used Frhed to write the grey color directly into the palette. It works! But something seems strange: When I die I respawn with the same old red suit?

In the ROM I found what seemed to be a structure of multiple palettes - a palette for each level, as researched by Paul Baker. I wrote the grey color into every one of these, but still I come back as red Alex when I die...?
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 13727
  • Location: London
Reply with quote
Post Posted: Tue May 28, 2013 9:36 pm
It's got to be writing the colour from somewhere... Set a cram breakpoint and track it backwards (ie. if it is copied from RAM, set a breakpoint on the source and repeat).
  View user's profile Send private message Visit poster's website
  • Joined: 16 May 2002
  • Posts: 1240
  • Location: italy
Reply with quote
Post Posted: Tue May 28, 2013 10:01 pm
Maxim wrote
I'd love to see a proper editor.
You know I like to write level editors, so I looked at that documentation, but I'm not sure if I understand all of it. I'll see what I can do, but I can't make promises. Also I think this is OT here, I don't like to talk about other things in the topic of a fellow programmer, we can start another topic if needed.
  View user's profile Send private message Visit poster's website
  • Joined: 06 May 2012
  • Posts: 52
  • Location: France
Reply with quote
Post Posted: Wed May 29, 2013 7:18 pm
You can deactivate palette update when you respawn by removing the "OUTA (BEh)" at address 012E (just write 00 00).

I made a hack file for MTC with this :
1fcaf:15 25 2a 3a 15 25 2a *sprite palette lvl 1
12e : 00 00 *remove palette blinking when respawn

to have gray colors for sprite and disable the blinking.
I prefer use MTC instead of an hex editor since it automatically fixes the rom checksum for you.

PS: I'm interested in the Alex level editor idea!
  View user's profile Send private message Visit poster's website
  • Joined: 23 Mar 2013
  • Posts: 573
  • Location: Copenhagen, Denmark
Reply with quote
Post Posted: Thu May 30, 2013 5:45 pm
OK - I will look into the blinking routine.

And thanks again for MTC - also very nice examples included. I could be tempted to try to do my own title screen hack based on your work :)

Edit: I also very much support the idea of an Alex Kidd level editor!
  View user's profile Send private message Visit poster's website
  • Joined: 06 May 2012
  • Posts: 52
  • Location: France
Reply with quote
Post Posted: Fri Oct 11, 2013 12:07 pm
Hi everybody!

There's a new version (0.9) for Master Tile Converter.
The main new feature is IPS patch export, Qt5 support and bugfix.

It's always here: http://jmimu.free.fr/mastertileconverter/

I hope it'll be useful.
  View user's profile Send private message Visit poster's website
  • Joined: 26 May 2016
  • Posts: 9
  • Location: Brazil
Reply with quote
Image shifting
Post Posted: Sun May 29, 2016 1:24 am
Hi!

Could you help me, please?

I'm using Master Tile Converter for extraction and reinsertion of compressed images from/into Ultima IV for Master System.

The file name of extracted image is dump_0x36180_4bpp_decompressed_62tiles_max_1347bytes.BMP.

So, I can only reinsert a compressed image with until 1347 bytes.

I used Gimp for image edition and I changed a few pixels. After the image change, I compressed the new BMP using Master Tile Converter and the final size was a 1333 bytes file.

In the Master Tile Converter, I positioned at 0x36180 offset and I imported compressed file chosing 62 tiles and saved a new ROM file.

But the result wasn't satisfactory, please see the attached image.

What must I do to image don't be shifted?
ultimaiv.png (50.37 KB)
Ultima IV - Image shifting
ultimaiv.png

  View user's profile Send private message
  • Joined: 06 May 2012
  • Posts: 52
  • Location: France
Reply with quote
Post Posted: Sun May 29, 2016 8:27 am
Hi !
It seems to be a tile map matter.
Can you send me your original and modified BMP files to check what is wrong?
  View user's profile Send private message Visit poster's website
  • Joined: 06 May 2012
  • Posts: 52
  • Location: France
Reply with quote
Post Posted: Sun May 29, 2016 11:48 am
I tried myself, and I have the same problem.
MTC uses "Phantasy Star" RLE compression.
It seems to work for decompression but for compression in this game.
Did anyone studied Ultima IV tile compression?
  View user's profile Send private message Visit poster's website
  • Joined: 26 May 2016
  • Posts: 9
  • Location: Brazil
Reply with quote
Post Posted: Sun May 29, 2016 1:32 pm
I attached the two images (before and after modification).

In addition to translated text, I also needed to removed the shadow of the oven for a smaller file.

I can't attach BMP files, so I renamed the file to PNG without success.
Finally i try to modify BMP header to PNG header and it works. Please revert file headers to original.

dump_0x36180_4bpp_decompressed_62tiles_max_1347bytes.png
Original header: 42 4D 76 08 00 00 00 00

saida4.png
Original header: 42 4D 98 07 00 00 00 00

PNG header that I used:
89 50 4E 47 0D 0A 1A 0A


Extra info:
If i try to compress with MTC the same file that I extracted using MTC, the size of the file is always bigger than suggested max file size. Analysing original file and comparing it with o arquivo reinserted without modification, I noticed that some bytes was doubled. I don't know if this is relevat for you.
saida4.png (1.9 KB)
Modified BMP
saida4.png

  View user's profile Send private message
  • Joined: 14 Apr 2013
  • Posts: 546
Reply with quote
Post Posted: Sun May 29, 2016 1:44 pm
jmimu wrote
I tried myself, and I have the same problem.
MTC uses "Phantasy Star" RLE compression.
It seems to work for decompression but for compression in this game.
Did anyone studied Ultima IV tile compression?

I just took a quick look at the tile decoder code and it seems like it's a 3bpp variation of the Phantasy Star RLE decoder. Effectively doing the same as the regular one but stopping after having read the 3rd the plane.
  View user's profile Send private message Visit poster's website
  • Joined: 06 May 2012
  • Posts: 52
  • Location: France
Reply with quote
Post Posted: Mon May 30, 2016 7:40 pm
Thank you.
The compressed image has 13 colors, it is 4bpp.
It seems to be a bug in my compression algorithm, I'll fix this, sorry!
  View user's profile Send private message Visit poster's website
  • Joined: 26 May 2016
  • Posts: 9
  • Location: Brazil
Reply with quote
Post Posted: Mon May 30, 2016 8:02 pm
jmimu wrote
Thank you.
The compressed image has 13 colors, it is 4bpp.
It seems to be a bug in my compression algorithm, I'll fix this, sorry!


You don't need to thank me or say sorry. You made a great application!

I need to thank you for fixing the program!

But there is a problem really?

Not sure if there really is a problem because I tried to follow this step by step from Maxim and the result was the same:

http://www.smspower.org/forums/13956-EditingCompressedTiles?highlight=tile%20dec...
  View user's profile Send private message
  • Joined: 06 May 2012
  • Posts: 52
  • Location: France
Reply with quote
Post Posted: Tue May 31, 2016 7:36 pm
Ah, I got it!
As you saw, MTC had a little less efficient compression (1 more byte for the same image). I fixed it.

But the problem was somewhere else: the tilemap was destroyed (or just shifted) when the compressed image was smaller than the original.
It means that the game doesn't have an address for the tilemap, it supposes it is directly after the end of the 4th bitplan.

I modified the picture, and compressed it. It was 2 bytes smaller than the original, so I transformed the end to spoil 2 bytes to keep the same size, and it works!

Example:
My compressed image finished like that:
03 00 00
meaning : 3 times the value "0", and the last "00" means this is end of the bitplan.

I modified this into:
01 00 02 00 00
meaning : 1 time the value "0", 2 times the value "0", and end of the bitplan.

Now I have to make it automatically...
u4_comp_ok.png (10.58 KB)
u4_comp_ok.png

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 13727
  • Location: London
Reply with quote
Post Posted: Wed Jun 01, 2016 8:32 am
That makes a lot of sense. The fix might be to have an editor that understands the format, so you can edit the tilemap too; or to shift the tilemap data down; or to code a compressor which pads the data the exact size needed. All are tricky.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 2943
Reply with quote
Post Posted: Wed Jun 01, 2016 8:37 am
jmimu wrote
It means that the game doesn't have an address for the tilemap, it supposes it is directly after the end of the 4th bitplan.


If it was so, wouldn't it work even with a compressed tileset smaller than the original? :|
  View user's profile Send private message Visit poster's website
  • Joined: 06 May 2012
  • Posts: 52
  • Location: France
Reply with quote
Post Posted: Wed Jun 01, 2016 4:16 pm
No, if the compressed picture is 1byte smaller than the original, the game will think the first index of the tilemap begins 1 byte sooner than the reality, and all the tilemap is shifted by one.

I'll allow the user to ask for a fixed size for the compressed data, it's easy to add any amount of byte with RLE.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 2943
Reply with quote
Post Posted: Wed Jun 01, 2016 5:47 pm
So it's either expecting a fixed size of the compressed tileset (which would be quite strange IMHO) or there's a size/map offset stored somewhere. If It was simply reading the map after the end of the compressed tileset, don't you think it would work even with a smaller set?
  View user's profile Send private message Visit poster's website
  • Joined: 14 Apr 2013
  • Posts: 546
Reply with quote
Post Posted: Wed Jun 01, 2016 6:34 pm
I guess an example would help to clarify. The following is taken from the rom itself starting from $2e50c:
.db $ff $ff $69 $00 $00 ; compressed tiles end here
.db $00 $00 $01 $00 $02 $00 ; this is the start of the nametable data


Now if the newly compressed tiles take up less space and look something like this (starting from $2e50c again, we need 2 bytes less now):
.db $69 $00 $00 ; compressed tiles end here
.db $00 $00 ; leftover bytes that will be interpreted as nametable data
.db $00 $00 $01 $00 $02 $00 ; the start of the nametable data again

So as you can see it just expects the nametable data right after the compressed tile data and thus interprets leftover tile data as nametable data.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 2943
Reply with quote
Post Posted: Wed Jun 01, 2016 9:47 pm
Oh, wait, now I get it! You mean the new data (new tileset + new tilemap) isn't written as a single contiguous block into the ROM? You should be doing this instead, then, and you're done! :)
  View user's profile Send private message Visit poster's website
  • Joined: 06 May 2012
  • Posts: 52
  • Location: France
Reply with quote
New MTC version! (0.9c)
Post Posted: Thu Jun 02, 2016 8:00 pm
The new version of MTC is out!
https://github.com/jmimu/Master-Tile-Converter

There is a new compress and insert dialog, allowing to ask for a precise compressed size.

It would be complicated to move tilemaps, it depends on games and pictures (and you won't save space in the rom unless you disassemble everything).

@emuman: can you compile it? I can't compile for Windows right now...

  View user's profile Send private message Visit poster's website
  • Joined: 26 May 2016
  • Posts: 9
  • Location: Brazil
Reply with quote
Post Posted: Fri Jun 03, 2016 12:11 pm
There were some problems when I compiled the project. Qt reported some errors, most of them I had to replace "or" with "||" and "and" for "&&".

The only erros I don't know how to deal with was this:
C: \ Users \ Ulysses \ Downloads \ Ultima IV - Quest of the Avatar (Europe) \ Tile Editor \ mastertileconverter_win_v09 \ Source \ Master-Tile-Converter \ dialogcompress.cpp: 42: error: C4716: 'DialogCompress :: updateCompressButton': must return the value

But I use "return true" at the end of DialogCompress :: updateCompressButton function and the program compiled normally. After that I did some tests.

Below the results:

Sacrifice: Shifted
Honor: Ok
Spiriuality: Ok
Humilty: Broken
Honesty: Ok
Compassion: Ok
Valor: Shifted

Please, see the attached pictures.
Images.zip (267.21 KB)
Results

  View user's profile Send private message
  • Joined: 06 May 2012
  • Posts: 52
  • Location: France
Reply with quote
Post Posted: Fri Jun 03, 2016 9:42 pm
Hi,
Ok, I'll take a look at that.

Maybe your messages came from VS compiler?

I compiled MTC for windows (mingw, qt 5.2), you can get it there:
http://jmimu.free.fr/mastertileconverter/
  View user's profile Send private message Visit poster's website
  • Joined: 26 May 2016
  • Posts: 9
  • Location: Brazil
Reply with quote
Post Posted: Fri Jun 03, 2016 11:09 pm
jmimu wrote
Hi,
Ok, I'll take a look at that.

Maybe your messages came from VS compiler?

I compiled MTC for windows (mingw, qt 5.2), you can get it there:
http://jmimu.free.fr/mastertileconverter/


I'm using Qt Creator, it is based on Qt 5.6
qt_creator_error.png (56.84 KB)
Error Message
qt_creator_error.png

  View user's profile Send private message
  • Joined: 06 May 2012
  • Posts: 52
  • Location: France
Reply with quote
New MTC version! (0.9d)
Post Posted: Fri Jun 10, 2016 7:52 pm
Hi, the inflating bug is fixed,
The new version of MTC is here:
https://github.com/jmimu/Master-Tile-Converter
  View user's profile Send private message Visit poster's website
  • Joined: 26 May 2016
  • Posts: 9
  • Location: Brazil
Reply with quote
Post Posted: Fri Jun 10, 2016 10:22 pm
Thank you!
  View user's profile Send private message
  • Joined: 26 Jan 2014
  • Posts: 825
Reply with quote
Post Posted: Thu Jun 10, 2021 11:07 am
I'm looking for an alternative of Gimp to edit images exported with Master Tile Converter. Remember: "You can modify the picture in a graphic editor that respects indexed images palettes."
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 13727
  • Location: London
Reply with quote
Post Posted: Thu Jun 10, 2021 11:12 am
Last edited by Maxim on Thu Jun 10, 2021 5:00 pm; edited 1 time in total
I recommend Paint Shop Pro 7, if you have weak morals you might search for “fo-psp7” for a pirated version. I can’t find any way to acquire it legally.
  View user's profile Send private message Visit poster's website
  • Joined: 26 Jan 2014
  • Posts: 825
Reply with quote
Post Posted: Thu Jun 10, 2021 12:34 pm
Way better for what I'm doing, thanks!
  View user's profile Send private message Visit poster's website
  • Joined: 29 Mar 2012
  • Posts: 681
  • Location: Spain
Reply with quote
Post Posted: Fri Jun 11, 2021 6:31 am
If you're up for a program with very strange usability and UX decisions, but that it's the best one that I've found for managing palettes, try mt-paint. It's free
  View user's profile Send private message
  • Joined: 06 Aug 2015
  • Posts: 42
Reply with quote
Post Posted: Fri Jun 11, 2021 5:47 pm
jmimu wrote
Hi, the inflating bug is fixed,
The new version of MTC is here:
https://github.com/jmimu/Master-Tile-Converter


Any chance of a new version supporting other compression formats?


I've been using Paint Shop Pro 7 for over 20 years. On YT You can find the full version link.
  View user's profile Send private message
  • Joined: 14 Oct 2008
  • Posts: 388
Reply with quote
Post Posted: Sat Jun 12, 2021 2:05 am
Been using the same version of Photostop for like 22 years.
Can't even run the actual installer anymore I don't think.
Just had to copy the installed program from whatever PC I had original done the proper installation on, ZIP that up and copy it from one HDD to another over the years. :D

But I'm fine with that, I hear you can't even buy Adobe programs anymore, only rent them. :P
  View user's profile Send private message
  • Joined: 29 Mar 2012
  • Posts: 681
  • Location: Spain
Reply with quote
Post Posted: Sat Jun 12, 2021 8:15 am
I really think Gimp or Photoshop are very poor choices for pixelart...
  View user's profile Send private message
Reply to topic



Back to the top of this page

Back to SMS Power!