Skip to content

add ebiten game #317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ebiten-game/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## game/gopher.png

```
The Go gopher was designed by Renee French. (http://reneefrench.blogspot.com/)
The design is licensed under the Creative Commons 4.0 Attributions license.
Read this article for more details: https://blog.golang.org/gopher
```
19 changes: 19 additions & 0 deletions ebiten-game/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Ebitengine Game!

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!

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

Requires the signaling server to be running. To do go, just go inside the folder /signaling-server and do ``go run .``

you can then run the game by going in /game and doing either

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

(see [this tutorial for more information on how to build for WebAssembly](https://ebitengine.org/en/documents/webassembly.html))

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

To play: Just move around with the arrow keys once you have connected!

Right now this only supports two clients in the same lobby
27 changes: 27 additions & 0 deletions ebiten-game/game/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# SPDX-FileCopyrightText: 2025 The Pion community <https://pion.ly>
# SPDX-License-Identifier: MIT

# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
*.wasm

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
go.work
go.work.sum
wasm_exec.js
Binary file added ebiten-game/game/gopher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions ebiten-game/game/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!--
SPDX-FileCopyrightText: 2025 The Pion community <https://pion.ly>
SPDX-License-Identifier: MIT
-->

<!DOCTYPE html>
<script src="wasm_exec.js"></script>
<script>
// Polyfill
if (!WebAssembly.instantiateStreaming) {
WebAssembly.instantiateStreaming = async (resp, importObject) => {
const source = await (await resp).arrayBuffer();
return await WebAssembly.instantiate(source, importObject);
};
}

const go = new Go();
WebAssembly.instantiateStreaming(fetch("gopher-combat.wasm"), go.importObject).then(result => {
go.run(result.instance);
});
</script>
Loading
Loading