Banner
Views: 772,099,876
Time:
27 users online: Arty,  bebn legg, chickaDEE Magazine, currykarl, Daizo Dee Von, DigitalSine, ExONightZ, Green Jerry,  idol, Igno, Kazzzy, Knight of Time, MORC,  Nameless,  Ninja Boy,  Noivern, path, placeholdertest,  Ryaa, SammmUuU,  Sayuri,  Scrydan,  Shiny Ninetales,  Syndrilevosse, Tamaki,  Tob, Vellidragon - Guests: 48 - Bots: 190Users: 40,559 (1,858 active)
Latest: Arthurb10
Tip: Check out the Current Contests & Events forum to participate in any hacking contests that may be going on.Not logged in.
ExGFX: a comprehensive guide
Forum Index - SMW Hacking - SMW Hacking Help - Tutorials - ExGFX: a comprehensive guide
Pages: « 1 »


ExGFX: a comprehensive guide
Everything you may or may not want to know about graphics and ExGFX


ExGFX is one of the fundamental topics of SMW hacking, and one of the first that new hackers come across after getting the hang of basic level-building in Lunar Magic. Yet, it's been pointed out that after all this time we're still lacking a proper, up-to-date, in-depth tutorial on it. (the last one is over ten years old!)

Parts of this are adapted from a tutorial I wrote in German in 2013.

Don't be fooled by the length into thinking this is a complicated topic! I'm just going into unnecessary detail is all. If you're in a hurry, just read the tl;dr paragraph underneath each heading.




Contents



This will be a comprehensive guide, not some instruction manual that tells you where to click and nothing else. To make sure you understand what you're doing, I'm not only going to cover how to insert ExGFX, but also what they are and how they work.




Part 1: How ExGFX work


1. Introduction
tl;dr: SMW has limited graphics space, and instead of images or textures, it uses tiles.


If you're familiar with other game-creation tools (Game Maker or whatever), you're probably used to a process like this: take any images you want, import them into your game and place them in your level any way you like. Super Mario World is much more restrictive when it comes to graphics: compared to modern-day computers there's very little memory for the SNES to work with, and thus little room to store graphics. Therefore, in SMW, you have a limited amount of graphics to work with — and they're not image files either, but tiles of certain sizes that you're meant to reuse.


2. SMW's graphical limitations and the "Super GFX Bypass" window
tl;dr: SMW has 52 graphics files, and you can only use ten per level. Use the Super GFX bypass window to specify which GFX files go in which slot.


Let's take a look at how the original SMW handles its graphics.

Just to make it easier to see what I'm getting at, go to "Options --> General Options..." in Lunar Magic and make sure the "Use Joined GFX Files" checkbox is unchecked.

Next, click the red mushroom button (#lm{extgfx}). This will extract the graphics from the game, putting them in a folder called "Graphics" in the same place as the ROM you're editing. If you look inside that folder, you'll see it's filled with Graphics files! (GFX for short.) There's 52 of them, numbered from 00 to 33 in Hex, and most of them 4KB in size.

If you have a tile editor handy (YY-CHR, Tile Layer Pro or whatever), try opening one of those files with it. You'll notice that each of them contains a chunk of SMW's graphics — there's foreground graphics, background graphics, sprite graphics, overworld graphics, miscellaneous stuff like the "Mario Start" text... everything, really.

(Side note: If you had checked the "Use Joined GFX Files" box before extracting the graphics, Lunar Magic would have merged all of them into a single file called AllGFX.bin. That is perfectly fine to do, I just thought separate files will make it easier to see what's going on.)

For instance, this is what GFX15.bin looks like when opened in YY-CHR (and viewed with the correct palette):



All those graphics are arranged into tiles of 8x8 pixels. That's the smallest unit on the SNES.

As I mentioned before, SMW can't load all graphics files at the same time. For each level, you can select exactly ten of them — six for foregrounds and background, four for sprite graphics. Lunar Magic uses the term "slots": There are ten slots, and each has room for one GFX file.

How do you change which GFX files a level uses? Either use SMW's presets by editing an existing level or changing the GFX header options (#lm{gfxby}) — or, as will often be the case, change the settings manually. To do that, open the "Super GFX Bypass" window by clicking the red poison mushroom button (#lm{sgfxby}).



Those ten boxes at the top represent the slots. They're numbered FG1-FG3 and BG1-BG3 for both foregrounds and backgrounds, and SP1-SP4 for sprite graphics. Between FG and BG graphics, there's no real distinction — you can put BG graphics in FG slots and vice versa! (Of note: The original SMW didn't actually have the BG2 and BG3 slots. They were added by an ASM hack in Lunar Magic as of version 1.7.)

In SMW, the FG1 slot always has GFX14 loaded in it. FG2 is always GFX17, and FG3 varies depending on the level type (grassland, cave ground etc.) BG2 and BG3 are always empty by default — their value is 7F, meaning "no GFX file loaded". You can put GFX files there to make those graphics available in your level without having to sacrifice the existing ones! That's what makes so-called "tileset mixing" so easy — the magic of LM 1.7.

In the screenshot above, the FG3 slots has GFX15 in it (that's the grass foreground). You can try putting the number of a different GFX file there and see what that changes the foreground into! (Most GFX files will of course look like garbage, and those that won't will have palette issues.)


3. 8x8 and 16x16 tiles
tl;dr: 8x8 tiles are arranged into 16x16 tiles, which can then be used in levels. The Map16 editor shows and edits all 16x16 tiles.


As mentioned before, the smallest graphical unit in SMW is the 8x8 tile. When building levels, however, you've probably noticed you can only use tiles that are 16x16 pixels in size. Maybe you've even heard of what's called Map16. Let's find out what that's all about!

First, let's open the 8x8 editor (#lm{8x}).



This window shows all graphics currently loaded into the slots. (You can scroll with the arrow keys.) They're divided into 8x8 tiles, and each of them has a number assigned to it — hover over a tile and you'll see its tile number in the bottom left corner. When I took that screenshot, my cursor was above tile 10D, somewhere in the upper right corner of the window.

The numbering of a tile depends on two things: the slots it's loaded in, and its position within the GFX file. Tiles in the FG3 slot, for instance, are numbered 180 through 1FF. (Which means a slot takes up exactly half of what's visible in the 8x8 editor.)

You can't directly place these 8x8 tiles in a level — as I said, SMW only allows you to place 16x16 tiles. And this is where the Map16 comes into play!

You can think of the Map16 as a list of all 16x16 tiles you can use in levels, both for foregrounds and backgrounds. (And that's not level-specific — there's only a single, global, thing called Map16.) These 16x16 tiles are numbered as well, with numbers from 0 to FFFF. That's a total of 65536 usable tiles! Again, you can thank more recent versions of Lunar Magic for a limit this high.

Each 16x16 tile consists of four 8x8 tiles arranged in a square. The Map16 is essentially a list of those combinations. Lunar Magic's 16x16 editor lets you view and edit them. Let's take a quick look at it (#lm{16x})!



The editor shows 256 at once, but of course you can scroll down using the scroll bar or the arrow keys.

Just like in the 8x8 editor, hovering over a tile shows its tile number in the bottom left corner. When you click a tile, you'll see its data on the left, including what 8x8 tiles it's made of. In this case I selected the 16x16 tile 102, and you can see it consists of 8x8 tiles 18D, 193, 1D0 and 193.


4. The purpose of ExGFX and Map16 files
tl;dr: ExGFX are extra graphics you can use without affecting the original files. Their arrangement of 8x8 tiles will probably different from SMW's, so to use ExGFX in a level, you almost always need to make new Map16 tiles specifically for them.


So why use ExGFX?

If you wanted a different-looking foreground, you *could* just edit SMW's original graphics files (and if you don't need too many different-looking graphics, that's definitely an option). The problem with that, of course, is that a) you get rid of the original graphics and b) you quickly run out of space to draw.

And that's precisely what ExGFX are for! They're graphics files you can use in your hack without overriding the original ones. Hence the name — ExGFX stands for "extra graphics". If you take an original GFX file out of a slot and put an ExGFX file there instead, the original will be gone, but just for that level — it'll still be there for use in other levels. Having ExGFX means (potentially) having different graphics in every level.

Suppose you drew an ExGFX file. This one looks just like GFX15, except in the top left there's a smiley face:



Suppose you inserted that file into the ROM and loaded it into the FG3 slot. Now here's a question for you: could you, out of the box, put that smiley face into the level? The answer is no, and the reason is Map16.

16x16 tiles, as mentioned before, are combinations of 8x8 tiles. But the combination of exactly these four tiles that make up the smiley face is nowhere to be found in SMW, meaning that tile doesn't appear in SMW's Map16! You'll have to create a new tile in the Map16 editor (or, technically, edit an unused existing one) and tell it to use those four 8x8 tiles — only then can the smiley be used in a level. (I'll explain that process in part 5.)

That's why ExGFX almost always require creating new Map16 tiles. (They don't when the 8x8 tiles are arranged the same way as in SMW or as in existing ExGFX files that already have 16x16 tiles.)

Needing new 16x16 tiles for each ExGFX doesn't hurt all that much, though. Not only is there lots of free Map16 space to use, but virtually all ExGFX you can download come with pre-made Map16 files, so instead of creating the tiles by hand you can just import them into the Map16 editor.

And now — thanks for your patience so far — I'll explain how to do just that.




Part 2: Inserting foreground ExGFX


1. Preparing for insertion
tl;dr: The first time you're inserting ExGFX, extract and insert the regular graphics first.


Inserting ExGFX usually consists of these steps:

  • Download an ExGFX file (or a "package", if you will, since Map16 and palette files are often included, and sometimes there'll be a set of multiple ExGFX files)
  • Move the ExGFX file to the "ExGraphics" folder
  • Have Lunar Magic import all ExGFX files from the ExGraphics folder
  • Load the file into a slot using the Super GFX Bypass window
  • Import the Map16 file
  • Import the palette if needed


At the end of that process, you'll have new graphics and tiles ready to use! Let's go over all of that in detail.

When inserting ExGFX for the first time, the first thing you'll want to do is click all four colored mushroom buttons in order from left to right. (#lm{extgfx} #lm{insgfx} #lm{extexgfx} #lm{insexgfx}) Here's what they do:

#lm{extgfx} — extract all original GFX files (this creates the "Graphics" folder if it doesn't already exist)
#lm{insgfx} — insert all original GFX files from the "Graphics" folder back into the ROM (this must also be done every time you edit an original GFX file in order to apply the changes)
#lm{extexgfx} — extract all ExGFX files (this creates the "ExGraphics" folder if it doesn't already exist)
#lm{insexgfx} — insert all ExGFX files from the "ExGraphics" folder back into the ROM (like above, this must be done every time you add, edit or remove ExGFX in order to apply the changes)

The reason you need to click the first two buttons (to the best of my knowledge) is to make Lunar Magic install an ASM hack that changes SMW's graphics format. The third button creates the ExGFX folder. Clicking the fourth isn't strictly necessary yet, but I thought "all four in order" would make for a good rule of thumb.

Again, you only need to do this the very first time you insert ExGFX. After that, click each button individually as needed.


2. The ExGraphics folder
tl;dr: clicking the blue mushroom button creates the ExGraphics folder.


Clicking the #lm{extexgfx} button will create a folder named "ExGraphics" in the same folder as your ROM (same for the Graphics folder). It'll obviously be empty at first.

Starting from a fresh ROM, your containing folder might look something like this:




3. Downloading ExGFX
tl;dr: here's what ExGFX downloads usually contain.


For this tutorial I'll be using the SMAS SMB3 platform foreground. I trust you know how to download things from the Graphics section.



The ZIP will contain three files:

  • The ExGFX file itself (.bin)
  • A file containing the necessary Map16 tiles (.map16)
  • A palette file (.pal or .tpl), since these ExGFX don't use the same palette SMW does


Some ExGFX will also include .palmask files — these tell Lunar Magic not to import the whole .pal file, but just the necessary parts of it. You don't need to do anything with the .palmask file directly, other than keeping it next to the .pal file.


4. Inserting the ExGFX file
tl;dr: put the .bin in the ExGraphics folder, insert the ExGFX, and load the file into the right slot.


Extract the ZIP, take the ExGFX file (.bin) and move it to the ExGraphics folder.

For Lunar Magic to recognize the file, it needs a certain name. The format is "ExGFX###.bin", where ### is a Hex number from 80 through FFF. Yep, ExGFX files are numbered as well (and the different numbering range is actually the only thing that distinguishes it from original GFX files). The 80-FFF range means you can have up to 3968 files in your ROM (way more than you'll ever need).

To give this particular file a proper name, cut off the "[FG3]" at the end and keep only the number (resulting in ExGFX9D.bin). The actual number doesn't matter — personally, I start at FFF and count down — as long as you remember which file contains what without having to open each one. I suggest you keep a list of it somewhere. For this tutorial, let's keep the number at 9D.

In Lunar Magic, click the #lm{insexgfx} button to insert all ExGFX files into the ROM (for now there's only one).

Next, you need to load the file into a graphics slot to use it in your level. Open the Super GFX Bypass window (#lm{sgfxby}), check the box at the top to be able to edit things, and enter the number of the ExGFX file next to the slot you want it in. (The six-digit number at the end isn't important, but if it says "Not Inserted" instead, that means you've done something wrong.)

It's important to use the right slot number, but only for one reason: the slot number determines the 8x8 tile numbers, and those are what the Map16 file works with, so it expects the file to be in a certain slot. If that's not the case (e.g. if you don't need a Map16 file or you're building the tiles by hand), you can use whatever FG/BG slot you like.

Because slots are important, ExGFX downloads will usually tell you which file goes into which slot. In this case, the info was in the file name itself — ExGFX9D goes into FG3.



Click OK in the Super GFX Bypass window, and notice that whatever foreground was in your level now looks garbled. That makes sense — after all, you just replaced the graphics file responsible for foregrounds. What you need now is 16x16 tiles that arrange the newly-inserted 8x8 tiles in the intended way.


5. Importing the Map16 file
tl;dr: in the 16x16 editor, click #lm{impsel} and choose the Map16 file.


After all this time I've been talking about the Map16 file, you finally get to insert one! It's not as epic as I made it sound.

Take the .map16 file from the ZIP. This one you can put anywhere you want, as long as you remember where. The file name doesn't matter either.

In this case, the file name tells you where the 16x16 tiles will end up once imported, that is, Page 0B. (One page is 256 tiles, i.e. everything you can see at a time in the 16x16 editor.) Tiles having a predetermined location like that is a feature of the .map16 format — in the past, 16x16 tiles were always imported at whatever spot you selected in the editor. If you like the old way of being able to decide the import location yourself, make sure the #lm{16loc} button in the 16x16 editor is disabled. (Of course, no matter which method you use, you can still move the tiles around whenever you like.)

Next, click the #lm{impsel} button in the 16x16 editor and choose the .map16 file from wherever you put it. Click Open, and huzzah — the Map16 tiles are now imported!



Of course, it could happen that the Map16 file puts the tiles in a place where other tiles alreay exist, overriding them. In that case, just select the new tiles and drag them to a more convenient place. (This will be slightly more trouble when you're dealing with backgrounds.)

At this point don't forget to save (#lm{save})!

Feel free to delete the Map16 file, too — once the tiles are imported, it's useless.


6. Importing the palette
tl;dr: open the palette editor (#lm{pal}), click #lm{imppal} and choose the .pal file.


Now all that's left is for the tiles to have the right palette — you wouldn't want to work with those hideous colors, would you? Luckily, the download contained a palette as well, ready for importing.

Take the .pal file from the ZIP folder — as with the Map16 file, its name and location don't matter.

Now open the palette editor (#lm{pal}) and click the #lm{imppal} button. Choose the .pal file from wherever you put it and click Open. You'll notice the level's palette change, both in the palette editor and in the level itself. (Don't worry, other levels' palettes aren't affected.)

The tiles in the 16x16 editor should now look decidedly less eye-searing:



Don't forget to save again (#lm{save}), this time in the main Lunar Magic window's toolbar.

If all you have is a .pal file, importing a palette will override all of the level's colors at once, so there's a chance it'll screw up the palette of something else you didn't expect. That's why many ExGFX downloads today come with .palmask files as well — those tell Lunar Magic to only import the necessary colors and leave the rest alone. If you have a .palmask file, put it in the same place as the .pal file before importing the latter. (You don't need to open it directly.)

In this case there is no .palmask file, and the .pal file does overwrite more than it should (it messes with the background colors). A common way around that is to first insert the palette into another level, then copy only the relevant colors back over. You can copy and paste entire palette rows at once with Ctrl-Alt-left click and Ctrl-Alt-right click respectively.


7. Using the ExGFX
tl;dr: ???, profit!


This is pretty self-explanatory, or at least knowledge you should have by now, but for the sake of completeness: to place the tiles in your level, select one in the 16x16 editor, then right-click inside the level. Another option is to insert them through "Direct Map16 Access" in the Add Objects window (#lm{objects}).

Here's how a level using these ExGFX might look:






Part 3: Inserting background ExGFX


1. How backgrounds differ
tl;dr: backgrounds work the same as foregrounds except for some Map16 stuff.


So much for foreground graphics. I figured I should explain background insertion as well, since it requires a bit of extra work. Not all that much, though — if you got here, you already know the bulk of what there is to know.

Graphics-wise (file format, numbering, usable slots), backgrounds work much the same way foregrounds do. They only differ in the following ways:

  • Background 16x16 tiles can only use the lower half of Map16, that is, pages 80-FF = tiles 8000-FFFF (likewise, foregrounds can only use the top half)
  • A background can't use 16x16 tiles from all pages at once, but only from 16 at a time
  • Background 16x16 tiles are assembled in the background editor (#lm{bg}), not in levels
  • Background downloads usually come with a sample level showing you how to correctly assemble the tiles (for foregrounds this isn't needed, since you can arrange the tiles however you want — that's called level design)



2. Inserting graphics, tiles and palettes
tl;dr: basically the same as foregrounds so far.


This step is pretty much identical to steps 3-6 in part 1, so refer to those if you need more detail.

For this tutorial I'll be using the Grassy Hill background from Super Princess Peach. Here's what the ZIP contains:



There are two ExGFX files this time around because the graphics won't fit in one. There's also a .palmask file along with the palette (which, as I mentioned before, tells Lunar Magic to only import the necessary colors), and a sample level file (.mwl) that has the background assembled.

To insert the ExGFX, move the .bin files to the ExGraphics folder (their file names are already valid) and click #lm{insexgfx} in Lunar Magic. Next, load the files into the correct slots in the Super GFX Bypass window (#lm{sgfxby}).

A slight problem with this particular download is that it doesn't tell you which files go into which slots — you'll have to experiment to find out. It helps to do the other steps first: import the Map16 file and palette first, then play around with the slot settings until the tiles look right.

In this case, ExGFXAE goes into FG2, and ExGFXAF goes into BG1. (By using the FG2 slot, the ExGFX author chose to make a small sacrifice, since FG2 usually contains bushes, diagonal pipes and various blocks. However, ExGFXAE leaves most of those intact, overriding only some lesser used tiles.)

After assigning the correct slots and importing the Map16 tiles (#lm{16x}, then #lm{impsel}), the Map16 editor should look something like this:



And after importing the palette (if you haven't already), the tiles should take on a more recognizable form in the editor:



Also note that only palette row 3 has been changed, with the other colors left untouched. (If that's not the case for you, remember to have the .palmask file next to its .pal.)

As always, don't forget to save the whole thing (#lm{save}) — both in the Map16 editor and in Lunar Magic itself!


3. The background editor and the sample level
tl;dr: open the sample level and copy&paste the background tiles from it using the background editor (#lm{bg}).


Editing backgrounds in Lunar Magic, surprisingly enough, is done through the background editor (#lm{bg}). You can move background tiles around in there and paste new ones in from the Map16 editor just like you'd build levels.

Backgrounds are kind of tedious to assemble by hand, though, not to mention hard to get looking right when you don't know how they're supposed to look like. And that's where the sample level comes into play! It's a level file (.mwl) you can import to your ROM, and since backgrounds are saved along with levels, it also contains the right tile arrangement. All you need to do is copy and paste it.

To import the sample level, click "File --> Open Level from File..." in Lunar Magic's main menu and select the .mwl file that came with the ZIP (wherever you put it). This will load some level with some number into Lunar Magic. Don't worry about what it looks like or whether it'll overwrite one of your existing levels — as long as you don't save the level, you'll be fine. If you used different ExGFX numbers than their default file names, you may also get error messages saying the ExGFX weren't found, and that's also fine. Indeed, all you need to care about in this level is the background.

With the sample level open, select all the tiles in the background editor and press Ctrl-C to copy them. Now go back to your level (if the sample level happened to have the same level number, just go to another level, then back to yours), and in the background editor, press Ctrl-V to paste the tiles.

Your background should now look a lot like this:



You can still move tiles around to your liking, of course — in this case, it might make sense to move the whole thing a couple of tiles upwards. Just select the necessary tiles and drag them around.

After saving in Lunar Magic (#lm{save}), you should be good to go:




4. Resolving tile conflicts
tl;dr: when you move 16x16 tiles from their default importing location in the Map16 editor, you also need to remap them in the backround editor to reflect the changes.


Sonner or later there will probably be tile conflicts — that is, cases where a background's Map16 file puts its tiles in a place where it will overwrite some that are already used. To fix that (same as with foregrounds), you can just move the tiles to a more convenient place by dragging them around in the Map16 editor.

However, with backgrounds, there's one other thing to take into account — the background editor expects the tiles to be in a certain place in the Map16! It has information like "I have tile 89AB in this spot", but when you move the tile to, say, 8ABC, the editor now points to the wrong spot, rendering the sample level useless. Thus there are two thing you have to do:

  • Move the tiles where you want them in the Map16 editor
  • Remap the tiles in the background editor to point to the new location


Luckily, that second step is much easier than manually reassembling the tiles.

Let's refer to the example background I use in this tutorial, and assume that instead of the default page 8A you moved the tiles to page 8D. This makes the background editor show the wrong tiles (either garbled or empty):



When you hover over the tiles, you can see their number in the bottom left corner — and as you can see, the background editor is still using tiles from page 8A.

There's a quick way to repoint them all at once: In the background editor, click the "Remap" button to bring up the "Remap background tiles" dialog.



There's multiple ways to go about this, but let's focus on the text box at the top. Whatever number you put there will be added to all tiles in the editor. (And remember, it's all in Hex!) If you want to go from page 8A to 8D, you need to add 3 pages, and with one page being 100 tiles in Hex, the number to put there is 300. (When you need to subtract instead, put a minus sign in front.)

After clicking OK, the background editor will load different tiles:



The background itself is back to normal — looking at the tile number at the bottom confirms they're now using page 8D. However, all the tiles that were supposed to be empty now look garbled. That's because the remapping affected all tiles, even though the empty ones didn't need to be remapped. That's not too hard to fix, though: if you select the now-garbled tiles and press Delete, they should revert to their empty state.

Another way to remap is to press Shift-F9 to open a remap dialog that looks the same but affects only the selected tiles. You can also play around with the options given in the second text box — there's a lot of ways to arrive at the same result.



(The reason this whole thing isn't a problem with foregrounds is that you usually build levels from scratch instead of relying on pre-made assemblies. When you don't care about the sample level, you don't need to worry about remapping.)


5. Background Map16 banks
tl;dr: a bank is 16 background Map16 pages, and each level's background can only use one bank. Change the bank with in the background editor (#lm{bg}).


Although you can use a total of 32768 Map16 tiles for backgrounds, you can't use them all at once in a level. The background Map16 is split into eight "banks", each consisting of 16 pages (bank 0 is pages 80-8F, bank 1 is pages 90-9F, bank 2 is pages A0-AF, etc.), and each level's background can only use one bank.

The default bank in Lunar Magic is 0 (pages 80-FF), and the background I'm using as an example just happened to have its tiles on page 8A, so it all worked out — no extra work needed, by sheer luck.

However, suppose you had to move the 16x16 tiles from their original spot, not just to a different page, but to a different bank — say, from 8A to 9D. Then you'd not only have to to the remapping process as described above, but also set the background to use bank 1 instead of bank 0.

To do that, click in the background editor and select the bank you need. Note that this will also auto-remap the tiles in the background editor to be in the selected bank (changing the bank by 1 will add or subtract 1000 tiles, i.e. 10 pages, in Hex).




Part 4: Sprite ExGFX


1. Inserting sprite ExGFX
tl;dr: insertion works the same except you use the SP slots.


Sprite ExGFX don't need much of an explanation by now, but for the sake of completeness, here's a few words on them.

In SMW, there's no special connection about a sprite and its graphics — that is, a sprite doesn't "know" what it looks like. Instead, the graphics files are loaded into one of the level's graphics slots as usual, and the sprite only knows which 8x8 tile numbers to use (just like Map16 tiles).

Sprite graphics need to be loaded into one of the four "SP" slots. Of course, there's nothing stopping you from loading them into a FG slot and making foreground tiles out of them, but the only slots accessible to actual sprites are the SP slots.

With sprite graphics, you're usually pretty low on space. The SP1 and SP2 slots are almost never changed because they contain essential sprite graphics (powerups, Goombas, Koopas, score sprites, etc.). Custom sprites normally use the SP3 and SP4 slots, where they will inevitably overwrite some existing sprite graphics.

Custom sprite downloads on SMW usually come with ExGFX files. If they don't, they either don't need any special graphics (i.e. are tweaks of existing sprites), or the graphics come bundled with the sprite insertion tool.


2. Conflicts and sacrifices
tl;dr: you're low on sprite graphics space, so there'll always be some kind of sacrifice.


There's another problem specific to sprite graphics: ExGFX files will try to keep as much of the original graphics as possible intact, but since there are a lot of different sprite GFX files, that original may not be the one you need! Let's take a look at the ExGFX file that comes with the YI style Shy Guy:



This looks a lot like GFX13, except with the Shy Guy Graphics in the lower left. All other graphics are left untouched, so when you load this file into SP3, it'll be almost like you loaded GFX13 there. But what if you didn't want to use GFX13 with your Shy Guy? What if you wanted GFX12 instead?



That's a pretty common problem — and the only real solution is to identify the relevant tiles and copy them yourself. I'm assuming you know how to use a tile editor so I won't be going into detail here, but you should be aiming for something like this:



Having the Shy Guy graphics in that spot sacrifices the platform GFX that used to be there, so you can't use platforms and Shy Guys in the same level (not without one looking glitched anyway). There's always *some* sacrifice you have to make, but which sacrifice exactly is the sprite maker's choice.

So what if you need both anyway? Or what if a second custom sprite uses the same 8x8 tiles as an existing one and you want to move one of them elsewhere? That would require remapping — equivalent to that in the background editor, in a way — though it's not as easy. To remap sprite tiles, you'll have to edit the sprite code itself and change the right numbers. It's not rocket science either, but it's not something I'll go into in this tutorial.




Part 5: Making your own ExGFX


1. Building and exporting Map16 tiles
tl;dr: build 16x16 tiles in the 16x16 editor (#lm{16x}) by switching to 8x8 mode (#lm{8xt}), opening the 8x8 tile selector (#lm{8x}) and copying tiles over. Export a .map16 file using #lm{expsel}.


Want to make your own ExGFX and submit them to the site? There's not that much to it! That is, once you have the graphics (either ripped from somewhere else or drawn yourself). This is not a drawing tutorial, so let's just assume you've already drawn an ExGFX file:



(download this file; it's really primitive and you wouldn't want to use it except to follow along)


The insertion process is the same as usual: give it a number (I'm using 123 here), put it in the ExGraphics folder, insert the ExGFX (#lm{insexgfx}) and load it into a slot. The slot choice is yours this time, since you're the author! I'm going with FG3 for this one, since I don't mind replacing the foreground.




Now comes the part where you'd import a Map16 file — except you're the author now! It's your task to build one from scratch. If you've been following what I said earlier about the Map16 editor, you should already have some idea of what to do: you need to arrange the 8x8 tiles you drew into 16x16 tiles.

First, open the Map16 editor (#lm{16x}). From there, click #lm{8x} (that's the button in the 16x16 editor window, not in Lunar Magic!) to bring up the 8x8 tile selector. It looks a lot like the 8x8 editor you open from the main Lunar Magic window, but this is purely for selecting tiles to build Map16 tiles with. Scroll to where your ExGFX file is with the arrow keys, and change the palette to view them in with PgUp/PgDn.

To build a 16x16 tile, you basically have to options:

  1. Select an empty Map16 tile.
  2. Choose what 8x8 tiles to build it from by entering their tile numbers in the first four boxes on the left. (Remember: you can see an 8x8 tile's number in the corner of the window by hovering over it.)


or

  1. In the 16x16 editor, switch to 8x8 editing mode by clicking #lm{8xt}.
  2. In the 8x8 tile selector, select one or more tiles (by clicking or dragging a box).
  3. Right-click in the 16x16 editor to place them. (Even if you paste a bigger selection of 8x8 tiles, the result will still be 16x16 tiles, you just made several in one step.)


The second way was introduced in more recent versions of Lunar Magic, and it's often more convenient and efficient.

Whichever way you go, wherever you choose to place the 16x16 tiles (I chose the top of page 4), and however you arrange them on the page, your result may look something like this:



You can move tiles by dragging them and copy them by selecting them and right-clicking elsewhere. What you can also do is flip tiles horizontally and vertically using the "Flip X" and "Flip Y" button on the left. Flipping affects whatever is selected right now, whether you're in 8x8 editing mode or not.

Note that you can't rotate graphics with the click of a button! That's a technical limitation of the SNES. To get a rotated tile, you'll need to draw separate graphics for it.

Through copying and flipping, you can add the ground tiles that were previously missing:



(Side note: by cleverly reusing tiles or flipped versions thereof, you can save quite a bit of graphics space! The sample ExGFX file I provided contains some redundant tiles that could be left out.)

You can also change the palette a tile uses using the "Palette" dropdown menu on the left. (Foreground graphics can use palette rows 0-7, i.e. the top half of the palette editor.) Changing the palette affects whatever is selected right now, whether you're in 8x8 editing mode or not.

One last important thing to do is setting tile behavior. For instance, you'd expect ledges to be solid and grass decoration to be passable, or slopes to act like, well, slopes. However, just pasting 8x8 tiles into the editor won't make the 16x16 tiles behave correctly — you need to manually change their "acts like" settings.

Tile behavior (unlike flipping, palettes etc.) only makes sense in the context of 16x16 tiles, so for this one, make sure you're *not* in 8x8 editing mode (#lm{8xt}). Now, by selecting one or more tiles, you can change their behavior through the box on the left that says "Act as".

That number is simply the tile number of one of SMW's Map16 tiles. For custom tiles, the default value is 130 — and looking at page 1 in the Map16 editor, you'll see that tile 130 is a cement block. This means all new tiles will be solid by default.

If you want to make your new tile act like, say, a vine, you'd look for the vine tile in the Map16 editor and change the "Act as" setting of the new tile to the vine's tile number. (That would be 6, by the way.) Some other commonly used values are these:

  • 130 — solid (cement block)
  • 25 — passable, no interaction with the player (empty tile)
  • 106 — solid when standing on top of it, passable from all other sides (cloud)
  • 12F — hurts the player (muncher)
  • various (16E-1E4) — slopes (see the "Objects" section in this thread for details)


With the tile looks and behaviors thus finalized, you can start using them in your level — or, if you want to submit your ExGFX to the site, export the tiles to a Map16 file! To do that, select all the necessary tiles in the 16x16 editor, click #lm{expsel} and save them as a .map16 file.


2. Exporting the palette
tl;dr: In the palette editor (#lm{pal}), mark irrelevant colors () then export a .pal file (#lm{exppal}).


For this example you don't even need a custom palette, but imagine you do. If you're drawing graphics yourself you need to make the palette yourself as well, and it's helpful to do that before drawing the actual graphics, since, well, the palette is what you draw *with*.

You can edit the palette using the palette editor (#lm{pal}), the same place where you import a .pal file.

Making palettes isn't the point of this tutorial (but of another one), so let's assume you've already made a nice palette, ready to share with the world.

Before exporting the palette, you should make sure that only the necessary colors are exported while the rest if left untouched. (.palmask files, remember?) To do that, click in the palette editor, then mark each color that should *not* be exported with an X by clicking on it. (Hold Alt while clicking to affect the entire row.) Doing this has nothing to do with what you can edit in Lunar Magic — it only affects the exported files.

Finally, to export the palette, click #lm{exppal} in the palette editor and save a .pal file. If you've masked some colors as described above, a .palmask file will also be generated.


3. Compiling everything
tl;dr: put the ExGFX and all exported files together in a ZIP and upload that.


At this point you're ready to submit your ExGFX to the site! To recap, what you usually need is a ZIP file containing (at least) this:

  • One or more ExGFX files (.bin), ideally with some info on which slots they go in
  • A Map16 file (.map16)
  • A palette file (.pal, ideally .palmask as well)


Depending on what you submit, this may not be all you need! For the most recent standard on what files to provide when uploading to SMWC, check the guidelines on the Graphics submission page.





And there we go! I'm sure this tutorial is more wordy than needed and the phrasing awkward in some places, but I hope it's good enough to serve as a central guide to direct some future ExGFX questions to.

If you spotted a mistake or have any suggestions, let me know!



phew~



--------------------


 
There she goes. Thanks for writing this humongous wall of instructions!

This is going to be helpful to a good bunch of people. Pointing them to the ancient one always felt a little wrong.

--------------------
Your layout has been removed.
Did you go over using tilesets that use multiple ExGFX files?
For example, the animated water/lava tiles for a tileset are in another file.
Thanks to share. :) working your tips
Thank you very much for the guide! Very useful! #smrpg{y}
Pages: « 1 »
Forum Index - SMW Hacking - SMW Hacking Help - Tutorials - ExGFX: a comprehensive guide

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2019 - SMW Central
Legal Information - Privacy Policy - Link To Us


Total queries: 9

Menu

Follow Us On

  • YouTube
  • Twitch
  • Twitter

Affiliates

  • Talkhaus
  • SMBX Community
  • GTx0
  • Super Luigi Bros
  • ROMhacking.net
  • MFGG
  • Gaming Reinvented