adangert / JoustMania

Raspberry Pi Jousting at its finest
http://joustmania.com
Other
124 stars 33 forks source link

Trying to start a game with controller charging throws error #314

Closed mchirlin closed 6 months ago

mchirlin commented 8 months ago

Below is the error. Seems to be due to self.out_moves not being aligned with self.moves. Following line errors:

game_moves = [move.get_serial() for move in self.moves if self.out_moves[move.get_serial()] == Alive.on.value and (self.move_opts[move.get_serial()])[Opts.random_start.value] == Alive.off.value ]

Traceback (most recent call last): File "/home/pi/JoustMania/piparty.py", line 1086, in InitAudio() File "/home/pi/JoustMania/piparty.py", line 662, in game_loop self.check_start_game() File "/home/pi/JoustMania/piparty.py", line 917, in check_start_game self.start_game(random_mode=True) File "/home/pi/JoustMania/piparty.py", line 962, in start_game

start with only controllers that have pushed trigger

File "/home/pi/JoustMania/piparty.py", line 962, in

start with only controllers that have pushed trigger

KeyError: 'a0:ab:51:35:da:42'

adangert commented 8 months ago

Thanks for this! I'll test and fix this soon!

mchirlin commented 8 months ago

I am making updates on my fork, how best do you like to collaborate on things like this? The updates I am making initially are:

adangert commented 8 months ago

Hey! Thanks for helping out! You can make a pull request and I'll test it before merging.

mchirlin commented 8 months ago

I have really hefty update I've been making over the last 2 weeks to refactor all of the games to reuse code and just generally make everything more consistent, e.g. move to enums instead of magic numbers. I still have a couple games left to do (Tournament and Ninja Bomb)

I'll create a PR so you can take a look. Let me know your thoughts.

adangert commented 8 months ago

That sounds great! I'll take a look at it an let you know!

adangert commented 7 months ago

hi @mchirlin I finished fixing a few of the bugs for Joustmania (PS3 controller pairing/pi 5 issues), and have started to look at the work you've done! I've been trying to reproduce the same issue not being able to start the game with a controller plugged in on the master branch. Currently I've tried plugging in one directly to the pi, that controller light goes out, then pressed the trigger button on all of the rest of the remaining controllers, the game (FFA) seems to start, and it prints out in the console:

we are removing controller: 00:06:f7:8f:fa:3c we are removing controller: 00:06:f7:8f:fa:3c

which seems to be the Mac address of the controller plugged in, and the game seems to start without issues, I can't seem to trigger the same issue on my end, I've tried with both PS3/PS4 controllers, one and two plugged in and charging. Is there a specific way that you plugged in a controller (to the pi itself/a different charging solution), or something else I might have missed, perhaps in the solution you worked on?

Just curious and trying to understand the root cause of the issue. Thanks for putting in the time for this!

mchirlin commented 7 months ago

There were a couple of issues that I resolved. All are referenced with FIX in a comment. It was a bit ago, but what I remember was:

  1. if all moves were charging and you tried to start a game it would just say over and over, Not enough moves.
  2. Sometimes moves were both alive and charging at the same time and which threw errors when starting a game, don't remember what I did exactly to make it happen, but I have seem them connect by both usb and bluetooth simultaneously.

On Mon, Mar 4, 2024 at 12:39 AM Aaron Angert @.***> wrote:

hi @mchirlin https://github.com/mchirlin I finished fixing a few of the bugs for Joustmania (PS3 controller pairing/pi 5 issues), and have started to look at the work you've done! I've been trying to reproduce the same issue not being able to start the game with a controller plugged in on the master branch. Currently I've tried plugging in one directly to the pi, that controller light goes out, then pressed the trigger button on all of the rest of the remaining controllers, the game (FFA) seems to start, and it prints out in the console:

we are removing controller: 00:06:f7:8f:fa:3c we are removing controller: 00:06:f7:8f:fa:3c

which seems to be the Mac address of the controller plugged in, and the game seems to start without issues, I can't seem to trigger the same issue on my end. Is there a specific way that you plugged in a controller (to the pi itself/a different charging solution), or something else I might have missed?

Just curious and trying to understand the root cause of the issue. Thanks for putting in the time for this!

— Reply to this email directly, view it on GitHub https://github.com/adangert/JoustMania/issues/314#issuecomment-1975770111, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOKVJJNGKVK3GJZRXQITI3YWQCI3AVCNFSM6AAAAABCJ3YMUWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZVG43TAMJRGE . You are receiving this because you were mentioned.Message ID: @.***>

-- Michael Chirlin, Appian Senior Architect Appian Corporation | Level 9, 7950 Jones Branch Dr, McLean, VA 22102 240 888 3845 | @.*** | https://twitter.com/appianenabled |

-- https://www.appianworld.com/

-- This message and any attachments are solely for the intended recipient. If you are not the intended recipient, disclosure, copying, use, or distribution of the information included in this message is prohibited -- please immediately and permanently delete this message.

adangert commented 6 months ago

yeah I seem to have been able to replicate the issue, Without syncing a controller to joustmania and plugging it in via USB (so that it shouldn't be apart of the game) Then trying to start a game, triggers the error. I think there was some problem that when a controller was plugged in, it recognised it in some way as apart of Joust. Also verified this was fixed in the PR! I'm checking out the rest of the code now

adangert commented 6 months ago

Fixed from https://github.com/adangert/JoustMania/pull/317