Skip to content

Commit 87d915d

Browse files
ValorZardJoeTurki
authored andcommitted
Change setup for web (including go version update)
1 parent 5c70059 commit 87d915d

File tree

6 files changed

+16
-4
lines changed

6 files changed

+16
-4
lines changed

.github/.ci.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
PRE_TEST_HOOK=_install_dependencies_hook
55
PRE_LINT_HOOK=_install_dependencies_hook
6-
GO_MOD_VERSION_EXPECTED=1.23
6+
GO_MOD_VERSION_EXPECTED=1.24
77
SKIP_i386_TESTS=true
88
SKIP_API_DIFF=true
99

ebiten-game/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ you can then run the game by going in /game and doing either
1010

1111
``go run .`` for running the game on desktop
1212

13+
or run ``build_wasm.sh`` to build for the web. (Requires Git Bash on Windows)
14+
15+
(To serve the web version of the game, you can run ``python -m http.server`` or some other simple web server inside /game)
16+
1317
(see [this tutorial for more information on how to build for WebAssembly](https://ebitengine.org/en/documents/webassembly.html))
1418

1519
Click "Host Game" to get the lobby id, and then share that with the other clients to get connected

ebiten-game/game/build_wasm.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# SPDX-FileCopyrightText: 2025 The Pion community <https://pion.ly>
2+
# SPDX-License-Identifier: MIT
3+
4+
# we have to do this for Go 1.24 and newer
5+
# see: https://tip.golang.org/doc/go1.24#wasm
6+
cp $(go env GOROOT)/lib/wasm/wasm_exec.js .
7+
8+
env GOOS=js GOARCH=wasm go build -o game.wasm

ebiten-game/game/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
}
1616

1717
const go = new Go();
18-
WebAssembly.instantiateStreaming(fetch("gopher-combat.wasm"), go.importObject).then(result => {
18+
WebAssembly.instantiateStreaming(fetch("game.wasm"), go.importObject).then(result => {
1919
go.run(result.instance);
2020
});
2121
</script>

ebiten-game/game/ui.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func (g *game) logWindow(ctx *debugui.Context) {
5353
ctx.SetTextFieldValue(g.logSubmitBuf)
5454
}
5555
})
56-
ctx.Button("Open").On(func() {
56+
ctx.Button("Host Game").On(func() {
5757
submitOpen()
5858
})
5959
ctx.Button("Join").On(func() {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/pion/example-webrtc-applications/v3
22

3-
go 1.23.0
3+
go 1.24.0
44

55
toolchain go1.25.1
66

0 commit comments

Comments
 (0)