altf4 / libmelee

Open Python 3 API for making your own Smash Bros: Melee AI that works with Slippi Online
GNU Lesser General Public License v3.0
237 stars 47 forks source link

Occasional skipping of postgame #14

Closed neale closed 7 years ago

neale commented 7 years ago

I think I did this to myself, pretty positive actually. But melee will pretty often skip the post-game altogether. When a match is finished, the next frame is just the next match, skipping post-game, character select, and stage select. The given example works fine, so its not my dolphin installation. Nevertheless I can't find where I would have even enabled some sort of persistent game option.

neale commented 7 years ago

I spam an action every second, I have the issue down to a line where I call an action when in IN_GAME. If I don't call into techskill every frame, then the problem goes away. It would be nice to have an alternative, like

if ai_state.action  == enums.Action.DONE:
    do_thing()

If I skip 100 frames between actions I can end the game and get to post game. Its like the game can't end as long as the AI is trying to execute an action

altf4 commented 7 years ago

I don't quite understand what the bug is here? The first comment sounds like you found a bug in melee? Perhaps you can elaborate a bit more on what you expected to happen versus what is happening.

neale commented 7 years ago

I'm pretty sure the bug is not in melee. When a match ends, the game will never enter the post-game state or character select as it should. When the match ends, it just restarts the match. I found that this happens when I give button input every frame.

I'm wondering if this was expected behavior and that I should avoid spamming melee with commands.

altf4 commented 7 years ago

Can you make an example of this? Either in code that I could reproduce or video? I'm pretty sure that's not supposed to happen. :) You may have stumbled on some sort of rare melee bug on the transition between menus.

The game can certainly handle as many button presses as you can throw at it. That shouldn't be a problem. SmashBot frequently sends actions every frame to do various tech skill things.

neale commented 7 years ago

I can do that. I figured out a way around it in the meantime. If I use simple presses and release the buttons every other frame than I don't have the problem.

gamestate.step()
if gamestate.menu_state == melee.enums.Menu.IN_GAME:
    # frame one: just an example
    controller.simple_press(1, .5, BUTTON_A)
    # frame two: next time this loop runs clear the buttons
    controller.simple_press(.5, .5, BUTTON_MAIN)

""" Everything else"""

I'll make an example repo of this tomorrow:) Since I don't think this will allow me to charge smash attacks

vladfi1 commented 7 years ago

@neale That sounds like the 20XX salty runback feature, maybe you're running a modded iso? Or maybe you have some cheat enabled?

ghost commented 7 years ago

@vladfi1, I tried running the bot with 20XX, couldn't pass the character select screen: https://github.com/altf4/libmelee/issues/11

neale commented 7 years ago

@vladfi1 I'm just using the stock 1.02 iso I got from Isozone with only the Netplay cheat enabled. I haven't been able to make any more headway on the main issue, mostly because I've been busy with work. If anyone was realllly interested they could comb through my forked repo around line 140. But I'll make a video or sample repo in lieu of that.

vladfi1 commented 7 years ago

@neale Forgot to post this earlier, but I believe the netplay cheat code has some sort of postgame skip feature (possibly button-dependent).