mrchrisster / MiSTer_SAM

152 stars 22 forks source link

(Need advice and feedback from usage) Choosing in which mode to operate SAM #128

Closed felleg closed 2 years ago

felleg commented 2 years ago

Context for this "issue":

I've been using this script with a friend to "spin the wheel and find random games" to great success. I think I'm having a "it's a bug, not a feature" experience: while I believe the script normally should detect inputs and stop the internal counter to allow players to pick up and play a game, it seems the game changes for us when the counter reaches 0 even after we start playing it. Is this intended behavior? Either way, I love this behavior. It maade me realize that there are three different ways I want to use SAM.

What I would like to accomplish:

I see three modes in which MiSTer SAM could operate to cover all usecases that comes to my mind:

  1. Game changes after counter reaches 0 regardless of button inputs
  2. Game changes after counter reaches 0 only if no input has been pressed
  3. No counter: just launch 1 random game every time the script is called

I would like to find a way to easily pick in which mode I want to run MiSTer SAM. What would be the cleanest way to set this up? The best solution for me would be one that allows picking a Script that would launch MiSTer SAM in the correct mode.

Another thought: It would be perfect if we could set a different counter for modes 1 and 2.

Brainstorming

I thought about making different copies of the MiSTer_SAM script to track different ini files, but doing so would prevent me from getting automatic updates for the script. Currently, MiSTer SAM only supports 1 ini file with a hardcoded path, so I suppose running MiSTer SAM in the three modes outlined above is not possible without modifying the ini file every time.

Thoughts?

mrchrisster commented 2 years ago

Hey Felix, When SAM detects Button inputs, it should stop the shuffle indefinitely if menuonly=yes is set in the ini. menuonly means "Only start SAM if you are in the main Mister menu. So menuonly=no will continue the shuffle while you have started playing a game. A couple days ago we fixed an issue where menuonly was ignored by SAM. If you update, it should work again now as intended. 1 and 2 of your use cases can be controlled by setting listenjoy=no (or whatever input device you use) in the ini. We used to have an extra script for use case 3 that we called I feel lucky. Let me see if I can find it, we can add it as an extra option on GitHub.

mrchrisster commented 2 years ago

I can add those three modes in the SAM menu. Shouldn't take me long and it means you won't have to change things manually. Those three cases are all covered by SAM but can't be set in a convenient way. Let's make this easier.

felleg commented 2 years ago

Thanks a lot mrchrisster! You're making an already great script ever greater!!

felleg commented 2 years ago

Another thought: It would be perfect if we could set a different counter for modes 1 and 2.

Paradox commented 2 years ago

My controller isn't recognized, either, but both mouse and keyboard are recognized, so, if you have one of those connected, try moving the mouse, or, hitting a key on the keyboard.

mrchrisster commented 2 years ago

I have a first version ready in test branch.You can test by going to MiSTer_SAM.ini and set branch=test at the bottom. Then update and check the new menu items. (Game roulette)

@Paradox I'd like to figure out why your controller is not detected. What output do you get from ls /dev/input ?

Paradox commented 2 years ago

by-id event0 event10 event2 event4 event6 event8 js0 js2 js4 mouse0 mouse2 by-path event1 event11 event3 event5 event7 event9 js1 js3 mice mouse1 mouse3

Paradox commented 2 years ago

I have several controllers connected, and upon pushing buttons on all of them, only 1 was detected.

Looking around in the different scripts, it seems it only watches js0, although there is some commented code that is meant to start a watcher for each controller. Seems we need to figure out how to ignore BT only, or, figure out a way to work around it. None of the controllers I have connected are BT, but, I do have some, I guess I'll dig them up and test them out..

I uncommented the code, and all 4 of my controllers work, now. So, we need to figure out how to work with, or, around misbehaving controllers.

mrchrisster commented 2 years ago

The problem is a lot of people are buying PS5 controllers now. A single controller connected over bluetooth creates a js0 and js1 device. Js1 in my case is always firing which breaks SAM. Kitrinx thinks it's probably the info from the different sixaxis causing a constant stream of data.

What we could do is have a switch in the ini for Bluetooth controllers which only enables js0. Otherwise we would need to improve on the python script to see if any of the binary data streaming through js devices can let us identify PS5 controllers.

felleg commented 2 years ago

I feel this thread is developing into its own issue. Should we make a separate issue to make sure what I discussed in the OP is properly tracked?

mrchrisster commented 2 years ago

My thoughts exactly and that's what I just did:

https://github.com/mrchrisster/MiSTer_SAM/issues/131

mrchrisster commented 2 years ago

Did you try out the test branch?

felleg commented 2 years ago

I did:

Here is what I see after running the script:

I do see the added modes by doing a git diff Screenshot from 2022-05-10 09-08-41

Where should I go in the configuration menu to set my roulette preferences? Screenshot from 2022-05-10 09-07-53

No additional options in the Scripts list image

In short, the MiSTer_SAM_on.sh of the test branch seems to run for me as the current main version.

Paradox commented 2 years ago

That's not how it works, you open the ini and change branch, all the way at the bottom, to test and run the script again, with no switches, or, the upgrade switch.

felleg commented 2 years ago

I managed to make it work! Peek 2022-05-10 12-03

It's almost as I imagined. The only things I wish for are :

Other than that, it works wonders! Thanks a ton @mrchrisster , let me know if you intend to fulfill these wishes or not. :)

felleg commented 2 years ago

Actually, one thing I notice is the roulette1 option doesn't seem selectable (see gif from comment above). Normal?

image

mrchrisster commented 2 years ago

Hey Felix,

Yeah this was my test setup. You see that the gametimer is actually just 30s, so I can test if the variables are being handled correctly. With lucky mode, I was thinking of taking it back out since it's basically SAM's original behavior once button detection is fixed. If you start playing a game and menuonly="Yes" it will not continue cycling. So just clicking on Start SAM should yield the same results... Happy to create an ini variable for the roulette timer, that's easy to do.

felleg commented 2 years ago

Looking forward to it! Thanks a ton :)

mrchrisster commented 2 years ago

Hey Felix, roulette mode should be working now. Initially you wrote

while I believe the script normally should detect inputs and stop the internal counter to allow players to pick up and play a game, it seems the game changes for us when the counter reaches 0 even after we start playing it.

Can you update main branch and see if this works correctly now for you? We've been busy working on button detection for both keyboard and gamepads and hopefully SAM detects your controllers now.

felleg commented 2 years ago

It looks like it's working great for controller detection on the main branch!

I noticed you added this line in the config, but I haven't figured out how to customize the roulette timers ("Play a random game for X minutes").

# SAM game roulette is a mode available in the menu, where you only have a certain amount of time to play a game, before SAM shuffles to the next game.
# SAM will ignore any button inputs and shuffle to a new game after the set timer expires.
# While SAM is primarily meant as a way to enjoy the pixel art of random games, roulette mode let's you play those games while continuing to shuffle.
roulettetimer="500"
mrchrisster commented 2 years ago
Screenshot_16

Should be bottom entry in the game roulette menu

felleg commented 2 years ago

Ah! I see it now, looks like it works great.

What happened to lucky mode, though? Was it moved elsewhere?

mrchrisster commented 2 years ago

Lucky mode is basically the way SAM works (if button detection works correctly), so there was no need for it

felleg commented 2 years ago

Right, brilliant!

My usecase is perfectly handled now. I could nitpick and say "I wish I could launch roulette with a specific core", but that wasn't my original idea. Closing this issue, thanks a bunch! :)

mrchrisster commented 2 years ago

welcome :)