Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

A Short Hike

a little exploration game about hiking up a mountain · By adamgryu

How do I switch to the Metal rendering API

A topic by soooch created Jun 09, 2020 Views: 912 Replies: 8
Viewing posts 1 to 4

I was wondering if anyone knew how to switch to the Metal renderer on Mac. OpenGL works, but I'd really appreciate any extra battery life that Metal could provide.

Developer(+1)

Hey, unfortunately, there's no way to do this in game. You'll need to launch the game with a command line argument:
-force-metal

(3 edits)

So in the terminal at this directory, "/Applications/AShortHike.app/Contents/MacOS", using the command "./AShortHike -force-metal" should do the trick?

Is there anyway to check in game what rendering engine is currently running? Also is it definitely "-force-metal" and not "-force-gfx-metal" or "--force-metal"?

Thanks!

Edit: nm, it seems to be working.

(2 edits)

So I appear to have it working. I get about 30% better performance with Metal vs default OpenGL. The performance difference is actually more complicated than this. See the chart in my below post.

If anyone else is trying to do this, paste this:

do shell script "open -a '/Applications/AShortHike.app' --args -force-metal"

into the Script Editor and save it as an application. 

Developer(+1)

Glad to hear it's working! Thanks for sharing. Just out of curiosity, what is the FPS difference between the builds?

(7 edits)
Resolution: 2560x1600 |  GPU: Iris Plus 655 | Settings: MaxedOpenGL (fps)Metal (fps)
On Fishing Ship + No Pixelation + vsync~35~52
On Fishing Ship + No Pixelation +  no vsync~50~52*
On Fishing Ship + Default Pixelation + no vsync~180~100*
Clump of Trees near Debt Guy + No Pixelation + vsync40-49~53
Clump of Trees near Debt Guy + No Pixelation + no vsync50~54*
Clump of Trees near Debt Guy + Default Pixelation + no vsync~130~120

*There was some really weird judder for these Metal results, it felt like it was running slower than real time

Really weird results actually. I only did the first test earlier, which lead me to believe Metal was strictly superior, however OpenGL performs pretty well in some situations, which is odd given how poorly supported it is on macOS. In particular, without vsync on, the Metal implementation was practically unplayable. Additionally, OpenGL seemed to benefit significantly more from pixelation.

Also, after doing some testing with the Intel Power Gadget, there is no appreciable difference in power consumption for the two runtimes. One actual difference is the color management (or lack thereof in OpenGL's case). The Metal version of the game targets sRGB, but the OpenGL version just outputs to the Mac's native gamut.

OpenGL outputs to the native gamut

OpenGL outputs to native gamut


Metal outputs to sRGB

Metal outputs to sRGB

These images may appear the same if viewed on a noncolormanaged OS or on a sRGB monitor. Basically the OpenGL version is much more saturated than the Metal version, and perhaps not the best representation of your artistic intent?

I've updated the results after the recent update, and the numbers are now very different. Metal now performs significantly better*, with up to 30% higher framerates. Additionally, the Metal version no longer had judder issues at 60fps, though it did have some issues at 30fps.

Unfortunately, OpenGL seems to have regressed. Framerates slightly below 60 are completely unplayable. If the framerate is at 58, for example, it's necessary to lock fps to 30 for the game to stay responsive.

*Sometimes the Metal version gets stuck in a weird state where it can't get above 80fps. This can be solved by going into the settings and toggling between different pixelation options.

Resolution: 2560x1600 |  GPU: Iris Plus 655 | Settings: PerfectOpenGL (fps)Metal (fps)
On Fishing Ship + No Pixelation + vsync~5760
On Fishing Ship + No Pixelation +  no vsync57~65
On Fishing Ship + Default Pixelation + no vsync~230~300
Clump of Trees near Debt Guy + No Pixelation + vsync~5760
Clump of Trees near Debt Guy + No Pixelation + no vsync57~60
Clump of Trees near Debt Guy + Default Pixelation + no vsync
~200~250
Developer(+1)

Wow, thanks for these detailed stats! Very interesting - sorry the game doesn't perform well at no pixelation for you. I also wasn't aware o the sRGB difference. Thanks for sharing this info! 

Well I played with pixelation on for the most part anyways. I just thought it would be an interesting data point. ~50 fps on a laptop iGPU isn’t even that bad a result.

The most annoying part was just the weird judder the Metal version had without vsync enabled, but I played with vsync on, so it didn’t effect me.

Anyways, thank you for the amazing game!