This movie finishes the first level probably 48 frames faster than published
[2272] NES Sword Master by ventuz in 05:14.70
I won't continue this on my own (boring jump optimizations), but it's easy with the lua script to see when you lose speed. I'm looking for someone to continue it (co-authors).
Jumping is 1.5px/f while walking is 1.0px/f
When you attack, you will have 0 speed for 1 frame. Attack when you get 1px/f (so you sacrifice the lowest ammount of position)
You can jump 3 times in a row
Fights are optimized for sure
Simple LUA script:
http://pastebin.com/zQ9vxma2
Language: lua
local px, py, pxs, pys
local lpx = 0
local lpy = 0
local function Stuff()
if (memory.readbyte(0x1b) == 2) then
px = memory.readbyte(0x423) + memory.readbyte(0x620) + memory.readbyte(0x621) * 256
else
px = memory.readbyte(0x423) + memory.readbyte(0x624) + memory.readbyte(0x625) * 256
end
-- for level 1, 624 and 625
py = memory.readbyte(0x425)
pxs = px - lpx
pys = py - lpy
gui.text(120, 24, string.format("X: %3d (%2d)\nY: %3d (%2d)",px, pxs, py, pys))
gui.text(186, 24, string.format("XP: %3d|%3d", memory.readbyte(0x6dc), memory.readbyte(0x6da)))
lpx = px
lpy = py
end
emu.registerafter(Stuff)