LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-20-2024, 01:52 PM   #1
guferr
LQ Newbie
 
Registered: Feb 2015
Posts: 6

Rep: Reputation: Disabled
Issues with multiprocessing and audio reproduction with a Linux game


I'm needing a bit of general knowledge in audio and multiprocessing applications in Linux here.

I've got a game made for Arcade use and I'm trying to run the game in my own Linux (Mint 19.3). Its original Linux is Debian 9 with a i686 PAE kernel, but it doesn't work in any of my computers because it lack drivers for them.

Making it run wasn't very difficult, I just had to install the i386 libraries it tried to open (which I verified running it with strace).

The only problem is that while running, the audio a bit choppy, it has a few brief clicks and cuts like a scratched CD playing and skipping.

The application uses libasound2, and communicates directly with the ALSA system, it doesn't need pulseaudio (and I removed it just to make sure it wasn't causing any conflicts, but it didn't make a difference either).

The application is by far very light for my hardware, using only 30% CPU at most (adding all cores together), and 20% GPU, so it didn't make sense it was happening due to anything not being fast enough (which I have experienced before when trying some real-time audio processing plugins for pulseaudio).

I tried a lot of things, like changing the priority of the IRQ thread of tied to my soundcard (IRQ 16), unloading other driver modules tied to the same IRQ (like the wifi driver), and preventing the IRQ thread and game from sharing CPUs (by changing the game affinity to other CPUs).

Nothing helped.

Then I tried to go the other way: Trying to make it worse.

I tried setting the game affinity to the one CPU that was processing the IRQ 16 thread and it solved the issue.

However, it solved not because it was in the same CPU as the IRQ, but because it was in a single CPU. Setting its affinity to a any single CPU solves it. And this same behavior happens when I run the same OS and game in different hardware, with different CPU and GPU brands, it's a constant.

I know its original hardware uses an Intel Celeron L420, it has no multithreading and a single core (which makes me wonder why the game itself supports multiprocessing and runs on my 8 threads evenly).

But it seems like its original Debian 9, which as far as I know supports several cores normally without having anything to restrict it at any point, runs the game smoothly even in some multicore CPUs, because others have done that.

Am I missing anything here?

I've tried literally copying all the original libraries from the original game OS into my OS (forcing it to load them and checking if they were loaded with strace), but that changed nothing.

I'd expect that if this was an issue in the game programming, it should always happen in whatever Linux as long as it runs in several CPUs instead of one.

Any idea of what could be happening here?

Or what else I can look for in order to debug this?

Last edited by guferr; 01-20-2024 at 02:01 PM.
 
Old 01-20-2024, 02:12 PM   #2
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 5,796

Rep: Reputation: 2775Reputation: 2775Reputation: 2775Reputation: 2775Reputation: 2775Reputation: 2775Reputation: 2775Reputation: 2775Reputation: 2775Reputation: 2775Reputation: 2775
There is almost NOTHING that is uniform throughout gaming programming. Just looking at the number of game engines that COULD be used to get a glimmer. Most game development these days starts with a game engine (That may or MAY NOT be available to the public) and then gets "adjustments and modifications" to better support the development of that game project. Sound support and threading support vary greatly, and in multiple ways.

You found a solution for your specific issue for that specific game, and I am VERY glad!
Be aware that the same symptoms may or may not respond to the same solution for a different game.
I might have tried running a real-time kernel, but I suspect your solution is better.
 
Old 01-30-2024, 02:26 PM   #3
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,511

Rep: Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377
If you're needing i386 libraries, we're talking the lase millenium? Name the games, or the better known ones, to be sure. Pcs then had a lot of kinks, and software layers have been written the different way hardware was due to the myopic hardware design.

I'm no gamer, but I did install Space Quest here, and had to install the compatibility layer. It's a pisstake on Star Trek. Forget the name, but I also had to put in two sound packages for midi files. Search the web for running old stuff if it doesn't come up.
 
Old 02-21-2024, 06:48 AM   #4
guferr
LQ Newbie
 
Registered: Feb 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by wpeckham View Post
There is almost NOTHING that is uniform throughout gaming programming. Just looking at the number of game engines that COULD be used to get a glimmer. Most game development these days starts with a game engine (That may or MAY NOT be available to the public) and then gets "adjustments and modifications" to better support the development of that game project. Sound support and threading support vary greatly, and in multiple ways.

You found a solution for your specific issue for that specific game, and I am VERY glad!
Be aware that the same symptoms may or may not respond to the same solution for a different game.
I might have tried running a real-time kernel, but I suspect your solution is better.
Thanks, I'm aware of how specific and particular this solution is.

But rather, I was asking for what else could I try to debug and find a better particular solution for it, just like the idea you have me of using a real-time kernel.

I thought about switching to a low-latency kernel, but the reason I haven't tried it yet was, besides having to recompile DKMS drivers, the fact that its original kernel isn't low-latency to begin with.

That's why I figured this solution was probably not the best one.

But its original kernel is also different in the sense of being a PAE i686 kernel instead of an amd64 kernel. And perhaps it was compiled with different options regarding scheduling that I don't know about.

But I never actually made sure that its original OS can in fact run in a multiprocessor without causing those same issues, perhaps the same will happen and it was never an issue with the OS.
 
Old 02-21-2024, 06:52 AM   #5
guferr
LQ Newbie
 
Registered: Feb 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by business_kid View Post
If you're needing i386 libraries, we're talking the lase millenium? Name the games, or the better known ones, to be sure. Pcs then had a lot of kinks, and software layers have been written the different way hardware was due to the myopic hardware design.

I'm no gamer, but I did install Space Quest here, and had to install the compatibility layer. It's a pisstake on Star Trek. Forget the name, but I also had to put in two sound packages for midi files. Search the web for running old stuff if it doesn't come up.
The game is Pump it Up Prime 2, from 2017. Andamiro isn't exactly known from being very up-to-date in their software.

I'm not sure about their newer two versions, but I'd make a bet that even the 2023 Phoenix relies on i386 libraries.

And one thing I know, their latest, most up-to-date hardware is still single-core single-thread.
 
Old 02-21-2024, 10:16 AM   #6
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,511

Rep: Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377
Quote:
Originally Posted by guferr View Post
The game is Pump it Up Prime 2, from 2017. Andamiro isn't exactly known from being very up-to-date in their software.

I'm not sure about their newer two versions, but I'd make a bet that even the 2023 Phoenix relies on i386 libraries.

And one thing I know, their latest, most up-to-date hardware is still single-core single-thread.
This sounded very confusing. So I looked it up. It's an ARCADE GAME to run on old arcade game machines, not modern PCs. They are for amusement arcades - beside one armed bandits and bumper cars. I don't have specs from those arcade machines but wikipedia has an article on PIU Prime. I reckon they are ≅1990 designed arcade machines. Between 1985 & 1994, we had '386, '486, & pentium. Arcade machines apparently ran on 480p, = 640x480 which was where things were at in vga video back then.

Some of those arcade machines evidently forgot to die, apparently. Maybe they have zombie or museum piece status? But sure, you can turn your modern pc into a zombie antique arcade machine. There will be some loss of quality and function as layers of emulation will be necessary. But there's plenty of enthusiasts online, so web searching should be fruitful. I'm not one of the enthusiasts, I hasten to add.

EDIT: These things actually might actually predate linux so dosbox might be the way to go.

Last edited by business_kid; 02-21-2024 at 10:27 AM.
 
Old 02-21-2024, 10:53 AM   #7
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 5,796

Rep: Reputation: 2775Reputation: 2775Reputation: 2775Reputation: 2775Reputation: 2775Reputation: 2775Reputation: 2775Reputation: 2775Reputation: 2775Reputation: 2775Reputation: 2775
Quote:
Originally Posted by business_kid View Post
This sounded very confusing. So I looked it up. It's an ARCADE GAME to run on old arcade game machines, not modern PCs. They are for amusement arcades - beside one armed bandits and bumper cars. I don't have specs from those arcade machines but wikipedia has an article on PIU Prime. I reckon they are ≅1990 designed arcade machines. Between 1985 & 1994, we had '386, '486, & pentium. Arcade machines apparently ran on 480p, = 640x480 which was where things were at in vga video back then.

Some of those arcade machines evidently forgot to die, apparently. Maybe they have zombie or museum piece status? But sure, you can turn your modern pc into a zombie antique arcade machine. There will be some loss of quality and function as layers of emulation will be necessary. But there's plenty of enthusiasts online, so web searching should be fruitful. I'm not one of the enthusiasts, I hasten to add.

EDIT: These things actually might actually predate linux so dosbox might be the way to go.
If you like hardware, you could use a SBC and FreeDOS (and i386 or X86_64 SBC will be overkill) to build an arcade machine to emulate the originals. Someone smarter than I might even use a RPi as a core!
 
Old 02-21-2024, 11:58 AM   #8
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,511

Rep: Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377
An RPi is a poor choice imho as it's endianness is wrong. The arcade thing could be 16/32 bit, and the Pi 64bit.

I was a hardware guy, but not any more. There seems to be plenty of old crap owned by users on these forums. But you would have to try a 32bit box, as 64bit interpreting 16bit software I haven't heard of.

We'll see. The OP will probably web search & report back.
 
Old 02-23-2024, 01:15 PM   #9
guferr
LQ Newbie
 
Registered: Feb 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by business_kid View Post
This sounded very confusing. So I looked it up. It's an ARCADE GAME to run on old arcade game machines, not modern PCs. They are for amusement arcades - beside one armed bandits and bumper cars. I don't have specs from those arcade machines but wikipedia has an article on PIU Prime. I reckon they are ≅1990 designed arcade machines. Between 1985 & 1994, we had '386, '486, & pentium. Arcade machines apparently ran on 480p, = 640x480 which was where things were at in vga video back then.

Some of those arcade machines evidently forgot to die, apparently. Maybe they have zombie or museum piece status? But sure, you can turn your modern pc into a zombie antique arcade machine. There will be some loss of quality and function as layers of emulation will be necessary. But there's plenty of enthusiasts online, so web searching should be fruitful. I'm not one of the enthusiasts, I hasten to add.

EDIT: These things actually might actually predate linux so dosbox might be the way to go.
Well, you're clearly not used with their hardware nor software, but I am, and honestly you're only making further confusion with this thread.

Their current hardware is old, but not that old. Mostly 2010 specs, but it's fairly basic. The processor of their latest hardware version (which has been around for over 8 years) is Intel Celeron L420 1.6GHz, a 64-bit processor. They don't use a 64-bit OS because they just don't want to.

Also, their game is 1280x720 in resolution, and its native OS is a Linux. Only their first versions in the early 2000s used DOS, ever since they've used RedHat, Debian and Ubuntu in their versions (and for some reason they develop on Windows, but then port the final version to Linux, go figure).

But absolutely no emulation is necessary, many many people have been running them on newer hardware, with the native OS, but using old video cards, because it only have drivers for really old nvidia cards, despite a wider compatibility with chipset, processors and audio cards.

And I *think* (I didn't confirm though) they didn't have had any audio issues as I'm having, and again, I'm having the same issue across various different hardware I tested, some of which is over 10 yo, and in all of them the solution is forcing single-threading.

So I guess that the issue is that they've never focused in multithreading, but some why they made a game that can run with multithreading, and automatically tries to do so. Probably something related to its engine.

The whole reason why I think there's something I missing is the fact that, supposedly, its native OS can run on multiprocessor CPUs without issues.

Either that or all other people who did this are deaf and didn't hear these annoying pops and clicks.

Last edited by guferr; 02-23-2024 at 01:19 PM.
 
Old 02-24-2024, 11:43 AM   #10
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,511

Rep: Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377
Well, I'm glad you're familiar with the hardware. You posted an issue about a dated arcade machine with no hints as to the spec or even if it was x86 based. I think it's a bit rich to accuse me of causing confusion! You had the information but didn't share it, so I had to guess.
 
Old 02-24-2024, 01:41 PM   #11
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 5,796

Rep: Reputation: 2775Reputation: 2775Reputation: 2775Reputation: 2775Reputation: 2775Reputation: 2775Reputation: 2775Reputation: 2775Reputation: 2775Reputation: 2775Reputation: 2775
RE:
Quote:
The whole reason why I think there's something I missing is the fact that, supposedly, its native OS can run on multiprocessor CPUs without issues.
Dude, MS-DOS or FreeDOS can run on the latest X86_64 multicore multithreaded processor. There are operating systems written entirely in Pascal designed for i386 and up that run fine, one I use (KolibriOS) in Assembler. Almost any OS can run on multiprocessor CPUs without issues. If the OS or application is built for a slower and single threaded single core processor they trick is getting it to SLOW DOWN so it does not trip over its own code!

If it is designed well that is not an issue. For some reason many games do not get that part right.
I see no reason to suspect that as an issue in this case.
 
  


Reply

Tags
alsa, game, latency, libasound, sound


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bad color reproduction with Firefox 75 on Linux Mint 19.3 Cinnamon carlosgmi Linux Mint 2 05-01-2020 12:45 PM
FIVE (5) differences between Asymmetric Multiprocessing and Symmetric Multiprocessing lightlez Linux - Newbie 1 03-05-2015 12:57 AM
linux and DVD reproduction sdistefano Linux - Software 1 05-22-2005 09:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration