Skip to content

Commit

Permalink
contents/en/blog/steam: add a workaround for Steam Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
hajimehoshi committed Jan 16, 2025
1 parent fe573a4 commit 5520fb3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 6 additions & 5 deletions contents/en/blog/steam.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,16 @@ <h2>Steamworks SDK</h2>
<p>This binding doesn't implement most of the APIs. I plan to implement them in the future.</p>
<h2>Windows</h2>
<p>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 <code>GOOS</code> and <code>GOARCH</code>.</p>
<p><em>EDIT (2025-01-16):</em> An issue has been reported where Go applications may freeze when running in a Windows Steam environment (<a href="https://github.com/hajimehoshi/ebiten/issues/3181">#3181</a>, <a href="https://github.com/golang/go/issues/71242">golang/go#71242</a>). As a workaround, specify <code>-ldflags="-X=runtime.godebugDefault=asyncpreemptoff=1"</code> when executing <code>go build</code>.</p>
<p>On PowerShell, the commands are like this.</p>
<pre><code>$Env:GOARCH = '386'
go build -o yourgame_windows_386.exe .
$Env:GOARCH = 'amd64'
go build -o yourgame_windows_amd64.exe .
Remove-Item Env:GOARCH</code></pre>
go build -o yourgame_windows_386.exe .
$Env:GOARCH = 'amd64'
go build -o yourgame_windows_amd64.exe .
Remove-Item Env:GOARCH</code></pre>
<p>On a POSIX shell, the commands are like this.</p>
<pre><code>env GOOS=windows GOARCH=386 go build -o yourgame_windows_386.exe .
env GOOS=windows GOARCH=amd64 go build -o yourgame_windows_amd64.exe .</code></pre>
env GOOS=windows GOARCH=amd64 go build -o yourgame_windows_amd64.exe .</code></pre>
<p>When buliding a GUI application for Windows, you can specify <code>-ldflags=-H=windowsgui</code> to vanish the console. As Ebiten closes it automatically anyway, it is also fine not to specify this.</p>
<p>An icon is not necessary. If you care, please use a tool to embed resources as appropriate.</p>
<p>Then, compress the <code>exe</code> files as zips, and upload them as builds at Steamworks.</p>
Expand Down
3 changes: 2 additions & 1 deletion contents/ja/blog/steam.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ <h2>Steamworks SDK</h2>
<p>なおこのバインディングはまだ API をほとんど実装していません。今後対応予定です。</p>
<h2>Windows</h2>
<p>Windows は最も簡単で、普通に Go でビルドするだけです。 Ebiten は Windows においては Pure Go なので、 <code>GOOS</code><code>GOARCH</code> を指定すればどこでもビルドできます。</p>
<p><em>EDIT (2025-01-16):</em> Go アプリケーションを Windows Steam 環境で動かすときに、フリーズすることがある問題が報告されています (<a href="https://github.com/hajimehoshi/ebiten/issues/3181">#3181</a><a href="https://github.com/golang/go/issues/71242">golang/go#71242</a>)。ワークアラウンドとして、 <code>go build</code> を実行する際に <code>-ldflags="-X=runtime.godebugDefault=asyncpreemptoff=1"</code> を指定してください。</p>
<p>PowerShell でビルドする場合は次のようになります。</p>
<pre><code>$Env:GOARCH = '386'
go build -o yourgame_windows_386.exe .
Expand All @@ -39,7 +40,7 @@ <h2>Windows</h2>
Remove-Item Env:GOARCH</code></pre>
<p>POSIX シェルでビルドする場合は次のようになります。</p>
<pre><code>env GOOS=windows GOARCH=386 go build -o yourgame_windows_386.exe .
env GOOS=windows GOARCH=amd64 go build -o yourgame_windows_amd64.exe .</code></pre>
env GOOS=windows GOARCH=amd64 go build -o yourgame_windows_amd64.exe .</code></pre>
<p>Windows 向け GUI アプリをビルドする際には <code>-ldflags=-H=windowsgui</code> をつけると、最初のコンソールの表示がなくなります。 Ebiten の場合はコンソールを自動で閉じるので、つけなくても問題はありません。</p>
<p>アイコンは必須ではありません。気になる方はリソースを埋め込むツールを適宜使ってください。</p>
<p>こうして出来上がった <code>exe</code> ファイルを zip で固めて、 Steamworks にビルドとしてアップロードしてください。</p>
Expand Down

0 comments on commit 5520fb3

Please sign in to comment.