Posts for MUGG


Editor, Experienced Forum User, Published Author, Expert player (2312)
Joined: 5/15/2007
Posts: 3855
Location: Germany
DarkRiolu27 wrote:
Hi there, I'm a speedrunner of this game and I'd like to help improve the TAS. The problem is that I have no experience TASing, but I'm good at finding new strats and manipulating RNG. I've been struggling with saving every frame possible and haven't been able to sync up my improvements with the current TAS, so I was wondering if anyone would be willing to help with the optimization or teach me how to make the game not desync after changing one thing. As an example of what I'm good/bad at, I changed the ending of the TAS, starting right after Kaboola 2 is defeated, and got it to be sub-9 minutes: https://tasvideos.org/UserFiles/Info/638466906468908702 There can definitely be more frames saved in what I have there.
Hello. I looked at your movie file. The improvement in the room before Whispy 2 (inhaling the chicken instead of dropping on it) is subtle but it makes sense. And I think it will come down to a lot of things like this. Just shaving off a few frames here and a few frames there. I pointed out two improvements in one of my previous posts. But you could save frames throughout the entire run. Then there are also a few more possible improvements others pointed out throughout this topic - although I didn't verify them myself yet. I made the TAS without looking at memory addresses but in order to improve it, one should really look at X, Y position, subpixel position and speed. And of course the RNG. There's an address for that but I don't have it right now. I know you could advance the RNG by having a small star sprite appear from bumping into something or on the ground. (I also pointed out that using Japanese version 1.0 is possibly the best choice since you get to create star sprites in situations where you can't on v1.1 and US/EU. Maybe there is a situation in the game where it comes in handy?) But what I didn't know is that you could apparently advance it by what you were doing - repeated inhale-cancel? Nice Dedede. Yes, this seems to be the best strategy. So if you want to start TASing, get familar with Bizhawk. If you have specific questions about a room or a strat, feel free to post here or PM me. I'll watch your WIPs.
Editor, Experienced Forum User, Published Author, Expert player (2312)
Joined: 5/15/2007
Posts: 3855
Location: Germany
Rad Rat pointed out a trick where you gain speed when jumping out of manuals in his video. It seems I pointed it out in the past. The current TAS (on N64) doesn't seem to do it. Not sure if it works on N64.
Editor, Experienced Forum User, Published Author, Expert player (2312)
Joined: 5/15/2007
Posts: 3855
Location: Germany
Dacicus wrote:
Bit 2 of LCDC.
Thank you!
Editor, Experienced Forum User, Published Author, Expert player (2312)
Joined: 5/15/2007
Posts: 3855
Location: Germany
Sprites can be 16px height or 8px height. Is there a byte that controls this?
Editor, Experienced Forum User, Published Author, Expert player (2312)
Joined: 5/15/2007
Posts: 3855
Location: Germany
Butterfly clip is now possible. Link to video Movie file: https://tasvideos.org/UserFiles/Info/638400963926222423 Bizhawk 2.8 Trip World (J)
Editor, Experienced Forum User, Published Author, Expert player (2312)
Joined: 5/15/2007
Posts: 3855
Location: Germany
Link to video I saw this behavior and thought it might be a timesaver in certain situations...? Normally you have to land when turning around in flight mode...
Editor, Experienced Forum User, Published Author, Expert player (2312)
Joined: 5/15/2007
Posts: 3855
Location: Germany
Looked into butterfly clipping once more. The enemy slots are 0x20 in size each. 0x00 - ID 0x02 - Health 0x03 - X speed 0x04 - Y speed 0x11 - movement state For butterfly, the ID is 0x45. It can have four different movement states. 0x00 makes it fly up (y speed is pushed to 0xFC) 0x01 makes it fly down (y speed is pushed to 0x04) 0x02 makes it fly right (x speed is pushed to about 0x04) 0x03 makes it fly left (x speed is pushed to about 0xFC) The movement state will change every few frames randomly, so the butterfly will usually fly in random directions. Trying to have one butterfly fly me to the top, it will not work. But flying to the top with two butterflies that are positioned at different x locations will clip Yacopu through the wall. Pressing different input, even non-consequential things like pressing up, will change the movement state. It will probably be nearly impossible to manipulate two butterflies at the same time, though. But maybe something will work out from here.
Editor, Experienced Forum User, Published Author, Expert player (2312)
Joined: 5/15/2007
Posts: 3855
Location: Germany
In the oddities section on that page, I see you uploaded the images for the normal and extra game end screens, but I don't see a difference, did you mean to upload a different image for one of them?
The tile in the center of the image is replaced by a white square tile.
Editor, Experienced Forum User, Published Author, Expert player (2312)
Joined: 5/15/2007
Posts: 3855
Location: Germany
MUGG wrote:
I found that you can stand on the ledge of the cooking pot (Act 12) without taking damage. It might be a timesaver to jump on the ledge like that, instead of taking damage like in the current run.
I tested it and it is 16 frames faster and induces 1 less lag frame right after that, so 17 frames faster. However, you have to get the star which means 10 frames lost on the score tallying screen, so 7 frames faster in total.
Editor, Experienced Forum User, Published Author, Expert player (2312)
Joined: 5/15/2007
Posts: 3855
Location: Germany
MUGG wrote:
I found a difference between J1.0 and J1.1.
I figured out the whole story now. You can read about it here: https://tcrf.net/Kirby%27s_Dream_Land#Revisional_Differences J1.1 is basicly a bugfix for a game-breaking bug that could happen in the Whispy Woods fight. That being said, I don't think this is any useful for speedrunning, but still interesting nonetheless.
Editor, Experienced Forum User, Published Author, Expert player (2312)
Joined: 5/15/2007
Posts: 3855
Location: Germany
I found that you can stand on the ledge of the cooking pot (Act 12) without taking damage. It might be a timesaver to jump on the ledge like that, instead of taking damage like in the current run.
Editor, Experienced Forum User, Published Author, Expert player (2312)
Joined: 5/15/2007
Posts: 3855
Location: Germany
Dedede won't try to inhale you if he is at 1 HP, to prevent a graphical bug with him inhaling you while he gets killed.
Editor, Experienced Forum User, Published Author, Expert player (2312)
Joined: 5/15/2007
Posts: 3855
Location: Germany
I would like to edit articles on datacrystal wiki but I can't find a way to sign up. For now, I'm leaving information here so it doesn't get lost. 407F: FA 8B FF ld a, [$FF8B] -- Check pressed buttons 4082: FE 86 cp a, $86 4084: CA 86 63 jp z, $6386 4087: FE 45 cp a, $45 -- Check if equal to 0x45 (Up+Select+A) 4089: 20 08 jr nz, $4093 408B: 3E 01 ld a, $01 408D: EA 3A D0 ld [$D03A], a 4090: CD A0 40 call $40A0 40A0: FA 3A D0 ld a, [$D03A] -- Set "extra game" flag 40A3: A7 and a, a 40A4: C8 ret z 40A5: 01 45 99 ld bc, $9945 -- Write "EXTRA GAME" letters to VRAM
Editor, Experienced Forum User, Published Author, Expert player (2312)
Joined: 5/15/2007
Posts: 3855
Location: Germany
I'm trying to read cpu registers for Game Boy (A, B, C, D, E, H, L). The Bizhawk Lua Functions page says to use
emu.getregisters()
to get the register names, but it just returns an empty table. On Bizhawk 2.8.
Editor, Experienced Forum User, Published Author, Expert player (2312)
Joined: 5/15/2007
Posts: 3855
Location: Germany
I found a difference between J1.0 and J1.1. The game produces a little star sprite when Kirby lands on the ground or bumps into a wall. J1.0 will always produce this star when Kirby lands or bumps into a wall. But J1.1 added a condition so that only one star can exist at a time. Lololo miniboss can create a little star sprite sometimes (I'm playing on Hard mode), so while his star sprite is on the screen, Kirby will not create one. J1.1 added 5 bytes of code at $37B1 "FA 14 D4 A7 C0". The game checks $D414. If it is 0x00, the game will create the star, else it won't. This is also the reason why the current TAS desyncs at Stage 2, because Kirby creates a star sprite in Lololo miniboss on J1.0 whereas J1.1 doesn't, while playing back the movie file on Bizhawk 2.8. Knowing this, it may be favorable to use J1.0 in TAS because you will have more opportunites to advance the RNG.
Editor, Experienced Forum User, Published Author, Expert player (2312)
Joined: 5/15/2007
Posts: 3855
Location: Germany
I noticed this page https://tasvideos.org/HomePages/MUGG/MLSSLuaScript abruptly ends after the Download section. The Instructions, Upcoming Features and Ideas , Known Issues and Feedback sections are not shown.
Editor, Experienced Forum User, Published Author, Expert player (2312)
Joined: 5/15/2007
Posts: 3855
Location: Germany
World 1 Room 3 improvement (9 frames faster) https://tasvideos.org/UserFiles/Info/638356675385292542 World 4 Room 5 improvement (39 frames faster) https://tasvideos.org/UserFiles/Info/638356742970915222 Game version: Japan v1.1 Both Bizhawk 2.7 and 2.8 should work. Skipping spicy food in World 4 Room 6 looks to be about 200 frames slower than using it.
Editor, Experienced Forum User, Published Author, Expert player (2312)
Joined: 5/15/2007
Posts: 3855
Location: Germany
The movie file desyncs for me in the Lololo & Lalala fight. I use the Japanese version and Bizhawk 2.8 as the description says. EDIT: Nevermind, I got J v1.0 and this movie uses v1.1
Editor, Experienced Forum User, Published Author, Expert player (2312)
Joined: 5/15/2007
Posts: 3855
Location: Germany
So I was gone for a while. Still don't like the new forum style, old was much better. It's one of the reasons I visit this site so much less now. Congrats on your run. I will check it out later. 58:30 looks like a really good time. I knew you could go a decent chunk below 1 hour back when I attempted a run, before I stopped it after the tunnel clip discovery... Speaking of which
Tunnel clipping (...) This was found by mugg and was applied in Hoohoo Mountain by SolidifiedGaming to save a full minute.
It was actually found by SolidifiedGaming and in a test I verified that it saves about 1 min 05 sec in Hoohoo Mountain. See here. Still a bit sad about that actually... But very happy to see this game progressing so well now. Also excited to see if anything comes out of your most recent discoveries that you posted in the topic.
Editor, Experienced Forum User, Published Author, Expert player (2312)
Joined: 5/15/2007
Posts: 3855
Location: Germany
YoshiRulz wrote:
...
Thank you. Now I need help with a different problem. Is it possible to save a savestate via savestate.save("HelloWorld.State") to a certain file path? I can only seem to save it to the same path as the .lua Thanks again.
Editor, Experienced Forum User, Published Author, Expert player (2312)
Joined: 5/15/2007
Posts: 3855
Location: Germany
Complete list of possible flipper altitudes achievable either directly or after one screen freeze
Possible Flipper AltitudeNo.Achieved by
0x00000001- - - - - - - - - - - L - - L L L - - - - -
0x00000A02L L L - - - -
0x02AAAA03Achievable after screen freeze while flipper is 0x0AAAA8
0x02AAB404Achievable after screen freeze while flipper is 0x2AAAAA Achievable after screen freeze while flipper is 0x0AAAB2
0x05555405Achievable after screen freeze while flipper is 0x000000
0x05555E06Achievable after screen freeze while flipper is 0x00000A
0x0AAAA807- - - - - L - - - L L - - -
0x0AAAB208- L L L - - -
0x0D555209Achievable after screen freeze while flipper is 0x0AAAA8 Achievable after screen freeze while flipper is 0x155550
0x0D555C10Achievable after screen freeze while flipper is 0x2AAAAA Achievable after screen freeze while flipper is 0x15555A
0x0FFFFC11Achievable after screen freeze while flipper is 0x000000
0x10000612Achievable after screen freeze while flipper is 0x00000A
0x15555013- - - - - - L - - - L L - -
0x15555A14- - L L L - - L L L - - - - L
0x17FFFA15Achievable after screen freeze while flipper is 0x0AAAA8 Achievable after screen freeze while flipper is 0x1FFFF8
0x18000416Achievable after screen freeze while flipper is 0x2AAAAA Achievable after screen freeze while flipper is 0x200002
0x1AAAA417Achievable after screen freeze while flipper is 0x000000 Achievable after screen freeze while flipper is 0x0AAAA8
0x1AAAAE18Achievable after screen freeze while flipper is 0x00000A Achievable after screen freeze while flipper is 0x0AAAB2
0x1FFFF819- - - - L L - - - - - L - L
0x20000220- - - L L L - L L L - - - L
0x22AAA221Achievable after screen freeze while flipper is 0x0AAAA8 Achievable after screen freeze while flipper is 0x2AAAA0
0x22AAAC22Achievable after screen freeze while flipper is 0x2AAAAA
0x25554C23Achievable after screen freeze while flipper is 0x000000 Achievable after screen freeze while flipper is 0x155550 Achievable after screen freeze while flipper is 0x1FFFF8
0x25555624Achievable after screen freeze while flipper is 0x00000A Achievable after screen freeze while flipper is 0x15555A
0x2AAAA025- - - - - L L
0x2AAAAA26- - - - L L L
Editor, Experienced Forum User, Published Author, Expert player (2312)
Joined: 5/15/2007
Posts: 3855
Location: Germany
It's not only the flipper's altitude that matters but also its velocity. Although it is possible to write a script that predicts all the math, I think it may be a bit too difficult for me. We need the flipper's hitbox data. (Note that US version has less Z-Height on flipper, if that info helps finding the data...?) With that said, I could do a simplified script but it may or may not work out. I will keep trying. My thought process so far:
(1)   Move the ball 7F before it reaches inside the flipper's area of effect for the first time.

(2)    Save state A.

(3)    Try different inputs so the flipper collides with ball in different ways
        (Previously I considered only the 10 possible flipper positionings (called "altitude" before)
         but we should consider how the ball is hit, from positioning A in one frame to positioning B in the next frame - refered to as "velocity" above.)

        After the tried input, brute force for as long as the ball is still inside the flipper. 
       (2^10 is only 1024 tries for 10 frames of trying pressing or not pressing the flipper, so this is ok.)

        After the ball leaves the flipper's area of effect, check if we reached a new scenario (ball in different position, different speed, etc.) and if yes, save state B.
        After the flipper last collides with the ball, there should be no more input.
        
(4)   For each saved state B, let ball reach to 7F before any flipper and repeat from (1)

       or if there is less than 7F before reaching the next flipper, rewind to state A in read-only and let it run to 7F before the next flipper from there,
       repeat from (1) while replicating the input of the previous flipper.

---

After each frame, check winning conditions. Examples:
- Star key count increased
- Exit reached

After each frame, check losing conditions. Examples:
- Ball reached an undesired transition (i.e. wrong exit)
- Star count below a certain pre-set after certain frame count
- Door to the next room closed after certain frame count
- Fastest record time exceeded
- Ball is too far up in the room after a certain framecount - meant to reduce on unnecessary attempts where ball is not going to be near the exit
- Ball is too low in the room after a certain frame count - meant to reduce on unncessary attempts where ball is not going to be near the exit
- Enemy not hit after certain frame count
- Yellow Coins lower than certain pre-set after certain frame count
- Blue Coins lower than certain pre-set after certain frame count
- (...)

If winning condition is reached and it beats the previous fastest time, then save a state and update the fastest time variable (that is checked by "losing condition: fastest record time exceeded"). Then discard the current attempt.

If losing condition is reached, discard the current attempt.
Editor, Experienced Forum User, Published Author, Expert player (2312)
Joined: 5/15/2007
Posts: 3855
Location: Germany
Started work on the lua. As expected, the memory address nearby the flipper addresses is used for applying speed to the ball. The address $14b4 (IWRAM) is written to 4 times per frame with value 1 when the key for the left flipper is pressed. I found that flippers will move differently after a screen freeze (star get, extra ball get, pressing a switch in the pyramid etc.) Example: 1) Hold flipper to the maximum 2) Get star 3) Let go of the flipper's key and wait 4) Notice the flipper will descend differently (will attain different values than otherwise possible) This makes things more complicated :P
Editor, Experienced Forum User, Published Author, Expert player (2312)
Joined: 5/15/2007
Posts: 3855
Location: Germany
Hello. It's been a while since I did lua work. I'm trying to use
event.onmemoryexecute
or
event.on_bus_exec
Can someone give an example? What is the name and scope you need to pass? I tried
event.onmemorywrite(function() print("hi") end, 0x14B4, "test", 16)
but it says it isn't an acceptable scope for mGBA. Thanks in advance. EDIT: I tried
event.onmemorywrite(function() print("hi") end, 0x14B2)
which seems to run. But even though the address is visibly written to in hex editor, it doesn't print "hi".
Editor, Experienced Forum User, Published Author, Expert player (2312)
Joined: 5/15/2007
Posts: 3855
Location: Germany
I started working on a luascript. Before I can finish it, it should be researched what outcomes are possible and should be tested. Things to consider:
  • Not counting B-Button item, there are four possible inputs you can do. none none Left none none Right Left Right
  • More importantly, as said before, there are 10 possible altitudes each flipper can have. It takes a few frames until your flipper can have a certain altitude, the longest one taking 7 frames.
  • Keep running the game until 7 frames before the ball is in reach, then start using the input combinations required to obtain each of the 10 altitudes.
  • After you've done that, an additional flipper press can influence the ball further.
  • After you've done that, the other flipper should also have its altitude set up via the 10 input combinations.
  • Assuming you would say "all bets are off after that" and you rely on running the 4 possible inputs each frame, if my math is not wrong that means: (10 input sequences to reach the altitudes * 2 press or no press after touching the flipper) ^ 2 because two flippers (10 * 2) ^ 2 = 400 outcomes and then 400*4^number of frames the ball is in reach of flippers so 400*4^1 = 1600 outcomes for the first subsequent frame 400*4^2 = 6400 outcomes for the second subsequent frame 400*4^3 = 25600 outcomes for the third subsequent frame 400*4^4 = 102400 outcomes for the fourth subsequent frame 400*5^5 = 409600 outcomes for the fifth subsequent frame etc. This is a bad approach, since it blindly runs inputs. We should consider the flipper's altitudes and when the ball is going to reach the flipper's area of effect, instead.
  • Furthermore, some altitudes are so close to each other, we might get away with ignoring some. Needs testing. But... 0x00000A is close to 0x000000 0x0AAAA8 is close to 0x0AAAB2 0x155550 is close to 0x15555A 0x1FFFF8 is close to 0x200002 0x2AAAA0 is close to 0x2AAAAA Maybe it's possible to reduce the altitudes to 5. Then the above math would look like this; (5 * 2) ^ 2 = 100 outcomes 400 outcomes on the first subsequent frame 1600 outcomes on the second subsequent frame 6400 outcomes on the third subsequent frame 25600 outcomes for the fourth subsequent frame etc.
I will keep testing and researching.