Skip to content

Instantly share code, notes, and snippets.

View ketsuban's full-sized avatar

Thomas Winwood ketsuban

View GitHub Profile
@ketsuban
ketsuban / ideas.md
Last active December 25, 2023 22:59
Things I'd like to have a go at but don't really know where to start
  1. Star Trek: The Next Generation: A Final Unity game engine recreation

    I like this game, but right now if you own it and want to play it you need to set up DOSbox, and that's lame. All its data files seem to be stored in a single directory on the CD, so an executable which can read those would be very cool.

    Prior art: There's an okay resource for file formats but its focus is on data dumping, so there's no documentation that I can find on which files constitute behaviour and how they're arranged. There's also this unfinished attempt to implement the game in ScummVM, but since it's written in C++ it's basically gibberish and the impetus to finish it dissolved when DOSbox gained support for the original.

  2. Magic: the Gathering simulator

Magic is fun[citation needed], but playing it online sucks. Wizards of the Coast has actually put effort into a couple pieces of software that simulate the effect o

Add a debug menu to pokeemerald

During development it's common for your game to be partially complete; even if it isn't, you probably don't want to spend a whole bunch of time playing through the game to get to the bit you need to test. As such, it's useful to have a debug menu with a collection of tools defined in code to do useful things for you which you don't expose to the players. However, pokeemerald reproduces the commercial release of Pokémon Emerald, so there's no debug functionality at all. Fortunately we're programmers, so we can fix that.

I assume a reasonable familiarity with C, so I won't be explaining things like preprocessor directives, include guards, what a structure or its fields are, or the like. If you want or need to look these things up, you now know what to search for.

Step 0: Add a compile flag

There's no reason to expose the debug menu to the players, so it's a good idea to keep it behind a compile flag just like Game Freak did. This is technically optional,

zsh users are advised to use the terminfo database as the most portable way to assign commands to particular keychords, but I haven't been able to find a database of which terminfo sigils correspond to which keys. Fortunately, I found enough information written in ancient Sumerian that I could translate it into something modern humans can comprehend.

Key Chord Terminfo Name
Backspace kbs
Ctrl-Backspace cub1
Insert kich1
Shift-Insert kIC
Alt-Insert kIC3
Shift-Alt-Insert kIC4