From 5520fb3711bbf8269ba1a6dac73b13bece16d227 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Thu, 16 Jan 2025 13:17:38 +0900 Subject: [PATCH] contents/en/blog/steam: add a workaround for Steam Windows Updates hajimehoshi/ebiten#3181 --- contents/en/blog/steam.html | 11 ++++++----- contents/ja/blog/steam.html | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/contents/en/blog/steam.html b/contents/en/blog/steam.html index 081d604..cbf09e1 100644 --- a/contents/en/blog/steam.html +++ b/contents/en/blog/steam.html @@ -31,15 +31,16 @@

Steamworks SDK

This binding doesn't implement most of the APIs. I plan to implement them in the future.

Windows

Windows is the easiest, and what you have to do is to build your game by Go in the regular way. On Windows, Ebiten is in pure Go, then you can build it anywhere by specifying GOOS and GOARCH.

+

EDIT (2025-01-16): An issue has been reported where Go applications may freeze when running in a Windows Steam environment (#3181, golang/go#71242). As a workaround, specify -ldflags="-X=runtime.godebugDefault=asyncpreemptoff=1" when executing go build.

On PowerShell, the commands are like this.

$Env:GOARCH = '386'
-    go build -o yourgame_windows_386.exe .
-    $Env:GOARCH = 'amd64'
-    go build -o yourgame_windows_amd64.exe .
-    Remove-Item Env:GOARCH
+go build -o yourgame_windows_386.exe . +$Env:GOARCH = 'amd64' +go build -o yourgame_windows_amd64.exe . +Remove-Item Env:GOARCH

On a POSIX shell, the commands are like this.

env GOOS=windows GOARCH=386 go build -o yourgame_windows_386.exe .
-    env GOOS=windows GOARCH=amd64 go build -o yourgame_windows_amd64.exe .
+env GOOS=windows GOARCH=amd64 go build -o yourgame_windows_amd64.exe .

When buliding a GUI application for Windows, you can specify -ldflags=-H=windowsgui to vanish the console. As Ebiten closes it automatically anyway, it is also fine not to specify this.

An icon is not necessary. If you care, please use a tool to embed resources as appropriate.

Then, compress the exe files as zips, and upload them as builds at Steamworks.

diff --git a/contents/ja/blog/steam.html b/contents/ja/blog/steam.html index 15e7c25..9f04b93 100644 --- a/contents/ja/blog/steam.html +++ b/contents/ja/blog/steam.html @@ -31,6 +31,7 @@

Steamworks SDK

なおこのバインディングはまだ API をほとんど実装していません。今後対応予定です。

Windows

Windows は最も簡単で、普通に Go でビルドするだけです。 Ebiten は Windows においては Pure Go なので、 GOOSGOARCH を指定すればどこでもビルドできます。

+

EDIT (2025-01-16): Go アプリケーションを Windows Steam 環境で動かすときに、フリーズすることがある問題が報告されています (#3181golang/go#71242)。ワークアラウンドとして、 go build を実行する際に -ldflags="-X=runtime.godebugDefault=asyncpreemptoff=1" を指定してください。

PowerShell でビルドする場合は次のようになります。

$Env:GOARCH = '386'
 go build -o yourgame_windows_386.exe .
@@ -39,7 +40,7 @@ 

Windows

Remove-Item Env:GOARCH

POSIX シェルでビルドする場合は次のようになります。

env GOOS=windows GOARCH=386 go build -o yourgame_windows_386.exe .
-    env GOOS=windows GOARCH=amd64 go build -o yourgame_windows_amd64.exe .
+env GOOS=windows GOARCH=amd64 go build -o yourgame_windows_amd64.exe .

Windows 向け GUI アプリをビルドする際には -ldflags=-H=windowsgui をつけると、最初のコンソールの表示がなくなります。 Ebiten の場合はコンソールを自動で閉じるので、つけなくても問題はありません。

アイコンは必須ではありません。気になる方はリソースを埋め込むツールを適宜使ってください。

こうして出来上がった exe ファイルを zip で固めて、 Steamworks にビルドとしてアップロードしてください。