Mon Mar 30 00:21:06 UTC 2015

It's Turbo Time

A few things to say today. I've released two new hacks in the past few days, and did a fairly quick commission hack that was released recently as well.

Metal Slug 2 Turbo

I made a hack for system11 that makes Metal Slug 2 not a laggy piece of garbage. In the end, the old rumor that it was caused by "updating the game logic twice per video update" was incorrect. The real issue was much more dumb, and much more puzzling. The way they wrote their code to lock to 30 FPS is something like this:

void vblank_callback(void)
{
  if(vblank_counter != 0xFF)
    vblank_counter++;
  if(vblank_counter != 2)
    return;
  vblank_occurred = 0xFF;
  // do things...
}
void game_update(void)
{
  // do things...
  for(;;) {
    if(vblank_occurred & 0x80) {
      vblank_occurred &= ~0x80;
      break;
    }
    vblank_occurred &= ~0x80;
  }
  vblank_counter = 0;
  // do things...
}

At first, this code seems reasonable, and not particularly odd or troublesome. But now think of the problem case: what happens if the game update misses the 'every odd frame' update window? Now the game is waiting two entire frames to get back on sync. Because of this, instead of a drop from 30 FPS to 20 FPS, it is now effectively a drop to 15 FPS. If it drops to 15 FPS, it's not affected, but if it would drop to 10 FPS, it drops to 7.5 FPS. This is very very significant, and is what makes the game run at a snail's pace. Most of the time the game is not even dropping to 15, it's only displaying as such because of the poor frame limiter code. Yes, this is actually why it runs so poorly.

Now that I've discussed the problem, let's discuss how I fixed it. Essentially, I replaced their code with the code listed below. This new code is faster to execute, simpler to understand, and works better than the original. This is what I implemented in my hacked version:

void vblank_callback(void)
{
  vblank_counter = 2; // this needs to be done for other functions to update properly
  vblank_occurred++;
  // do things...
}
void game_update(void)
{
  // do things...
  while(vblank_occurred < 2); // wait for 2 frames to have elapsed
  vblank_occurred = 0;
  // do things...
}

You may look at system11's post on the release at http://blog.system11.org/?p=1442, including a very enlightening comparison video and instructions on how to replace the ROM on a physical cartridge.

Same!Same!Same! NEW VER!

I've made a more subtle hack this time around, opting to merely fix problems in the original game, rather than turn it into something entirely different. With NEW VER!, I have added built-in 30Hz autofire that doesn't break the flamethrower, rebalanced the powerup order, changed how long items last on screen, and rebalanced difficulty, in a way that I think makes the game both more fun, and more recoverable. That said, it's still an extremely difficult game, and that was one thing I actively tried to keep with these changes. In the end, I think this makes the game much more fair, and much more playable and approachable.

You can get it here: http://dodonpachi.daifukkat.su/hacks/samenew/.

Ketsui Arrange 1.7

I've released one last version of Ketsui Arrange, which removes the suicide bullets added in 1.5, and tweaks various parameters and colorations. This is the definitive version of Ketsui Arrange, and it will be the last.

I don't have much else to say about this, you can get it here: http://dodonpachi.daifukkat.su/hacks/ketarr/.


Posted by trap15 | Permanent link | File under: arcade, reverse_engineering