pumpitupdev / pumptools

A collection of tools to run Pump It Up games.
The Unlicense
22 stars 7 forks source link

Severe game lag with PIUIO input #14

Open voidderef opened 3 years ago

voidderef commented 3 years ago

In GitLab by @SheepyChris on Jun 20, 2020, 03:13

Summary

This issue is related with MK3 games. When the ptapi-io-piuio-real.so input hook is utilized, the game will frequently have slowdowns, resulting in many missed arrows and poor accuracy.

Expected behavior

The game is expected to run smoothly and synced with the song.

Current behavior

The game has issues maintaining sync and persistent performance.

Detailed Description

In menus, song selection will be slowed down but nothing major happens. In game, the entire engine and chart will slowdown while the audio continues to be played at a consistent speed rate. At times, the chart will attempt to sync again with the audio, which can possibly skip many arrows and result in quick game over screens.

Steps to reproduce

  1. Configure pumptools to utilize ptapi-io-piuio-real.so
  2. Boot any MK3 game (possibly besides Extra? I haven't noticed slowdown while playing it during a short session, will require more testing)
  3. Attempt to play any song or chart.

Further things tested

Possible solution

Allowing the game to run for a while will help alleviate the issue but it will persist at random times.

Context (Environment)

Pumptools version(s) affected

Game(s) and version(s) affected

Log output

Cannot retrieve any logs.

Configuration files

Same configuration file supplied with PumpOS commit e986c61a (conf/pumptools-cabinet.conf).

Command line arguments

./run.sh

APIs used

OS version

Ubuntu 18.04, latest Linux LTS kernel 4.15.0-??? (cannot retrieve more information).

Hardware specs

voidderef commented 3 years ago

In GitLab by @Thalesalex on Jun 20, 2020, 05:46

I also had this issue when testing with an Arduino PIO I/O clone, metioned this on sows before this repository was opened, but when USB support was added, since I use a DIY Home Pad, it has a normal pc joypad board, I ended up forgetting about this, partially because I thought that the issue was happening because I was not using real hardware, but @SheepyChris is.... here's my original sows post:




So, today I finally got some time to test this with my homepad with an arduino-based PIU I/O clone.

And sadly the games are basically unplayable when I boot them with my piu i/o clone, they basically go 30fps and offsyncs badly. older engines (e.g 3rd OBG) keeps the arrows scrolling slower than normal to the point that there's no music playing and the chart keeps going ( https://www.youtube.com/watch?v=RS6Pmf_xt5k ) and newer engines (e.g. Premiere 2) tries hard to be in sync, causing the chart to "jump arround" making it really unplayable. (https://www.youtube.com/watch?v=7QZKCQjIoeY I disconect my board at around 0:15)

As soon as I unplug my "PIU I/O" the game returns to normal 60fps

I'm using Ubuntu 18.04 LTS and i'm not really sure if pumptools just doesn't like that my PIU I/O is not a real legit Andamiro board or I have a lib problem (tried both local and ld methods and both cause the same issue. And I'm able to use this Arduino with a Prime image with no issues.)

I get some errors showing on pumptools.log: (theses erros are repeated many times)

[W][2020/1/10-15:41:37:391][capnhook][result.c:88] Unhandled errno to general error convert might cause bugs, errno: 32
[W][2020/1/10-15:41:37:391][capnhook][result.c:47] Unhandled other error 6 to errno convert might cause bugs
[W][2020/1/10-15:41:37:391][capnhook][result.c:88] Unhandled errno to general error convert might cause bugs, errno: -5
[W][2020/1/10-15:41:37:568][capnhook][result.c:47] Unhandled other error 6 to errno convert might cause bugs
[W][2020/1/10-15:41:37:581][capnhook][result.c:88] Unhandled errno to general error convert might cause bugs, errno: -19

with patch.hook_mon.usb=1 I get a HUGE file with these:

[M][2020/1/10-15:48:16:577][cnh-usbhook-mon][usbhook-mon.c:44] [after][ctrl_msg] result 0, next_handler -1, find_busses_res_num_busses 0, find_devices_res_num_devices 0, open_usb_dev (nil), handle 0xaf8efa0, set_altinterface 0, set_configuration 0, claim_interface 0, ctrl_req_type 192, ctrl_req 174, ctrl_value 0, ctrl_index 0, ctrl_buffer(bytes 0x9266614, nbytes 8, pos 8), ctrl_timeout 10000
[M][2020/1/10-15:48:16:584][cnh-usbhook-mon][usbhook-mon.c:24] [before][ctrl_msg] next_handler 1, find_busses_res_num_busses 0, find_devices_res_num_devices 0, open_usb_dev (nil), handle 0xaf8efa0, set_altinterface 0, set_configuration 0, claim_interface 0, ctrl_req_type 64, ctrl_req 174, ctrl_value 0, ctrl_index 0, ctrl_buffer(bytes 0x926660c, nbytes 8, pos 0), ctrl_timeout 10000

Thanks in advance and sorry for the long post.

EDIT: having now tested all games, oddly enough, Extra is the only game I had no sync issues with my PIU I/O https://www.youtube.com/watch?v=REWEQqGGWWQ

voidderef commented 3 years ago

In GitLab by @icex2 on Jun 20, 2020, 13:15

Thanks for the detailed reports about quite a bad issue.

First of, there are two things that I would like to clearly define to avoid confusion, especially with the MK3 Linux ports:

  1. Sync issues: The MK3 Linux ports are ported from DOS executables that were developed for only for one dedicated set of hardware (with some exceptions, e.g. Prex 3). The devs had to make use of hardware features to sync up the songs with the stepcharts which is rather tricky compared to just doing that in software with todays technology. Therefore, you might be experiencing "sync issues" i.e. audio does not sync up 100% with the stepchart. There are various options that let you tweak this, see the mk3hook.md readme file included in the distribution package.
  2. IO issues/delay: Anything related to inputs arriving late or outputs written to late or dropping of either of them. Playing the game feels weird because of inaccuracy or unresponsiveness.

Second, everything I have developed was only tested with an original MK6 PIUIO. If you have different revisions or clones, please make sure to point that out before describing me any issues. Otherwise, we might be chasing an issue that is not related to the existing code in pumptools but rather incompatibility with different hardware.

Now, back to topic: @SheepyChris

top is a tool that can help you there.

What you report is news to me and I haven't experienced any issues neither on my development setup nor my cabinet.

@Thalesalex I don't know if your issue related to the PIUIO clone is the same as what @SheepyChris describes here. However, feel free to open another issue regarding that so we don't derail the discussion too much here.

voidderef commented 3 years ago

In GitLab by @SheepyChris on Jun 30, 2020, 16:37

Hello,

I'm sorry for being late, I've been in the process of moving to another country and that has kept me very busy for the time being.

I have some recorded gameplay here that demonstrates the issue. The first video is the most severe one and the others are less severe: https://www.youtube.com/watch?v=OfaAxiR1R7w https://www.youtube.com/watch?v=Aics7HBo8Bc https://www.youtube.com/watch?v=6od5ePKKyG4

PumpOS was being utilized (commit e986c61a) with all of those videos. Unfortunately, I do not have access to the machine anymore due to what I've mentioned above, but from what I could tell from the slow spinning cooler there was no heavy load to the CPU. The machine had 4GB of RAM, so I do not believe that it was fully utilized for the operating system to switch to a swap partition.

I've tested the same hard drive/image on my Dell Latitude E5470 with a keyboard configuration, all games ran perfectly fine without stutters, which led me to believe the PIUIO hook could be to blame.

In addendum, the same hook does not seem to properly detect all pad sensors only with Extra - all panels were not registering their left sensor and both center panels were additionally not registering their up sensors.

Thank you for taking your time to look into these issues.

voidderef commented 3 years ago

In GitLab by @icex2 on Jul 1, 2020, 20:23

I just tested this on my machine and everything was fine. However, I noticed severe lag on my workstation. Since the syncing of the stepchart to the audio happens using the current position in the audio stream, there might be issues with different audio hardware. What kind of audio output are you using? Are you using the on-board audio chipset or some external, e.g. USB, sound card?

Also, once you have the chance for it, can you try running the game with lib-ld instead of lib-local on your machine?