Files
pokemon-gba/README.md
T

94 lines
7.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# My GBA Game
An original Game Boy Advance adventure, built one small step at a time.
## Play your game
Double-click **Build and Play.command** in this folder. It builds your ROM, runs the checks, and opens mGBA.
Or open Terminal and run:
```sh
cd ~/gba-game
make play
```
The game file is **game.gba**. You can also open it directly in mGBA without rebuilding.
### Controls (mGBA defaults)
- **Arrow keys:** walk and turn to face that direction, including when a wall blocks movement.
- **X (GBA A button):** talk to Mila, the person in green below the house. Walk close first, then press X again to turn the page and once more to close the conversation. Walking pauses while talking. You can also greet the golden creature when nearby.
- **X at the house door:** stand on the steps below the door and press X to open it and go inside. Walk to the bottom doorway inside and press X to return outside.
- **Leave Greenleaf Village:** follow the central sandy path down through the gap in the bottom fence. Keep walking down to enter **Sunpetal Trail** automatically.
- **Return to the village:** on Sunpetal Trail, follow the central path up to the top edge. Press X beside the wooden sign to read the directions.
- **Visit Professor Mellon:** follow the village's horizontal sandy path right through the fence opening. His blue-roofed house is in the garden. Press X on its steps to enter, then walk close to the professor and press X to talk. Leave through the bottom doorway, then follow the garden path left to return to town.
- **Get your first partner:** talk to Professor Mellon and press X to advance his conversation. He gives you **Sprout**, an original Grass-type partner at level five. This is a one-time gift; later conversations check on Sprout instead.
- **Backspace (GBA Select button):** open your team to see Sprout. Press Backspace, X (A), or Z (B) to return. Movement pauses while the team screen is open.
- **Sprout follows you:** after receiving Sprout, walk a few steps and it follows your path. It travels through doors and map exits with you.
- **Battle the golden creature:** with Sprout on your team, walk close to the golden creature in Greenleaf Village and press X. Use Left/Right to choose **Tackle** or **Leaf Tap**, then X to attack. The golden creature responds with Bump. Press Z (B) to run away. At the result screen, press X or Z to return to the map. Sprout recovers fully after each battle.
- **Wild encounters:** with Sprout, walk around either tall-grass patch on Sunpetal Trail. **Fernfox** (Grass), **Emberwing** (Fire), or **Pebblit** (Rock) can appear automatically. Each has its own original 24×24 sprite, palette, health, and attack. Encounters only happen while moving in grass, with a short breather between battles. Leaf Tap is stronger against Pebblit and weaker against Emberwing. Fighting and running use the same keys as the golden-creature battle.
- **Get Poké Balls:** talk to **Ranger Finn**, the person in orange just left of Sunpetal Trail's central path. Press X again to receive **five Poké Balls**. This gift is given once. Press Backspace to see the count on the team screen, even if you do not have Sprout yet. Catching creatures is not implemented yet.
- **Return (GBA Start button):** return to your starting position in the current map.
If those keys do not match your emulator settings, check mGBA's keyboard input settings.
### Your first change
Open `source/main.c` in a text editor. Find:
```c
static const u16 shirt = RGB(5, 14, 29);
```
Those numbers mean red, green, and blue, each from 0 to 31. Try `RGB(29, 6, 6)` for a red shirt. Save, then double-click **Build and Play.command** again.
## Project files
- `source/main.c`: map, character, creature, and game rules.
- `source/wild_creatures.h`: original wild-creature sprites and palettes.
- `source/start.s`: code that starts the GBA hardware.
- `gba.ld`: tells the compiler where cartridge code and working memory go.
- `tools/rom_header.py`: adds the cartridge header the GBA expects.
- `Makefile`: builds the game with the installed ARM compiler.
- `tests/`: cartridge header, NPC interaction, drawing, house entry/exit, and room collision tests. `make check` also generates scene previews in `build/`.
Graphics are drawn into a RAM buffer first. Only the changed spans of each row are copied to the GBA screen during VBlank, so walking does not expose a half-erased character. Full map changes are copied while the display is temporarily blanked.
## Saving your partner and items
Receiving Sprout or Finn's Poké Balls automatically writes a small cartridge SRAM save, stored by mGBA alongside the ROM as `game.sav`. Keep that file to retain your partner and item count after reopening the game. Older Sprout-only saves remain compatible. Partner ownership, the ball count, and whether Finn's gift was claimed are saved, but your map and position are not. The golden-creature battle is a repeatable practice battle with two moves, health bars, victory, defeat, and running away. Sprout recovers afterward. Experience and catching creatures are not implemented yet.
### Change what Mila says
Find `dialogue` near the top of `source/main.c`. Each pair of strings is one page of her conversation. Use CAPITAL letters and spaces, with no more than 34 characters on each line. Save and rebuild to try your new conversation.
## Mac setup
We are using Homebrew's standalone ARM compiler, not devkitPro.
The project includes its own minimal startup code and linker script; it does not require devkitPro or an additional GBA library.
1. From the account that owns Homebrew, install the compiler and binary tools:
```sh
/opt/homebrew/bin/brew install arm-none-eabi-gcc arm-none-eabi-binutils
```
2. Install [mGBA](https://mgba.io/downloads.html), an emulator for testing our game, either from its website or with:
```sh
/opt/homebrew/bin/brew install --cask mgba
```
Do not run Homebrew with sudo. Homebrew installations and updates should be handled by its owning account. Rory can use the installed compiler to build this project without administrator access.
Never share your Mac password in chat. Enter it only in the Mac's installer or Terminal prompt.
We are making an original game. No existing Pokémon ROM or separate BIOS download is needed for this first project in mGBA.
## Project status
Greenleaf Village connects south to Sunpetal Trail and east to Professor Mellon's garden and house. Both houses have working doors. Mila and the professor have conversations, and Mellon gives you Sprout once. Ranger Finn gives you five Poké Balls once, with a saved inventory count. Sprout is saved to SRAM, appears on your team screen, follows your footsteps, and can battle the village's golden creature. Three wild species appear in the route's tall grass, using distinct shaded sprites rather than recolors. Battles support two moves, species-specific replies, health bars, victory, defeat, running away, and free recovery.
All artwork is original; no Pokémon game assets or ROMs are included. Experience, catching creatures, sound, and full progress saving are not implemented yet.