gotzl / hid-fanatecff-tools

Tools to talk to the FANATEC CSL Elite Wheel Base driver
GNU General Public License v2.0
23 stars 7 forks source link

Server starts lagging or shows nonsense on the display/led in rf2 #3

Closed SynthetikzZ closed 12 months ago

SynthetikzZ commented 1 year ago

i would love to know what python version was used for programming the server because i have big issues with it in rf2 and want to try a different python version.

for me i hop ingame and start the server and works most of the time but after a session switch in rf2 or i reload the game entirely the wheel starts to display only nonsense, sometimes like its lagging behind, sometimes acting really weird.

to fix this i always have to power off the wheelbase, rf2 and the server and powering/starting everything again.

anyone encountered similar behaviour ?

gotzl commented 1 year ago

Hey, first thing that comes to my mind is that there might be too much USB traffic. Can you check dmesg for suspicious messages? Maybe just run journalctl -kf in a terminal and check if s.t. pops up...

SynthetikzZ commented 1 year ago

FML found the issue. my dumbass made fish to the default shell systemwide. reverted back to bash and issue is gone.

thank you for your effort <3 without your driver i still would need windows.

gotzl commented 1 year ago

Interesting .. but why is this issue triggered by using fish?

SynthetikzZ commented 1 year ago

fish diverts a little bit from bash and defaulting to it can do alot of weird shit. i just defaulted back to bash and setup terminal to use fish. everything works now i stress tested it and issue is gone completly.

gotzl commented 1 year ago

Hmm.. weird ;) And if you go back to fish, the issue appear again?

SynthetikzZ commented 1 year ago

ok did further testing and issue has nothing to do with the shell..

it doesnt happen in singleplayer for me.

it freaks out in online immediatly.

tinypedal still works online so it cant be the shared memory plugin

gotzl commented 1 year ago

That might be a hint. Looking at https://github.com/gotzl/hid-fanatecff-tools/blob/7f9ab82a5e46a60811a9917765ec5d3cdbf0ecbd/tools/rf2.py#L18C46-L18C46 I always take vehicle index 0. Maybe in multiplayer, the index of your car isn't 0 but s.t. else?

SynthetikzZ commented 1 year ago

so i looked at the code of tinypedal how its fetching the api data and what i could find is this

def setup(self):
    """Setup & apply API changes"""
    access_mode = cfg.shared_memory_api["access_mode"]
    process_id = cfg.shared_memory_api["process_id"]
    player_override = cfg.shared_memory_api["enable_player_index_override"]
    player_index = cfg.shared_memory_api["player_index"]
    self._api.setup(
        access_mode,
        process_id,
        player_override,
        player_index
    )

im not a programmer at any means ( only some arduino stuff) but i can imagine that vehicle 0 is safety car or something

i try to modify the rf2.py maybe i get it working with my non existent programming skills :D

gotzl commented 1 year ago

Hmm.. just had a look into how tinypedal handles this. I think I would do it a bit differently, just to keep it more lightweight. I would iterate over the scoring data and check the mIsPlayer field to get the correct index. Maybe I've time to hack s.t. together later..

gotzl commented 1 year ago

Hi, I've just push the rf2_mp_fix branch with an attempt to fix the player index lookup. Do you think you can test this? Also, small disclaimer, I did not test this in any ways ... I don't have the game atm.. So, chances are high that it doesn't work ;)

SynthetikzZ commented 1 year ago

i get this error

Exception in thread Thread-4: Traceback (most recent call last): File "/usr/lib/python3.11/threading.py", line 1045, in _bootstrap_inner self.run() File "/home/synthetikz/Schreibtisch/msc/hid-fanatecff-tools/tools/fanatec_led_server.py", line 86, in run self.prerun() File "/home/synthetikz/Schreibtisch/msc/hid-fanatecff-tools/tools/rf2.py", line 30, in prerun self.telemetry = sim_info.Rf2Tele.mVehicles[self._player_index]


TypeError: indices must be integers
Thread '<RF2Client(Thread-4, stopped 140718336939712)>' stopped.
SynthetikzZ commented 1 year ago

can i contribute to you with a rf2 key?

gotzl commented 1 year ago

That's kind, but I do own the game. I just don't have it installed. I'll do that tomorrowish, so that I can reproduce/implement this properly.

In the meantime.. maybe the player idx is only available later.. Can you replace https://github.com/gotzl/hid-fanatecff-tools/blob/2e5133d923a9c17c46a9b9e65d3c214fa6e2931e/tools/rf2.py#L21 with return 0? Then, the behavior should be as before (with the addition that when at some point a vehicle is marked with mIsPlayer, this idx will be used).

SynthetikzZ commented 1 year ago

changing none to 0 did the trick. server works in online sofar. no more glitching around. ill do further testing but seems to work great now

gotzl commented 1 year ago

Ok, great. Yes, please test for a while.. When you're confident it's alright now, I'll merge into master... Ty for testing!

SynthetikzZ commented 1 year ago

definitly works. changing sessions, going from mp to sp, restarting rf2 without restarting server. led server picks up everytime as soon as your car loads into the session. no glitches anymore. thank you for your work.

gotzl commented 12 months ago

Ok, great! I've updated the master branch with the fix, and going to close this.

Out of curiosity, how do you use tinypedal on Linux? I'm just wondering, do you use my patched version of pyRfactor2SharedMemory or do you do s.t. different?

SynthetikzZ commented 12 months ago

tinypedal runs natively on linux using the same mapped shared memory. i just copied the rf2_wrapper.exe and renamed it and both tinypedal and the led server where able to connect.

tinypedal is the only way i could get a radar, as crewchief didnt worked for me because of .net and i dont like audio spotters.

installation is documented on github

gotzl commented 12 months ago

Ah, I see. At least I think so:

The Iron Wolf's rF2 Shared Memory Map Plugin has to be replaced with this fork for Wine.

Didn't know this existed! I think this should make the rf2_wrapper.exe obsolete. And also my fork of pyRfactor2SharedMemory. Interesting ;)

gotzl commented 12 months ago

Just FYI, I just updated master. Now, it uses the same rF2 plugin as TinyPedal and it is not necessary anymore to replace the rF2 exe.

SynthetikzZ commented 11 months ago

great to know!