PSA: Steam version of Wesnoth slow on Apple Silicon (fix included)

General feedback and discussion of the game.

Moderator: Forum Moderators

Post Reply
User avatar
Iris
Site Administrator
Posts: 6798
Joined: November 14th, 2006, 5:54 pm
Location: Chile
Contact:

PSA: Steam version of Wesnoth slow on Apple Silicon (fix included)

Post by Iris »

Although I'm a very new Mac user, I feel like this is an issue that's not been talked about much in the past 2 years of Apple Silicon-based Macs.

The Problem

The official Steam client released by Valve is an Intel (x86_64) app even on Apple Silicon (arm64), and as a result it's very slow and has some interesting quirks including the built-in web browser not displaying pages until you resize the window. But otherwise it generally does its job. The problem is that as an Intel app, any processes launched by it by default will be launched as Intel apps too even if they are universal (Intel + Apple Silicon support) binaries.

Wesnoth being a very CPU-bound game in versions 1.16.x and earlier, suffers MASSIVELY from this. On my 2021 M1 Pro Macbook, this means that even in the menus, Wesnoth exhibits very low framerates that don't really make the best impression on new players in particular. All this is caused, of course, by the Rosetta translation layer being far from perfect when dealing with heavily CPU-bound tasks like Wesnoth's dated rendering engine. After all, having ahead-of-time translation doesn't necessary mean speedy or slim code being emitted.

The Solution

This issue naturally does not happen if you launch the Wesnoth app directly using Finder from its Steam folder, or if you run the App Store or SourceForge versions of Wesnoth. In these cases, the native version of Wesnoth is launched instead of the Intel version, so no suboptimal CPU translation gets involved. Native Wesnoth whilst still a very CPU-hungry app, is very performant.

However, there is a way you can make Intel-based apps like Steam launch an app like Wesnoth in the native Apple Silicon arch. For the time being, this requires a small amount of player intervention, but it works with any version of Wesnoth that ships as a universal binary on Steam (1.15.x and 1.16.x and 1.17.x and later).

1. Right-click on Wesnoth in your Steam library, and choose Properties.
Screenshot 2023-01-11 at 23.57.32.png
2. On the General page, click on the text box under Launch Options and enter the following as is, no substitutions (the %COMMAND% part is understood and substituted by Steam on launch).

Code: Select all

/usr/bin/arch -64 %COMMAND%
3. Close the Properties dialog.

4. Launch Wesnoth and click on the "i" icon in the bottom left of the main menu to confirm that the game is now launched as a native app.
Screenshot 2023-01-11 at 23.59.50.png
5. Enjoy your relatively lag-free (but still CPU-hungry) Wesnoth on Steam, including the ability to track your game time if you like that for some reason.


-


Of course a much superior idea going forward would be to have the Steam version of Wesnoth itself sort this out automatically, either through a wrapper script that selects the right architecture (a solution apparently adopted by OBS before) or by relaunching itself with the right process flags if it finds out it's an Intel process on an Apple Silicon host. But that requires developer intervention which is a little more involved.

Finally, it's worth noting that Wesnoth 1.17.x doesn't suffer nearly as much of a performance hit as 1.16.x when run through Rosetta because it leverages the GPU for some rendering tasks, so it's less reliant on potentially badly optimised CPU code.
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm.
shevegen
Posts: 497
Joined: June 3rd, 2004, 4:35 pm

Re: PSA: Steam version of Wesnoth slow on Apple Silicon (fix included)

Post by shevegen »

> Enjoy your relatively lag-free (but still CPU-hungry) Wesnoth on Steam,

For me the biggest hurdle is usually trying to see which boost version is compatible with wesnoth.

However had, that aside, I also wondered whether we could have a super-lightweight engine for
wesnoth, for devices that are constrained (old computers, smartphones ...) so perhaps steam
engine could be treated like that as well. I think there were implementation examples of a
web-variant for wesnoth in the past.

It's risky to rewrite projects/games, so one would have to plan with failure points possible in
mind. For instance, unknown horizons went with godot but 3 years later they still have not
progressed that much compared to the older engine (FIFE, which was unfortunately abandoned
so they had little choice in NOT jumping ship):

https://unknown-horizons.org/blog/

> Finally, it's worth noting that Wesnoth 1.17.x doesn't suffer nearly as much of a performance hit as 1.16.x

I have not tested it yet. Mostly I prefer stable these days. I had problems with unstable some years
ago in regards to campaign add ons, and since campaigns are the primary reason for me to
play wesnoth, it's the key factor for using a specific wesnoth version. I'd wish changing versions
would be easier though. Kind of like a Universal Wesnoth Game Engine where we could play
any version!
User avatar
Iris
Site Administrator
Posts: 6798
Joined: November 14th, 2006, 5:54 pm
Location: Chile
Contact:

Re: PSA: Steam version of Wesnoth slow on Apple Silicon (fix included)

Post by Iris »

This thread is very specifically about a concrete platform-specific issue with the official Steam builds for macOS on Apple Silicon involving not how Wesnoth is built but rather how it's launched, while it sounds like you are building from source (on a completely different platform probably) and also talking about hypotheticals. Feel free to make a separate thread about your concerns.
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm.
Post Reply