extism / game_box

Jackbox games like platform where each game is a user generated Extism plug-in
https://gamebox.fly.dev/
BSD 3-Clause "New" or "Revised" License
31 stars 1 forks source link

Golang based game using the principle fleshed out in this repo. #118

Open gedw99 opened 1 year ago

gedw99 commented 1 year ago

Hope it’s ok to ask an open ended question here but the Readme did encourage others to explore doing a game in another language.

I guess the API is not worked out but would like sone tips about implementing a game in golang using the architectural concepts in this repo.

I like how simple the API is !

I can do all the rendering using wasm for web.

the backend can also be done in golang using , I assume the golang pdk ?

the transport between the frontend gui and the backend can use web sockets I presume.

so the glue in between with that API is what I am missing. Would it require going through this code based and building a golang equivalent ?

gedw99 commented 1 year ago

I read the blog post and it’s very erlang ish

https://github.com/ergo-services/ergo might be a way to do the game in golang with extism ?

Ergo has the same primitive like genserver , actors, etc

another one is Nola which is virtual actors. Also in golang

https://github.com/richardartoul/nola

nilslice commented 1 year ago

Hey @gedw99 - the team has been traveling and some out on vacation - sorry for the delay! We will get back to you next week with some support here.

bhelx commented 1 year ago

@gedw99 I don't have a high level doc yet, but some pieces exist. I'll try to explain and link to those pieces where i can.

First, a game is just a state machine that takes input events and operates on the state of the machine. It also emits HTML views when the engine asks for it.

Creating a game is the process of creating an Extism plugin that implements the API described in the readme: https://github.com/extism/game_box#game-api

The best way to understand it right now is to read that doc along with looking at the reference implementation (tictactoe): https://github.com/extism/game_box/tree/main/games/tictactoe

This is probably the best implementation to study, but if you don't know rust, the other examples here are in JavaScript and TypeScript https://github.com/extism/game_box/tree/main/games

One word of warning is there is not yet an easy way to test the games. I'd recommend leaning on unit testing as much as possible. The strategy I've used is to separate the Extism entry points into their own small file, create a separate interface for your game logic, then write unit tests against that game logic interface.

Feel free to post more questions here for reach out to me on Discord if you want some help.