gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Graphics > Memory mapping with GRIT

#175827 - MichaelMossman - Tue Feb 15, 2011 1:16 pm

Is this the correct place for GRIT questions ?

I am having problems getting to grips with GRIT.

It would seem, from the compiler error messages I have been getting, that the use of -m, together with -Mw and -Mh, is not allowed.

Does this mean that I cannot get automatic mapping information with metatiles ?

#175828 - sverx - Tue Feb 15, 2011 1:20 pm

metatiles are for objects (sprites) so I don't get what has to do with maps (background) ...

what are you trying to do? :)

#175829 - MichaelMossman - Tue Feb 15, 2011 3:37 pm

I did say I was having trouble getting to grips with this one !

I was rather hoping that I could create a fairly blank background and use this to put writing on, by creating 16 x 16 bit character tiles and then show these tiles onto the screen via mapping. I didn't want to use sprites because of all the resources this would use up.

Am I barking completely up the wrong tree ?

#175831 - sverx - Tue Feb 15, 2011 5:11 pm

You mean you want to use a background to show 'sprites'?
Anyway you won't need a map, just metatiles. Do an image with all your 16x16 sprites, then 'GRIT it' with 2x2 metatiles. You'll get an 'archive' where each sprite will be stored as 4 contiguous 8x8 tiles.
Copy that in background tile memory and each time you want to place one of them on the map remember you've got to multiply the number of your sprite by 4 to locate the 1st tile and you've got to change the content of 4 tiles on the map to display the full sprite.

Remember you've got only up to 1024 tiles per background (or 256 if you're using a rotational one...)

edit: oh, I realized now you're trying to write text! Well, you should be able to fit up to 256 different 16x16 chars in background tile memory, it should be enough :)

#175832 - MichaelMossman - Tue Feb 15, 2011 6:01 pm

Thank you very much.

In actual fact, I think I had already realised that I didn't need automatic memory mapping for my project - I was just playing around with GRIT, just to see what some of these commands actually do.

On this subject, GRIT really does seem to be a bit of a black art. The tonc manual is very comprehensive but does assume a certain knowledge and capability of graphics conversions. In all honesty, it is rather intimidating to the newcomer.

What I would like to find is a basic GRIT tutorial, which cuts through the complexity and shows the user how to manage the straightforward and common features needed for most projects. The complex bits can be learned at a later date.

#175834 - Cearn - Wed Feb 16, 2011 9:13 am

Would these help? http://www.coranac.com/projects/grit/

The readme and demo project for grit shows some common conversion options, including metatiling for maps. The binaries that come with DKA are probably more recent, so ignore those. The thing that the compiler gets stuck on is that you don't get a 'Map' in the output, but a 'MetaMap' and 'MetaTiles'.

#175836 - MichaelMossman - Wed Feb 16, 2011 5:03 pm

Thank you.

There's still a lot of options that go right over my head but the common conversions certainly help.