Ok I've been messing around with the Basic Bot (fceu 0.98.16) and came up with the following rom information (all hex):
0024 - 0025 = input flags?
002E = horizontal position (proving the game is 255 units or positions wide)
0035 = direction. 00 = forward. FF = backward
005D = how high up in the air... offsets at 0 when on the ground, moves up/down by 2. you can fire when this value <= 2 going or staying down. once jumping, you have one frame to fire.
0065 = airborne (0=no, 1=yes)
007c = 0A means uncontrollable...
0083 = some kind of count down when fired, doesnt seem to impact gameplay... start at 28 every shot
0092 = new life state: 0 = starting game (reset) / nothing (just alive), 224 = gameover, 128 = unmoveable (like coming onscreen new game) until 0, 112 = dying until 128
00A8 = some kind of forward position
00C0 = see 00A8
00D0 = distance of current shot. you can not fire when this is >0, and it reaches 0 before the last shot leaves the visual range. gets reset immediately when hitting an enemy.
00D9 = something about height as well, but offsets at 181 when on the ground and decreases as you go up. there are more addresses like this one in the 02xx range
00E0 = number of lifes
0603 - 0608 = (value-0x30) is score, xxxxxx, where 100's = 0606, 1000's = 0604 etc. when the counter ticks at 999900, 0607's lowbyte turns to 9 as well (only time ever). after that no increments are possible. game doesn't use the 0608 lowbyte, but you can set them all to 9 to get the game to show 999999 as score :) what the 0x30 represents I can't tell.
06C0 - 070F = indicates land, where "you" seem to be on 070D E or F and 06C0 is at the horizon. only lowbytes are used, E means land, 4 means gap.
For some testing, I've come up with the following code. The code is ok, you have to remember that the optimization factor in this game is rather high (although I don't know how high relative to other games...). This means that there are far more possible ways of doing things then you can test.
The only code that doesn't seem to work is not shooting while in the air. I'll fix it later, it's not very important (but my second tie is the negative number of times b-button was pressed).
// dont shoot while in the air or when your-shot-counter is not 0
// rc(5) (mem(x00D0) = 0) ? 500 setcounter(5) : 0 (mem(x005D) > 2) ? 0 setcounter(5) : 0 c(5)
rc(5)
(mem(x00D0) = 0) ? 500 setcounter(5) : 0
(mem(x005D) > 2) ? 0 setcounter(5) : 0
c(5)
// jump when approaching a gap
(mem(x06FC)=20) ? 1000 : 0
// if left last time, high chance of left this time
// 300 setcounter(3) c(1) ? 800 setcounter(3) : 0 c(2) ? 0 setcounter(3) : 0 c(3)
300 setcounter(3)
c(1) ? 800 setcounter(3) : 0
c(2) ? 0 setcounter(3) : 0
c(3)
// same for right, except if left was pressed _this_ frame, right is also not pressed.
// 300 setcounter(3) c(2) ? 800 setcounter(3) : 0 c(1) ? 0 setcounter(3) : 0 left button ? 0 setcounter(3) : 0 c(3)
300 setcounter(3)
c(2) ? 800 setcounter(3) : 0
c(1) ? 0 setcounter(3) : 0
left button ? 0 setcounter(3) : 0
c(3)
// needs this extra code
// rc(1) rc(2) (0 < left button) ? 1 ac(1) : 0 (0 < right button) ? 1 ac(2) : 0
rc(1) rc(2)
(0 < left button) ? 1 ac(1) : 0
(0 < right button) ? 1 ac(2) : 0
//for the above, we want to range the number from 750 to 950
//this alternates between 750 800 850 900 and 950 every 5 frames.
750 + ((attempt % 5) * 50)
//700 800 900
700 + ((attempt % 3) * 100)
// count number of times b was pressed
((bbutton>0) ? 1 ac(0) : 0)
// score
(ram(x0606)-x30)+
((ram(x0605)-x30)*10)+
((ram(x0604)-x30)*100)+
((ram(x0603)-x30)*1000)
// dying
(mem(x0092) != 0)
In case you haven't noticed, the line of code "commented" is what you can copy/paste into the input boxes.
For your lazy convience
here's the botfile :)
It stops an attempt when dead or after 300 frames (play with it yourself). It maxes the score, breaks ties depending on how many frames long this attempt is, second tie depends on number of times b-button was pressed (fewer=better). Third tie is my debug-echo, currently shows what probability the left/right buttons get when pressed previously.
Let this run AFTER you get the gun. It can not yet jump large gaps, I have yet to determine when it's safe to release A, as this doesn't seem to be as static as the moment you need to press it.
I'm having trouble figuring out the collision detection system. I think there are a few ranges dedicated to this, but the numbers are so jumpy that it's not so easy to figure out as the stuff above. If anyone wants to lend me a hand here...
Note that due to the implementation of this bot, the more code you have, the slower the thing gets. I intend to improve this myself (going to parse the input once and convert it to bytecode, which should show dramatic increase in performance...). Also, you can't turn off visuals, but the program runs faster if you minimize the main window.