Add a new Pokémon - pret/pokecrystal GitHub Wiki

This tutorial is for how to add a new species of Pokémon, allowing up to 253 species. As an example, we'll add Munchlax.

Contents

  1. Define a species constant
  2. Give it a name
  3. Define its base data
  4. Define its evolutions and level-up learnset
  5. Define its egg moves
  6. Define its cry
  7. Define its icon
  8. Define its Pokédex entry
  9. Design its footprint
  10. Design its sprites and animation
  11. Include and point to the sprite and animation data
  12. Edit more data-related tables
  13. Adding up to 253 Pokémon

1. Define a species constant

Edit constants/pokemon_constants.asm:

 ; pokemon ids
 ; indexes for:
 ; - PokemonNames (see data/pokemon/names.asm)
 ; - BaseData (see data/pokemon/base_stats.asm)
 ; - EvosAttacksPointers (see data/pokemon/evos_attacks_pointers.asm)
 ; - EggMovePointers (see data/pokemon/egg_move_pointers.asm)
 ; - PokemonCries (see data/pokemon/cries.asm)
 ; - MonMenuIcons (see data/pokemon/menu_icons.asm)
 ; - PokemonPicPointers (see data/pokemon/pic_pointers.asm)
 ; - PokemonPalettes (see data/pokemon/palettes.asm)
 ; - PokedexDataPointerTable (see data/pokemon/dex_entry_pointers.asm)
 ; - AlphabeticalPokedexOrder (see data/pokemon/dex_order_alpha.asm)
 ; - EZChat_SortedPokemon (see data/pokemon/ezchat_order.asm)
 ; - NewPokedexOrder (see data/pokemon/dex_order_new.asm)
 ; - Pokered_MonIndices (see data/pokemon/gen1_order.asm)
 ; - AnimationPointers (see gfx/pokemon/anim_pointers.asm)
 ; - AnimationIdlePointers (see gfx/pokemon/idle_pointers.asm)
 ; - BitmasksPointers (see gfx/pokemon/bitmask_pointers.asm)
 ; - FramesPointers (see gfx/pokemon/frame_pointers.asm)
 ; - Footprints (see gfx/footprints.asm)
 	const_def 1
 	const BULBASAUR  ; 01
 	...
 	const MEW        ; 97
 DEF JOHTO_POKEMON EQU const_value
 	const CHIKORITA  ; 98
 	...
 	const CELEBI     ; fb
+	const MUNCHLAX   ; fc
 DEF NUM_POKEMON EQU const_value -1
-	const_skip       ; fc
 	const EGG        ; fd

Some things to notice here:

  • Species constants are in national dex order; in fact, they're used as Pokédex IDs, so Munchlax is going to appear as #252.
  • JOHTO_POKEMON is defined right before the first Johto Pokémon, and NUM_POKEMON is defined right after the last non-Egg Pokémon.
  • There are a lot of data tables associated with Pokémon species! We'll go over them one by one.

2. Give it a name

Edit data/pokemon/names.asm:

 PokemonNames::
	table_width NAME_LENGTH - 1, PokemonNames
 	db "BULBASAUR@"
 	...
 	db "CELEBI@@@@"
+	db "MUNCHLAX@@"
	assert_table_length NUM_POKEMON
-	db "?????@@@@@"
 	db "EGG@@@@@@@"
	assert_table_length EGG
 	db "?????@@@@@"
 	db "?????@@@@@"
 	db "?????@@@@@"
	assert_table_length $100

All the names are exactly 10 characters long, with "@" as padding. Names that are 10 characters long anyway, like "CHARMELEON", don't have any padding.

(Aside: if you make names lowercase, be careful—going from "FARFETCH'D" to "Farfetch'd" will lower the character count by 1 since 'd is a single character, so that would need to become "Farfetch'd@".).

3. Define its base data

Create data/pokemon/base_stats/munchlax.asm; you can start with data/pokemon/base_stats/snorlax.asm as a guide.

There's a lot of base data here:

+	db MUNCHLAX ; 252
+
+	db 135,  85,  40,   5,  40,  85
+	;   hp  atk  def  spd  sat  sdf
+
+	db NORMAL, NORMAL ; type
+	db 50 ; catch rate
+	db 94 ; base exp
+	db LEFTOVERS, LEFTOVERS ; items
+	db GENDER_F12_5 ; gender ratio
+	db 100 ; unknown 1
+	db 40 ; step cycles to hatch
+	db 5 ; unknown 2
+	INCBIN "gfx/pokemon/munchlax/front.dimensions"
+	dw NULL, NULL ; unused (beta front/back pics)
+	db GROWTH_SLOW ; growth rate
+	dn EGG_NONE, EGG_NONE ; egg groups
+
+	; tm/hm learnset
+	tmhm DYNAMICPUNCH, HEADBUTT, CURSE, ROLLOUT, TOXIC, ZAP_CANNON, ROCK_SMASH, PSYCH_UP, HIDDEN_POWER, SUNNY_DAY, SNORE, BLIZZARD, HYPER_BEAM, ICY_WIND, PROTECT, RAIN_DANCE, ENDURE, FRUSTRATION, SOLARBEAM, THUNDER, EARTHQUAKE, RETURN, PSYCHIC_M, SHADOW_BALL, MUD_SLAP, DOUBLE_TEAM, ICE_PUNCH, SWAGGER, SLEEP_TALK, SANDSTORM, FIRE_BLAST, DEFENSE_CURL, THUNDERPUNCH, REST, ATTRACT, FIRE_PUNCH, SURF, STRENGTH, FLAMETHROWER, THUNDERBOLT, ICE_BEAM
+	; end

From top to bottom, what it all means:

  • species: This is just used for declaring which ROM bank the Pokédex entry is stored it. It's arguably a design flaw, since the exact species ID is insignificant, but it's not a big deal; just put the correct species here and move on.
  • base stats: HP, Attack, Defense, Speed, Special Attack, and Special Defense, each from 1 to 255.
  • type: The primary and secondary types. Single-type Pokémon just repeat their type twice.
  • catch rate: A factor in the formula for capturing wild Pokémon. Lower rates are harder to capture. The highest value, 255, is used for common Pokémon like Hoothoot and Rattata; legendaries like Mewtwo and Ho-Oh get as low as 3.
  • base experience yield: A factor in the formula for awarding experience. Higher values give more experience. As usual, since this is a single byte (db), its maximum is 255. (Chansey and Blissey both have 255 base exp.)
  • items: A common item (23% chance) and a rare item (2% chance) that might be held by this Pokémon in the wild.
  • gender ratio: The likelihood that an Egg of this Pokémon will be female. Lower values are more likely to be male, with 0 being 100% male, 254 being 100% female, and 255 being genderless (like Magnemite or Staryu). There are named constants for the few values that get officially used:
    • GENDER_F0: 100% male
    • GENDER_F12_5: 7/8 male, 1/8 female
    • GENDER_F25: 3/4 male, 1/4 female
    • GENDER_F50: 1/2 male, 1/2 female
    • GENDER_F75: 1/4 male, 3/4 female
    • GENDER_F100: 100% female
    • GENDER_UNKNOWN: genderless
  • unknown 1: An unused value that's always 100.
  • step cycles to hatch: How many step cycles it takes for an Egg of this Pokémon to hatch. Each step cycle is 256 steps long.
  • unknown 2: An unused value that's always 5. (In the leaked G/S prototype from the Space World 1997 demo, this value was always 70.)
  • front.dimensions: The size of the Pokémon's front sprite. The front.dimensions file contains a single byte that's one of three valid values: $55 for a 40x40-pixel (5x5-tile) sprite, $66 for 48x48 pixels (6x6 tiles), or $77 for 56x56 pixels (7x7 tiles). It's automatically generated from the front.png sprite image (we'll get to this later).
  • padding: Four unused bytes that are always 0s. (In the G/S prototype, these values were pointers to the front and back sprites.)
  • growth rate: The formula that's used to determine experience point thresholds for reaching each level. (The formula coefficients are defined in data/growth_rates.asm.) Valid values:
    • GROWTH_MEDIUM_FAST: exp = L³ (1,000,000 exp = level 100)
    • GROWTH_SLIGHTLY_FAST: exp = (3/4)L³ + 10L² − 30 (849,970 exp = level 100); unused
    • GROWTH_SLIGHTLY_SLOW: exp = (3/4)L³ + 20L² − 70 (949,930 exp = level 100); unused
    • GROWTH_MEDIUM_SLOW: exp = (6/5)L³ − 15L² + 100L − 140 (1,059,860 exp = level 100)
    • GROWTH_FAST: exp = (4/5)L³ (800,000 exp = level 100)
    • GROWTH_SLOW: exp = (5/4)L³ (1,250,000 exp = level 100)
  • egg groups: The two egg groups this Pokémon is in. Two Pokémon have to share an Egg group to breed. The 15 valid Egg groups (including EGG_NONE for sterile Pokémon like babies and legendaries) are defined in constants/pokemon_data_constants.asm.
  • TM/HM learnset: A list of which TMs, HMs, and tutor moves this Pokémon can learn, passed to the tmhm macro. Valid values are defined in constants/item_constants.asm with the add_tm, add_hm, and add_mt macros.

Then edit data/pokemon/base_stats.asm:

 BaseData::
	table_width BASE_DATA_SIZE, BaseData
 INCLUDE "data/pokemon/base_stats/bulbasaur.asm"
 ...
 INCLUDE "data/pokemon/base_stats/celebi.asm"
+INCLUDE "data/pokemon/base_stats/munchlax.asm"
	assert_table_length NUM_POKEMON

4. Define its evolutions and level-up learnset

Edit data/pokemon/evos_attacks_pointers.asm:

 EvosAttacksPointers::
	table_width 2, EvosAttacksPointers
 	dw BulbasaurEvosAttacks
 	...
 	dw CelebiEvosAttacks
+	dw MunchlaxEvosAttacks
	assert_table_length NUM_POKEMON

Then edit data/pokemon/evos_attacks.asm:

+MunchlaxEvosAttacks:
+	db EVOLVE_HAPPINESS, TR_ANYTIME, SNORLAX
+	db 0 ; no more evolutions
+	db 1, TACKLE
+	db 1, METRONOME
+	db 8, AMNESIA
+	db 15, DEFENSE_CURL
+	db 22, BELLY_DRUM
+	db 29, HEADBUTT
+	db 36, SCREECH
+	db 36, REST
+	db 43, BODY_SLAM
+	db 50, ROLLOUT
+	db 57, HYPER_BEAM
+	db 0 ; no more level-up moves

The comment at the top of evos_attacks.asm explains the data structure:

EvosAttacks::
; Evos+attacks data structure:
; - Evolution methods:
;    * db EVOLVE_LEVEL, level, species
;    * db EVOLVE_ITEM, used item, species
;    * db EVOLVE_TRADE, held item (or -1 for none), species
;    * db EVOLVE_HAPPINESS, TR_* constant (ANYTIME, MORNDAY, NITE), species
;    * db EVOLVE_STAT, level, ATK_*_DEF constant (LT, GT, EQ), species
; - db 0 ; no more evolutions
; - Learnset (in increasing level order):
;    * db level, move
; - db 0 ; no more level-up moves

Munchlax evolves into Snorlax through happiness; and its level-up moves are copied from Snorlax, with a couple replacements (Metronome and Screech).

Note that the order of the EvosAttacksPointers matters, since the entries pair up with the species constants, but the EvosAttacks data is unordered. I just put Munchlax's data at the end of the file.

5. Define its egg moves

Edit data/pokemon/egg_move_pointers.asm:

 EggMovePointers::
	table_width 2, EggMovePointers
 	dw BulbasaurEggMoves
 	...
 	dw AerodactylEggMoves
-	dw SnorlaxEggMoves
+	dw NoEggMoves
 	dw NoEggMoves
 	...
 	dw NoEggMoves
+	dw MunchlaxEggMoves
	assert_table_length NUM_POKEMON

Then edit data/pokemon/egg_moves.asm:

-SnorlaxEggMoves:
+MunchlaxEggMoves:
 	db LICK
 	db -1 ; end

Note that since Snorlax will now lay Munchlax eggs, it doesn't need Egg moves of its own, and its set of Egg moves can just be reused for Munchlax. Like the level-up moves, this data is unordered, since the EggMovePointers table is used to access particular sets.

6. Define its cry

Edit data/pokemon/cries.asm:

 PokemonCries::
 ; entries correspond to constants/pokemon_constants.asm
	table_width MON_CRY_LENGTH, PokemonCries
 	mon_cry CRY_BULBASAUR,    128,   129 ; BULBASAUR
 	...
 	mon_cry CRY_ENTEI,        330,   273 ; CELEBI
+	mon_cry CRY_GRIMER,       101,   128 ; MUNCHLAX
	assert_table_length NUM_POKEMON
-	mon_cry CRY_NIDORAN_M,      0,     0 ; 252
 	mon_cry CRY_NIDORAN_M,      0,     0 ; 253
 	mon_cry CRY_NIDORAN_M,      0,     0 ; 254
 	mon_cry CRY_NIDORAN_M,      0,     0 ; 255
	assert_table_length $ff

The three values passed to mon_cry are a cry index, a pitch, and a length. Defining your own cries is similar to writing original music, and well beyond the scope of this tutorial. So just pick a cry from constants/cry_constants.asm and tweak the pitch and length until it sounds okay. I simply copied Snorlax's cry for Munchlax, with a slightly higher pitch and shorter length.

7. Define its icon

Edit data/pokemon/menu_icons.asm:

 MonMenuIcons:
	table_width 1, MonMenuIcons
 	db ICON_BULBASAUR   ; BULBASAUR
 	...
 	db ICON_HUMANSHAPE  ; CELEBI
+	db ICON_SNORLAX     ; MUNCHLAX
	assert_table_length NUM_POKEMON

Valid icons are in constants/icon_constants.asm. They're used in the party menu and Day-Care.

8. Define its Pokédex entry

Create data/pokemon/dex_entries/munchlax.asm:

+	db "BIG EATER@" ; species name
+	dw 200, 2315 ; height, weight
+
+	db   "In its desperation"
+	next "to gulp down food,"
+	next "it forgets about"
+
+	page "the food it has"
+	next "hidden under its"
+	next "fur.@"
  • The species name can be up to 10 characters (technically 11 will still fit in the Pokédex window). Be sure to end it with a "@".
  • The height and weight values are in imperial units. 200 = 2 feet 0 inches; 2315 = 231.5 pounds.
  • The entry text is in two pages; the first starts with db, the second with page. Each page can fit three lines with 18 characters each. Here it's visual size that matters—"#MON" counts as 7 characters because it prints as "POKéMON". Again, be sure to end it with a "@".

Edit data/pokemon/dex_entry_pointers.asm:

 PokedexDataPointerTable:
 ; entries correspond to constants/pokemon_constants.asm
	table_width 2, PokedexDataPointerTable
 	dw BulbasaurPokedexEntry
 	...
 	dw CelebiPokedexEntry
+	dw MunchlaxPokedexEntry
	assert_table_length NUM_POKEMON

Then edit data/pokemon/dex_entries.asm:

 SECTION "Pokedex Entries 193-251", ROMX

 PokedexEntries4::
 YanmaPokedexEntry::      INCLUDE "data/pokemon/dex_entries/yanma.asm"
 ...
 CelebiPokedexEntry::     INCLUDE "data/pokemon/dex_entries/celebi.asm"
+MunchlaxPokedexEntry::   INCLUDE "data/pokemon/dex_entries/munchlax.asm"

Each of the four sections in dex_entries.asm holds 64 Pokédex entries. Each section is in a different ROM bank, decided by which range the Pokémon's species ID is in: 1–64, 65–128, 129–192, or 193–256. The order of entries within each section doesn't actually matter, since they're accessed directly via PokedexDataPointerTable, but avoid confusion and just keep them in numerical order.

Now the Pokédex entry exists, and will be listed correctly in "Old Pokédex Mode" (the Gen 2 equivalent of national order). But we need to define the new Pokémon's place in "New Pokédex Mode (regional order) and "A to Z Mode" (alphabetical order).

Edit data/pokemon/dex_order_new.asm:

 NewPokedexOrder:
	table_width 1, NewPokedexOrder
 	db CHIKORITA
 	...
 	db AERODACTYL
+	db MUNCHLAX
 	db SNORLAX
 	db BULBASAUR
 	...
 	db CELEBI
	assert_table_length NUM_POKEMON

Then edit data/pokemon/dex_order_alpha.asm:

 AlphabeticalPokedexOrder:
	table_width 1, AlphabeticalPokedexOrder
 	db ABRA
 	...
 	db MUK
+	db MUNCHLAX
 	db MURKROW
 	...
 	db ZUBAT
	assert_table_length NUM_POKEMON

That's all for the Pokédex.

9. Design its footprint

Create gfx/footprints/munchlax.png:

gfx/footprints/munchlax.png

Then edit gfx/footprints.asm:

 ; Footprints are 2x2 tiles each, but are stored as a 16x64-tile image
 ; (32 rows of 8 footprints per row).
 ; That means there's a row of the top two tiles for eight footprints,
 ; then a row of the bottom two tiles for those eight footprints.

 ; These macros help extract the first and the last two tiles, respectively.
 footprint_top    EQUS "0,                 2 * LEN_1BPP_TILE"
 footprint_bottom EQUS "2 * LEN_1BPP_TILE, 2 * LEN_1BPP_TILE"

 ; Entries correspond to Pokémon species, two apiece, 8 tops then 8 bottoms
	table_width LEN_1BPP_TILE * 4, Footprints

 ...
 ; 249-256 top halves
 INCBIN "gfx/footprints/lugia.1bpp",      footprint_top
 INCBIN "gfx/footprints/ho_oh.1bpp",      footprint_top
 INCBIN "gfx/footprints/celebi.1bpp",     footprint_top
-INCBIN "gfx/footprints/252.1bpp",        footprint_top
+INCBIN "gfx/footprints/munchlax.1bpp",   footprint_top
 INCBIN "gfx/footprints/253.1bpp",        footprint_top
 INCBIN "gfx/footprints/254.1bpp",        footprint_top
 INCBIN "gfx/footprints/255.1bpp",        footprint_top
 INCBIN "gfx/footprints/256.1bpp",        footprint_top
 ; 249-256 bottom halves
 INCBIN "gfx/footprints/lugia.1bpp",      footprint_bottom
 INCBIN "gfx/footprints/ho_oh.1bpp",      footprint_bottom
 INCBIN "gfx/footprints/celebi.1bpp",     footprint_bottom
-INCBIN "gfx/footprints/252.1bpp",        footprint_bottom
+INCBIN "gfx/footprints/munchlax.1bpp",   footprint_bottom
 INCBIN "gfx/footprints/253.1bpp",        footprint_bottom
 INCBIN "gfx/footprints/254.1bpp",        footprint_bottom
 INCBIN "gfx/footprints/255.1bpp",        footprint_bottom
 INCBIN "gfx/footprints/256.1bpp",        footprint_bottom

	assert_table_length $100

Notice how the footprints are broken into top and bottom halves; you may want to correct this design flaw. (It won't have a visible consequence on the game, but it makes for cleaner code and data.)

(Running make later will automatically create munchlax.1bpp from munchlax.png. Since it's a 1bpp file (one bit per pixel) you can only use black and white in the image.)

10. Design its sprites and animation

This is a bit complicated. We need a front sprite with an animation sequence; a back sprite; and normal and shiny color palettes for both.

Create gfx/pokemon/munchlax/front.png:

gfx/pokemon/munchlax/front.png

And gfx/pokemon/munchlax/back.png:

gfx/pokemon/munchlax/back.png

front.png is a vertical strip of unique animation frames. Frames are all the same size; valid sizes are 40x40, 48x48, or 56x56. Here we have five frames, each 48x48 pixels. back.png is always 48x48. Both sprites have to use the same four colors: white, black, and the same two arbitrary hues.

Next create gfx/pokemon/munchlax/shiny.pal:

+	RGB 22, 22, 12
+	RGB 07, 15, 25

These two colors will be used for shiny Munchlax, along with the standard black and white. The lighter color should come first.

Now create gfx/pokemon/munchlax/anim.asm:

+	frame 0, 08
+	frame 1, 08
+	frame 0, 08
+	frame 2, 24
+	frame 3, 08
+	frame 4, 08
+	frame 3, 08
+	frame 3, 08
+	frame 0, 16
+	endanim

And finally gfx/pokemon/munchlax/anim_idle.asm:

+	frame 1, 08
+	frame 0, 08
+	frame 1, 08
+	endanim

anim.asm defines the main sprite animation sequence; anim_idle.asm defines an extra one that gets played in some contexts (notably not when a Pokémon is encountered in battle). A full description of the animation script commands is at docs/pic_animations.md.

This Munchlax animation was designed by SCMidna. But you're more likely to have a single static front sprite than a whole animated sequence of frames. In that case, you can save the one sprite as front.png (so it will be a single square frame, not a vertical strip of them), and just put endanim as the full contents of anim.asm and anim_idle.asm. Or if none of your sprites will be animated, follow this tutorial to remove the entire animation system, freeing up even more space for game content.

When you make the ROM, a number of sprite-related files will be automatically generated for you:

  • front.gbcpal: Like shiny.pal, but for the normal colors; derived from front.png.
  • front.dimensions: The size of the still sprite from front.png.
  • front.animated.2bpp.lz: The compressed tiles needed to animate the sprite. Animation frames tend to have lots of duplicate tiles, since only parts of a Pokémon move at a time, so each unique tile only exists once.
  • bitmask.asm: A sequence of masks that define which spots in each frame are changed from the still sprite.
  • frames.asm: A sequence of lists that declare the tile IDs with which to fill in the changed spots in each frame.

There are two main reasons to pay attention to these auto-generated files. One, you want to make sure that front.gbcpal got its colors in the right order, and have shiny.pal match it. Two, if your animation appears corrupt, you want to make sure that frames.asm isn't using too high tile IDs. A 40x40 sprite can use IDs $00 to $31; a 48x48 sprite can use up to $47; a 56x56 sprite can use up to $61. If you see IDs above those limits, edit your front.png frames so they use fewer unique tiles, or follow this tutorial to allow any animation to use 255 tiles ($00 to $FF but skipping $7F).

(Older versions of pokecrystal generated normal.pal and normal.gbcpal files instead of front.gbcpal, but this was redundant work and could mislead users into editing normal.pal directly, so as of September 2018 they were removed.)

Anyway, all that's left is to INCLUDE and point to the new data!

11. Include and point to the sprite and animation data

Edit data/pokemon/pic_pointers.asm:

 PokemonPicPointers::
 ; entries correspond to Pokémon species, two apiece
	table_width 3 * 2, PokemonPicPointers
 	dba_pic BulbasaurFrontpic
 	dba_pic BulbasaurBackpic
 	...
 	dba_pic CelebiFrontpic
 	dba_pic CelebiBackpic
+	dba_pic MunchlaxFrontpic
+	dba_pic MunchlaxBackpic
	assert_table_length NUM_POKEMON
-	dbw -1, -1 ; unused
-	dbw -1, -1 ; unused
 	dba_pic EggPic
 	dbw -1, -1 ; unused
	assert_table_length EGG

We have to use dba_pic here instead of a standard dba—declaring the bank and address of MunchlaxFrontpic and MunchlaxBackpic—because of another design flaw. I strongly recommend removing the whole FixPicBank routine from engine/gfx/load_pics.asm, including all four calls to it in that file, and just using dba here; then you'll be able to INCBIN sprites in arbitrary banks.

Edit gfx/pics.asm:

 SECTION "Pics 19", ROMX

-; Seems to be an accidental copy of the previous bank
-
-INCBIN "gfx/pokemon/spinarak/back.2bpp.lz"
-...
-INCBIN "gfx/pokemon/unown_r/back.2bpp.lz"
+MunchlaxFrontpic: INCBIN "gfx/pokemon/munchlax/front.animated.2bpp.lz"
+MunchlaxBackpic:  INCBIN "gfx/pokemon/munchlax/back.2bpp.lz"

(If you don't fix the dba_pic design flaw, you'll have to put your sprites in the "Pics N" sections, which are compatible with dba_pic. "Pics 19" isn't used for anything useful—all its contents are unused duplicates of "Pics 18"—and it has a whole bank to itself, so it's the easiest place to start adding new sprites. (The other sections, includng "Pics 20" through "Pics 24", have limited remaining space since they already contain some sprites and/or share their banks with other sections.) But if you have a lot of new sprites to add, you risk overflowing the banks, and it's hard to fit sprites within fixed bank limits. By using just dba, you can create new sections with a few sprites each, that will automatically be placed wherever they can fit in the ROM.)

Anyway, edit data/pokemon/palettes.asm:

 PokemonPalettes:
 ; entries correspond to Pokémon species, two apiece

 ; Each front.gbcpal is generated from the corresponding .png, and
 ; only the middle two colors are included, not black or white.
 ; Shiny palettes are defined directly, not generated.

	; 2 middle palettes, front and shiny, with 2 colors each
	table_width PAL_COLOR_SIZE * 2 * 2, PokemonPalettes


 ; 000
 	RGB 30, 22, 17
 	RGB 16, 14, 19
 ; 000 shiny
 	RGB 30, 22, 17
 	RGB 16, 14, 19

 INCBIN "gfx/pokemon/bulbasaur/front.gbcpal", middle_colors
 INCLUDE "gfx/pokemon/bulbasaur/shiny.pal"
 ...
 INCBIN "gfx/pokemon/celebi/front.gbcpal", middle_colors
 INCLUDE "gfx/pokemon/celebi/shiny.pal"
+INCBIN "gfx/pokemon/munchlax/front.gbcpal", middle_colors
+INCLUDE "gfx/pokemon/munchlax/shiny.pal"

	assert_table_length NUM_POKEMON + 1

-; 252
-	RGB 30, 26, 11
-	RGB 23, 16, 00
-; 252 shiny
-	RGB 30, 26, 11
-	RGB 23, 16, 00

 INCBIN "gfx/pokemon/egg/front.gbcpal", middle_colors
 INCLUDE "gfx/pokemon/egg/shiny.pal"

	assert_table_length EGG + 1

 ; 254
 	RGB 30, 26, 11
 	RGB 23, 16, 00
 ; 254 shiny
 	RGB 30, 26, 11
 	RGB 23, 16, 00

 ; 255
 	RGB 23, 23, 23
 	RGB 17, 17, 17
 ; 255 shiny
 	RGB 23, 23, 23
 	RGB 17, 17, 17

	assert_table_length $100

(Older versions of pokecrystal would INCLUDE "normal.pal" instead of INCBIN "front.gbcpal", as discussed earlier.)

Edit gfx/pokemon/anim_pointers.asm:

 AnimationPointers:
	table_width 2, AnimationPointers
 	dw BulbasaurAnimation
 	...
 	dw CelebiAnimation
+	dw MunchlaxAnimation
	assert_table_length NUM_POKEMON

Edit gfx/pokemon/anims.asm:

 BulbasaurAnimation:  INCLUDE "gfx/pokemon/bulbasaur/anim.asm"
 ...
 CelebiAnimation:     INCLUDE "gfx/pokemon/celebi/anim.asm"
+MunchlaxAnimation:   INCLUDE "gfx/pokemon/munchlax/anim.asm"
 EggAnimation:        INCLUDE "gfx/pokemon/egg/anim.asm"

Edit gfx/pokemon/idle_pointers.asm:

 AnimationIdlePointers:
	table_width 2, AnimationIdlePointers
 	dw BulbasaurAnimationIdle
 	...
 	dw CelebiAnimationIdle
+	dw MunchlaxAnimationIdle
	assert_table_length NUM_POKEMON

Edit gfx/pokemon/idles.asm:

 BulbasaurAnimationIdle:  INCLUDE "gfx/pokemon/bulbasaur/anim_idle.asm"
 ...
 CelebiAnimationIdle:     INCLUDE "gfx/pokemon/celebi/anim_idle.asm"
+MunchlaxAnimationIdle:   INCLUDE "gfx/pokemon/munchlax/anim_idle.asm"
 EggAnimationIdle:        INCLUDE "gfx/pokemon/egg/anim_idle.asm"

Edit gfx/pokemon/bitmask_pointers.asm:

 BitmasksPointers:
	table_width 2, BitmasksPointers
 	dw BulbasaurBitmasks
 	...
 	dw CelebiBitmasks
+	dw MunchlaxBitmasks
	assert_table_length NUM_POKEMON

Edit gfx/pokemon/bitmasks.asm:

 BulbasaurBitmasks:  INCLUDE "gfx/pokemon/bulbasaur/bitmask.asm"
 ...
 CelebiBitmasks:     INCLUDE "gfx/pokemon/celebi/bitmask.asm"
+MunchlaxBitmasks:   INCLUDE "gfx/pokemon/munchlax/bitmask.asm"
 EggBitmasks:        INCLUDE "gfx/pokemon/egg/bitmask.asm"

Edit gfx/pokemon/frame_pointers.asm:

 FramesPointers:
	table_width 2, FramesPointers
 	dw BulbasaurFrames
 	...
 	dw CelebiFrames
+	dw MunchlaxFrames
	assert_table_length NUM_POKEMON

Finally, edit gfx/pokemon/johto_frames.asm:

 JohtoFrames:  ; used only for BANK(JohtoFrames)

 ChikoritaFrames:  INCLUDE "gfx/pokemon/chikorita/frames.asm"
 ...
 CelebiFrames:     INCLUDE "gfx/pokemon/celebi/frames.asm"
+MunchlaxFrames:   INCLUDE "gfx/pokemon/munchlax/frames.asm"
 EggFrames:        INCLUDE "gfx/pokemon/egg/frames.asm"

Note that we edited johto_frames.asm, not kanto_frames.asm, because MUNCHLAX comes after JOHTO_POKEMON in constants/pokemon_constants.asm.

That's it—we're done! Munchlax works just like every other Pokémon.

Screenshot

12. Edit more data-related tables

There's a table designed to convert Pokémon indices when transferring Pokémon from Red/Blue/Green/Yellow to Gold/Silver/Crystal and viceversa. Probably you don't care about Time Capsule compatibility, but it's good to edit it to maintain the data constant (also, RGBDS will throw an error if you don't do it).

You'll find it in data/pokemon/gen1_order.asm, so let's add a new entry:

 Pokered_MonIndices:
	table_width 1, Pokered_MonIndices
	db RHYDON
	db KANGASKHAN
	db NIDORAN_M
	db CLEFAIRY
	...
	db GRANBULL
	db QWILFISH
	db WOBBUFFET
	db WOBBUFFET
+	db MUNCHLAX
	assert_table_length NUM_POKEMON + 1

13. Adding up to 253 Pokémon

We just added Pokémon #252; adding #253 is basically the same. Note that by adding it before EGG (and of course before NUM_POKEMON), the constant for #253 is $FD and EGG shifts up to $FE.

This has multiple benefits:

  • Pokémon IDs will be contiguous, from #1 to #253. No #254 with a missing #253 where Egg exists.
  • Many data tables don't have an entry for EGG since it would be superfluous. But if there were a Pokémon #254, they would need filler entries for #253 in order to reach entry #254.
  • EGG does not count as a Pokémon, so if it came before a valid Pokémon ID, then NUM_POKEMON would have to be adjusted to compensate, and certain other checks in the code would no longer be able to assume that any ID below some number N is a valid one.

It's easy to do; just make sure that the various tables have their entries in the right order: Bulbasaur, Ivysaur, Venusaur, …, Celebi, #252, #253, Egg.

Unfortunately, you can't have more than 253 Pokémon. IDs are one byte each, so they have 256 possible values. Of those values, $00 indicates a lack of a Pokémon; $FF (−1) is an end-of-list marker; and $FD is EGG (though you can change this to $FE, as discussed above). If you value having a 254th Pokémon more than allowing breeding, you could replace EGG, but you would also have to carefully remove a lot of code that treats EGG specially.

To add more than 256 Pokémon—potentially hundreds, if not thousands—see the 16-bit extension project by ax6.