Metroid II is no perfect game. There are many places where the code is weird, has redundancies or inefficiencies.
I have compiled a list of notable oddities in the game's code, along with my rating of how complex (how much code is involved) and how difficult they are to fix.
Try your hand at these optimizations and have fun!
(I won't actually give you a bounty for any of these, I just named it like this because Samus is a bounty hunter)
RST_28 in 8 bytes or less |
Complexity: 1 | Rewrite the RST_28 routine to take up less bytes. It currently uses 12 bytes, but I have managed to get it down to 9 bytes. If you can do better than that, please tell me. |
Difficulty: May be impossible |
Making main_readInput use 2 registers |
Complexity: 1 | Rewrite the main_readInput routine to only use the a and b registers. It will not use the c register anymore. |
Difficulty: 1 |
Loopless getTilemapAddress |
Complexity: 1 | Rewrite the getTilemapAddress routine to no longer use a loop to add the tileY component to the calculated tilemap address. |
Difficulty: 2 |
Demolition of the if tower in collision_samusHorizontal |
Complexity: 2 | Rewrite the collision_samusHorizontal routine to not use 5 nested if statements to check background collision, to take up less bytes. collision_samusYOffset_A , collision_samusYOffset_B , collision_samusYOffset_C and collision_samusYOffset_D should all become unused variables and their labels should be removed from “SRC/ram/wram.asm”. |
Difficulty: 3 |
gameMode_dying and gameMode_dead |
Complexity: 3 | Combine gameMode_dying and gameMode_dead into a singular gameMode. |
Difficulty: 3 |
No code duplication for enCollision |
Complexity: 4 | Rewrite the enCollision family of routines to take up less bytes (they basically copy-pasted the same routine thirty times lmao). Ideally, you'd find some way of isolating the data of which xy coordinates are checked from each routine, and then making a master routine that can read this data. |
Difficulty: 4 |
itemCollected trio |
Complexity: 4 | Rewrite the handleItemPickup routine and the enAI_itemOrb routine to use one variable (one byte in RAM) to replace the functionality of itemCollected , itemCollected_copy and itemCollectionFlag . |
Difficulty: 4 |