example-webrtc-applications icon indicating copy to clipboard operation
example-webrtc-applications copied to clipboard

Improvements to Ebitengine game example

Open ValorZard opened this issue 3 months ago • 3 comments

Summary

The example is pretty decent for now, but it could use some improvements

Motivation

Right now the example can only work on one computer between two different clients. I’d like it to work between multiple different computers with up to like 8 players in one lobby.

Add CORS Support

We need to figure out a way to add CORS support to the signaling server to host it properly and let remote clients connect to it

More players in one lobby

I’d like to have more players in a lobby besides just two.

Let players leave/join the lobby

We should have players be able to leave and join the lobby, and have their characters spawn and despawn.

Refactor for better code quality

I’m 90% sure that there’s some jank in the code that we could probably fix and refactor at some point.

ValorZard avatar Sep 09 '25 19:09 ValorZard

I think a low hanging fruit we could probably do is refactor the ice gathering code so that instead of blocking on ice gathering, we instead send each new SDP once we get a new ice candidate. That way, we can generate a connection faster

ValorZard avatar Sep 12 '25 06:09 ValorZard

Ah wait I forgot that adding ice candidates are a separate process from exchanging SDPs. That mean we instead need to have a separate endpoint for them, hm

ValorZard avatar Sep 12 '25 06:09 ValorZard

I should probably mention here that right now the UI for the game is kind of confusing. I should have it so that if you press Host or Join, the other button disappears since it doesn't make sense to join if you are the host and visa versa. Also, if you enter an incorrect lobby id to join, your game just crashes, because I didn't implement error handling properly

https://github.com/pion/example-webrtc-applications/blob/c2fa97ffefd8c6314b9b9185b1b281742b9f4a42/ebiten-game/signaling-server/main.go#L148-L171

https://github.com/pion/example-webrtc-applications/blob/c2fa97ffefd8c6314b9b9185b1b281742b9f4a42/ebiten-game/game/main.go#L400-L418

ValorZard avatar Oct 26 '25 23:10 ValorZard