2018-11-12

Debugging With mGBA

I finally figured out how to get the mGBA debug server working:

  • Build your GBA ROM.
  • Open the ROM with mGBA.
  • Open the mGBA debug server UI (in macOS, open Tools -> Start GDB server…).
  • Using the default options (port 2345 and address 0.0.0.0), hit “Start”.
  • Open up a terminal and run /opt/devkitpro/devkitARM/bin/arm-none-eabi-gdb to start GDB.
  • In GDB, enter target remote localhost:2345 to connect to mGBA.
  • Enter file <path_to_elf>, replacing <path_to_elf> with the full path to the .elf file that should have been created alongside your ROM.
  • When asked if you want to change the file, enter y and hit Return.

Now you should be connected to mGBA, with symbols loaded, ready to start debugging.

2018-10-13

Professor Sinister v20181013

PypeBros kindly created a title screen for Professor Sinister, so here’s a new release:

In addition to the title screen, this latest version includes some bugfixes, tweaks to the music and improved audio quality.

Get in touch if you have a way of getting the ROM onto one of those cheap reproduction carts that folks sell on Etsy. I’d love to have a physical copy of this on a dedicated cart.

2018-08-06

Professor Sinister XM Music

On the subject of XM music modules, here’s the Professor Sinister mod:

This has all of the different tracks embedded in it in different blocks. The song index is:

  • 00: Empty block (songs that don’t loop jump here when they end)
  • 01: Climb Time (in-game music);
  • 0B: Pause jingle;
  • 0C: Oh Well (game over music);
  • 14: Something Sinister (title music);
  • 27: Ooops (lost a life music).

You’ll need something like MilkyTracker to play it.

2018-08-05

Professor Sinister v20180805

I’ve decided to scale back Professor Sinister in order to move on to other projects. Things that didn’t make the cut:

  • High score table;
  • New level designs;
  • New sound samples;
  • Attract mode.

With the exception of new level designs, these are all minor features that aren’t important. New level designs would have been great, but I found that larger levels had the effect of overly-emphasizing the simplicity of the game. The larger the levels, the “thinner” the game feels. Redesigning levels within the existing size constraints isn’t interesting, so I’m keeping the original designs.

The last thing to do is the bitmap for the title screen. I have no idea when I’ll get around to that.

Here’s an almost-final version:

I had to check that the game wasn’t completely invisible on an original, unlit GBA-001. Here it is:

Professor Sinister Original GBA

It’s no worse than any other game on the system. Thanks to the GBA-001’s horrible screen that’s the best picture I could get.

Here’s a screenshot:

Professor Sinister Screenshot

2018-07-29

More Professor Sinister Music

Here’s the last Professor Sinister track:

This is the title screen music.

I’d planned to put up a post with piano demo tracks of all three chiptunes, but unfortunately all but one have conversations over the top. Here’s that one, anyway:

This was the last 10 seconds of almost 3 minutes worth of piano doodling. I’d got an idea of what the tune should sound like, solidified the ideas on the piano, wrote it up in MilkyTracker, and found that I hated it. The final chiptune came almost entirely from this little snippet of music that was a throwaway accident at the end of the demo recording.

“Oh Well” and “Climb Time” both came from noodling on the piano, which I find is a much more efficient way of discovering melodic ideas than trying to come up with something directly in a tracker. “Something Sinister” on the other hand was entirely written in a tracker, except for the basic 4 chord progression that it uses. That came from another piano noodling session.

2018-07-18

Professor Sinister Update #2

An update:

There are a few obvious changes in this build and some behind-the-scenes fixes.

There are now graphics for the duck. I went through a number of different ideas for what the duck should look like:

  • A Sinistar-style skull (full face view);
  • A Terminator-style skull (2/3 view);
  • A demonic face;
  • A modified version of the existing robots (a different color with flames coming from beneath it);
  • A robot bird/pterodactyl;
  • An Impossible Mission-style sphere.

I think the Terminator-style skull would have been the best option, but I couldn’t get it looking anywhere near right. The design had to be limited to what I could actually draw, which turned out to be a pulsating eyeball. It has nothing to do with the “marauding mechanicals” theme but it looks neat, so pulsating eyeball it is.

In order to change the shape of the duck I had to change how the library determined if there were collisions between Harry and other game objects. Specifically, I had to move the collision test code out of the library entirely and add a callback to the game’s delegate so that the user of the library could create its own collision test based on the shape of the sprite bitmaps. I tightened up the collisions at the same time.

On the subject of the duck, I rewrote its movement again. Now it’s pretty close to the original Chuckie Egg.

The sprites now appear behind the score indicators at the top of the screen thanks to the GBA’s ability to interleave sprites and tiled backgrounds.

The scrolling system used to support arbitrarily-large levels is now a separate class. I ripped most of the code out of the text scroller and replaced it with the new scroller class.

The ROM is 70K smaller. Most of the savings came from removing unused sounds or converting stereo sounds to mono.

Lastly, the high score music is in the game. It’s in the wrong place, however, as there’s no high score screen yet.

The todo list is getting shorter:

  • New sound samples.
  • New death music.
  • New level designs.
  • High score screen.
  • Title screen bitmap.
  • Title screen music.

2018-07-14

Professor Sinister Music

Two of the three music tracks necessary for Professor Sinister are ready to go. Here are the completed tracks:

“Climb Time” is the in-game tune. “Oh Well” is the game over/high score tune. Both tracks are chiptunes. They’re embedded in the same XM and share instruments. Both also sound significantly less crisp on the GBA’s anemic speaker and crummy sound hardware.

I have a name for the title music, which is the last outstanding track: “Something Sinister”. I don’t have a tune yet though.

I’m thinking of adding a “disable music” option to the game.

2018-07-06

Professor Sinister Update

Here’s a video of the latest build of Professor Sinister:

The most obvious change is the inclusion of the score/level/etc indicators at the top of the screen. Those are implemented as tiles in one of the GBA’s 4 background layers, giving us one layer for the text, one layer for the platforms, one layer for the parallax background, and one spare layer.

It wasn’t really noticeable in the previous video, but there was a little flickering at the top of the screen in both the sprites and the background tiles. It turns out that my belief that there was no performance work to do in the game engine was incorrect. Representing the vacuum tubes and power packs as “game objects” (essentially a data structure representing a sprite) instead of just inspecting tiles in the level data meant that the game had to iterate over them all when testing for collisions. That taxed the GBA’s tiny brain just a little too far.

The game just about got away with it until I decided to support larger levels with larger quantities of collectible items (demoed in the video above), at which point the horizontal tearing was too awful to ignore. I had to rewrite the egg/chicken feed code in the SZChuckie library, and then update both the Professor Sinister and the Chuckie Egg front-ends to match. Larger levels will let me take advantage of features of the engine that Chuckie Egg can’t use, such as arbitrary numbers of vacuum tubes, power packs, elevators and robots.

The game now has a “Simian Zombie” logo screen and horizontal scrolling text on its title screen (but it’s really inefficient so I’ll probably rewrite it), and a functioning “get ready”/“game over” screen.

I rewrote the way that the duck moves. The old code was pretty nasty and only managed to move the duck in one of 8 directions (horizontal, vertical, diagonal), whereas the new code uses vectors (correctly this time) to calculate a more direct route to the player. I still haven’t come up with a new design for the duck, though, so it’s not visible in Professor Sinister yet.

Speaking of design, here’s some more detail on Professor Sinister’s graphics. I originally wanted the robots in Professor Sinister to look like something from a 1950s sci fi movie: clunky and boxy, and covered in flashing lights. Their bodies would be separated into two distinct parts, so that when they changed direction the bottom half would spin 180˚ before the top swiveled around to match. I eventually ditched that idea because it would slow down the gameplay and would require far too many changes to the Chuckie Egg library.

I refined the pool of robotic inspirations down to just two: the robots from “Wallace and Gromit” and “Forbidden Planet”. In the former, I liked the little wheel that the robot scoots around on. In the latter I liked the bulbous design, segmented arms, and pincers.

The first design I came up with was very similar to the version that ended up in the game:

First Robot Design

It was taller and thinner, however, so that when I tried transferring it into Aseprite I quickly realized that it was entirely the wrong shape. The robot was too tall for the 16x16 sprite and didn’t take up enough horizontal space. At that point it seemed that I’d have to ditch the design entirely, because trying to squash the robot into a wider, more cylindrical shape (from Robo to Mobo) didn’t work at all.

I gave up on the robots and switched to Professor Sinister. I was aiming for a cross between Dr Robotnik from “Sonic the Hedgeghog” and Dr Wily from “Mega Man”. Most of what I draw ends up looking like something from “The Far Side”, so that’s where I started. I knew I wanted thick, opaque glasses, a round head and body, and a lab coat, but the lab coat never looked right and neither did the body:

First Professor Sinister Design

In pursuit of new ideas I briefly toyed with the idea of making the professor female, but I didn’t get very far with that. Instead I tried out an egg-shaped head (referencing Chuckie Egg) with feet directly attached to it, like Dizzy, and it looked pretty good:

Amended Professor Sinister Design

Once I had a sketch to start from, getting the character into Aseprite was easier than I’d expected. The only feedback I got on the sprite was “it looks too much like an egg”, so I added a ring of white hair around the top of his head to hide his eggy-ness.

“Rick Dangerous 2” provided much of the palette for the professor. Its graphics are wonderfully cartoony and vibrant. I’ve always wanted to make a game that looked like Rick 2. Borrowing colors from its palette seemed like an obvious first step.

With the professor finished I realized that I could keep the egg theme for the robots. I took the egg shape, flipped it upside down, and suddenly the design worked:

Amended Robot Design

It took some flipping between Aseprite and Acorn to get the sprites into a form that Grit could convert to C code. Grit of course utterly failed to produce correct palettes. I had to figure out which index Grit had assigned to each of the 60 or so colors used in the game and the set up the palette in code. Each minor edit to the graphics completely changed the layout of the palette, meaning more manual palette layout. I later discovered that although Grit can’t produce a palette from BMP, PNG or PCX files, it will correctly convert palettes from GIF files.

Testing out the graphics revealed a problem with the professor sprite. In Chuckie Egg, Harry’s feet are precisely aligned with the collision area between Harry and the floor. It’s possible to be pixel-perfectly accurate in moving him to the edge of a platform. In the new graphics I’d made the professor’s feet much larger and had completely lost that accuracy. I had to redraw the feet to line up with Harry’s.

The ladder uses some of the palette from Rick Dangerous 2, as do the background tiles (which were heavily influenced by some background tiles in one of the Rick games). The platforms are also similar to platforms in Rick 2.

I created the vacuum tube and power pack tiles, and the elevator sprite, entirely from scratch. I had a look at a couple of vacuum tubes on Google for inspiration, but otherwise I didn’t have any reference for these graphics.

As for the duck, I had a couple of ideas: a sphere (in reference to “Impossible Mission”) or a demonic robot face (like “Sinistar”). Then I remembered that it needs to be roughly the same shape as the duck or the collisions won’t work correctly, so I’m now considering some kind of robot pterodactyl thing.

The todo list doesn’t seem to be getting any shorter:

  • Add a title screen bitmap.
  • Write music for the title screen.
  • Write music that plays when Sinister is killed.
  • Create new graphics for the duck and its cage.
  • Replace the sound samples.
  • Add a high score screen.
  • Replace all level designs.
  • Add an attract mode.