diff options
author | Rangi <remy.oukaour+rangi42@gmail.com> | 2018-12-23 16:51:08 -0500 |
---|---|---|
committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2018-12-23 16:51:08 -0500 |
commit | abf8a623bd6c196e1a67e47a8d86c1883c39929b (patch) | |
tree | 91c4ea4a9f5839f33d732c9fb921c573e6a33dfd | |
parent | b048b74a9fe8240bd6272a26259ed3c984f35602 (diff) |
Collision
-rw-r--r-- | Add-a-new-tileset.md | 58 | ||||
-rw-r--r-- | screenshots/polished-map-edit-block.png | bin | 4173 -> 4729 bytes | |||
-rw-r--r-- | screenshots/polished-map-pewter-museum.png | bin | 11211 -> 11644 bytes | |||
-rw-r--r-- | screenshots/polished-map-redplusplus-goldenrod-city.png | bin | 16760 -> 28719 bytes |
4 files changed, 15 insertions, 43 deletions
diff --git a/Add-a-new-tileset.md b/Add-a-new-tileset.md index 9237881..0f1d451 100644 --- a/Add-a-new-tileset.md +++ b/Add-a-new-tileset.md @@ -8,10 +8,9 @@ This tutorial is for how to add a new tileset. As an example, we'll add Pewter M 3. [Design its graphics](#3-design-its-graphics) 4. [Design its palette map](#4-design-its-palette-map) 5. [Design its blocks (aka metatiles)](#5-design-its-blocks-aka-metatiles) -6. [Define its collision data](#6-define-its-collision-data) -7. [Include the new files in the ROM](#7-include-the-new-files-in-the-rom) -8. [Define its animated tiles](#8-define-its-animated-tiles) -9. [Design a custom palette for it](#9-design-a-custom-palette-for-it) +6. [Include the new files in the ROM](#6-include-the-new-files-in-the-rom) +7. [Define its animated tiles](#7-define-its-animated-tiles) +8. [Design a custom palette for it](#8-design-a-custom-palette-for-it) ## 1. Define a tileset constant @@ -123,16 +122,22 @@ The `rept 16 \ db $ff \ endr` in the middle is skipping over tile IDs $60 to $7F ## 5. Design its blocks (aka metatiles) -Maps in pokecrystal are designed with blocks, not tiles, where each block (aka "metatile") is a 4x4 square of tiles. +Maps in pokecrystal are designed with blocks, not tiles, where each block (aka "metatile") is a 4x4 square of tiles. Each block also has 2x2 "collision" data describing how NPCs can interact with each quadrant. Download [gfx/blocksets/gate.bst](https://github.com/pret/pokered/blob/master/gfx/blocksets/gate.bst) from pokered and save it as **data/tilesets/museum_metatiles.bin**. (Yes, the formats are identical from Gen 1 to Gen 2.) -If this were an original tileset, you would have to create the file. You can create an empty text file with the extension .bin instead of .txt, or run the command `touch data/tilesets/museum_metatiles.bin` the same way you run `make`. Either way, you'd still have to define the blocks. You can technically design blocks with a hex editor, typing in tile IDs one by one, but that's tedious. +If this were an original tileset, you would have to create the file. You can create an empty text file with the extension .bin instead of .txt, or run the command `touch data/tilesets/museum_metatiles.bin` the same way you run `make`. -Instead, you can use [Polished Map](https://github.com/Rangi42/polished-map). It's a program for editing maps and tilesets. Just open any of the [maps/\*.blk](../tree/master/maps/) files and pick "museum" as its tileset. As long as the graphics, palette map, and metatiles.bin files exist, this will work. Then click Tools → Resize Blockset… (or the blue **±** button) to add some blocks to the sidebar, and right-click one of them to open the block editor: +Then create **data/tilesets/museum_collision.asm**. This should also be an empty file. (The collision system in pokered was very different from pokecrystal, based on tiles instead of blocks, so we can't copy it this time.) + +At this point, you *could* design the blocks one by one, using a text editor for museum_collision.asm and a hex editor for museum_metatiles.bin. But that's tedious and error-prone. + +Instead, you can use [Polished Map](https://github.com/Rangi42/polished-map). It's a program for editing maps and tilesets. Just open any of the [maps/\*.blk](../tree/master/maps/) files and pick "museum" as its tileset. As long as the graphics, palette map, metatiles, and collision files exist, this will work. Then click Tools → Resize Blockset… (or the blue **±** button) to add some blocks to the sidebar, and right-click one of them to open the block editor:  +Just place the tiles and type the collision values for each block. Tiles are selected from the tileset, and valid collision values are in [constants/collision_constants.asm](../blob/master/constants/collision_constants.asm). + You can also edit the tileset graphics and palette map from within Polished Map. Just click Tools → Edit Tileset… (or the green puzzle piece button):  @@ -148,40 +153,7 @@ Here, I downloaded [maps/museum1f.blk](https://github.com/pret/pokered/blob/mast Then I swapped block #0 (floor) and block #10 (solid black) and saved that change, so the border block would be #0 and the floor would be walkable. -## 6. Define its collision data - -Blocks are four times the size of NPCs. That means each block needs four pieces of collision data, defining how NPCs interact with the top-left, top-right, bottom-left, and bottom-right quadrants. - -Create **data/tilesets/museum_collision.asm**. As you can see from other collision data files, each block will need a `tilecoll` line defining the four quadrants. Valid collision values are in [constants/collision_constants.asm](../blob/master/constants/collision_constants.asm). - -The collision system in pokered was very different from pokecrystal, based on tiles instead of blocks, so we can't copy it this time. Here's a sample of valid collision data for the museum tileset: - -```diff -+ tilecoll WALL, WALL, WALL, WALL ; 00 -+ tilecoll FLOOR, WALL, FLOOR, WALL ; 01 -+ tilecoll WALL, FLOOR, WALL, FLOOR ; 02 -+ tilecoll WALL, WALL, FLOOR, FLOOR ; 03 -+ tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 04 -+ tilecoll LADDER, FLOOR, FLOOR, FLOOR ; 05 -+ tilecoll WALL, WALL, WALL, FLOOR ; 06 -+ tilecoll WALL, WALL, FLOOR, WALL ; 07 -+ tilecoll FLOOR, COUNTER, FLOOR, COUNTER ; 08 -+ tilecoll COUNTER, FLOOR, COUNTER, FLOOR ; 09 -+ tilecoll FLOOR, FLOOR, FLOOR, FLOOR ; 0a -+ tilecoll FLOOR, FLOOR, WARP_CARPET_DOWN, WARP_CARPET_DOWN ; 0b -+ tilecoll FLOOR, COUNTER, WARP_CARPET_DOWN, FLOOR ; 0c -+ tilecoll COUNTER, WALL, FLOOR, WALL ; 0d -+ tilecoll WALL, COUNTER, WALL, FLOOR ; 0e -+ tilecoll COUNTER, FLOOR, FLOOR, WARP_CARPET_DOWN ; 0f -+ ... -``` - -You'll have to define the other 112 blocks yourself. ;) - -As of version 3.4.0, Polished Map can edit collision data, so you can create an empty data/tilesets/museum_collision.asm file and then enter collision values at the same time as you're designing blocks in the previous step. - - -## 7. Include the new files in the ROM +## 6. Include the new files in the ROM Edit [gfx/tilesets.asm](../blob/master/gfx/tilesets.asm): @@ -224,7 +196,7 @@ Now edit [gfx/tileset_palette_maps.asm](../blob/master/gfx/tileset_palette_maps. These files all go in the same section, so you can't have *too* many tilesets or the bank will overflow. That's unlikely to happen, but if it does, remember that most of the tilesets have excess palette data that can be removed. -## 8. Define its animated tiles +## 7. Define its animated tiles Edit [engine/tilesets/tileset_anims.asm](../blob/master/engine/tilesets/tileset_anims.asm): @@ -249,7 +221,7 @@ Anyway, that's it. Now maps can use `TILESET_MUSEUM` like any other tileset.  -## 9. Design a custom palette for it +## 8. Design a custom palette for it A few tilesets in pokecrystal have custom palettes. For example, Ice Path uses an entirely different palette from most caves; and Radio Tower uses a subtly different palette that makes `YELLOW` look green and `GREEN` look green-on-blue, so the tops of potted plants look natural against the blue walls. diff --git a/screenshots/polished-map-edit-block.png b/screenshots/polished-map-edit-block.png Binary files differindex 63f65cf..b03166d 100644 --- a/screenshots/polished-map-edit-block.png +++ b/screenshots/polished-map-edit-block.png diff --git a/screenshots/polished-map-pewter-museum.png b/screenshots/polished-map-pewter-museum.png Binary files differindex 65cd757..abf440a 100644 --- a/screenshots/polished-map-pewter-museum.png +++ b/screenshots/polished-map-pewter-museum.png diff --git a/screenshots/polished-map-redplusplus-goldenrod-city.png b/screenshots/polished-map-redplusplus-goldenrod-city.png Binary files differindex 6ef383f..4c733b6 100644 --- a/screenshots/polished-map-redplusplus-goldenrod-city.png +++ b/screenshots/polished-map-redplusplus-goldenrod-city.png |