Skip to content

Commit 1ea671a

Browse files
ValorZardJoeTurki
authored andcommitted
Add Ebiten game example
1 parent 8037e4d commit 1ea671a

File tree

12 files changed

+1127
-46
lines changed

12 files changed

+1127
-46
lines changed

ebiten-game/LICENSE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## game/gopher.png
2+
3+
```
4+
The Go gopher was designed by Renee French. (http://reneefrench.blogspot.com/)
5+
The design is licensed under the Creative Commons 4.0 Attributions license.
6+
Read this article for more details: https://blog.golang.org/gopher
7+
```

ebiten-game/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Ebitengine Game!
2+
3+
This is a pretty nifty demo on how to use [ebitengine](https://ebitengine.org/) and [pion](https://github.com/pion/webrtc) to pull off a cross platform game!
4+
5+
You can have a client running on the browser and one running on a desktop and they can talk to each other, provided they are connected to the same signaling server
6+
7+
Requires the signaling server to be running. To do go, just go inside the folder /signaling-server and do ``go run .``
8+
9+
you can then run the game by going in /game and doing either
10+
11+
``go run .`` for running the game on desktop
12+
13+
(see [this tutorial for more information on how to build for WebAssembly](https://ebitengine.org/en/documents/webassembly.html))
14+
15+
Click "Host Game" to get the lobby id, and then share that with the other clients to get connected
16+
17+
To play: Just move around with the arrow keys once you have connected!
18+
19+
Right now this only supports two clients in the same lobby

ebiten-game/game/.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# SPDX-FileCopyrightText: 2025 The Pion community <https://pion.ly>
2+
# SPDX-License-Identifier: MIT
3+
4+
# If you prefer the allow list template instead of the deny list, see community template:
5+
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
6+
#
7+
# Binaries for programs and plugins
8+
*.exe
9+
*.exe~
10+
*.dll
11+
*.so
12+
*.dylib
13+
*.wasm
14+
15+
# Test binary, built with `go test -c`
16+
*.test
17+
18+
# Output of the go coverage tool, specifically when used with LiteIDE
19+
*.out
20+
21+
# Dependency directories (remove the comment below to include it)
22+
# vendor/
23+
24+
# Go workspace file
25+
go.work
26+
go.work.sum
27+
wasm_exec.js

ebiten-game/game/gopher.png

42.7 KB
Loading

ebiten-game/game/index.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!--
2+
SPDX-FileCopyrightText: 2025 The Pion community <https://pion.ly>
3+
SPDX-License-Identifier: MIT
4+
-->
5+
6+
<!DOCTYPE html>
7+
<script src="wasm_exec.js"></script>
8+
<script>
9+
// Polyfill
10+
if (!WebAssembly.instantiateStreaming) {
11+
WebAssembly.instantiateStreaming = async (resp, importObject) => {
12+
const source = await (await resp).arrayBuffer();
13+
return await WebAssembly.instantiate(source, importObject);
14+
};
15+
}
16+
17+
const go = new Go();
18+
WebAssembly.instantiateStreaming(fetch("gopher-combat.wasm"), go.importObject).then(result => {
19+
go.run(result.instance);
20+
});
21+
</script>

0 commit comments

Comments
 (0)