kripken / BananaBread

BananaBread is a C++ 3D game engine that runs on the web using JavaScript+WebGL+HTML
1.38k stars 340 forks source link

Get some gaming happening! #57

Open harry-wood opened 9 years ago

harry-wood commented 9 years ago

I've tested this out a few times, walking around a solitary landscape, firing my weapon sporadically, but I've never had a multiplayer death-match with someone. The game is obviously intended for this, so how to make it happen?

I see options to create a game or join a game, but there's never any games to join. I'm guessing this is because there has never happened to be another person hanging around running a game at the same time as me. People like me stop by to experiment very occasionally but it's like ships that pass in the night.

First question: Am I understanding that situation correctly? Or I'm doing something wrong?

If it's too quiet on there to get some multiplayer happening, then I guess there's a sort of critical mass problem. The system is awesome and would attract more people to join in, but only if there's at least two people online.

What are the ideas to overcome that?

Croydon commented 9 years ago

As far as I know there was a problem for a time in browser support and later a server problem, so you won't be able to see any other players. It should get indeed fixed, when people can actually play it there would be more interest in it.

kripken commented 9 years ago

Yeah, originally this came out when only 1 browser had enough WebRTC support for it. Today there is much better support.

To see this take off, it would need someone to set up a new site (with new builds, etc.) and promote it to people, as I don't think anyone is still working on the current one or updating it.

Croydon commented 9 years ago

Do I get this right that you don't have access to the current demo site and that's why we need a completly new one?

kripken commented 9 years ago

We just have a singleplayer version up currently, the multiplayer requires a WebRTC broker which we need someone to maintain.

klaussilveira commented 9 years ago

Is the broker code included in the release?

kripken commented 9 years ago

Should be - @modeswitch?

noahcoetsee commented 6 years ago

@kripken I will be the WebRTC broker if you are still looking to make this project a reality. I've been searching everywhere on the web and this is the one project that can efficiently run such a large WebGL game. It's so efficient (50 FPS on a ChromeBook), so I'd like it if I were able to continue it, but I have never used emscripten or Cube2 or Sauerbraten before so I'm curious what I need to know to continue this project.

kripken commented 6 years ago

I don't have much time for this myself, but I'd be happy to help out. Yeah, if you're looking for a fast multiplayer first person shooter, this is a very good option I think. I'm biased though, been a Cube 2 fan for many years :)

What do you mean by "continue the project"? What specific goals do you have?

noahcoetsee commented 6 years ago

I would like to complete the multiplayer functionality as well as some other Cube 2 features such as map modding. I have taken a quick little peek around the source files and I am not sure I completely understand where emscripten ties into all of this and that's what I was asking for clarification. I literally am unable to comprehend (for some reason) how this all ties together...

How readily available would multiplayer functionality be, anyways?

kripken commented 6 years ago

Basically, BananaBread/Cube 2 multiplayer uses C APIs for UDP, in a library called ENet. Emscripten has support for those, that is, it implements them using browser APIs. Specifically, the websockets implementation is known to constantly work as we test it (even using ENet) in emscripten.

The "tricky" thing is that you need to run something like websockify for the server side, as browsers don't support normal TCP sockets. Emscripten has a networking test suite (containing ENet) where you can see this in known working configurations, see tests/test_sockets.py (runnable as python tests/runner.py sockets or for a single test python tests/runner.py sockets.test_enet for example).

WebRTC (UDP) worked in the past, but testing it in emscripten has gone stale and I'm not sure of the status there. But if someone that knows WebRTC looks into it, it's probably not hard to do.

noahcoetsee commented 6 years ago

Hmmm.. Well, my area of expertise is WebSockets but I'm sure I can find someone with some experience in that area.... What previous implementation worked?

kripken commented 6 years ago

Both WebSockets and WebRTC did work, and all the code is still in emscripten. The first thing to try is to just build the client and server and see if things work.

I would start with building the server natively and running it in websockify + building the client with websockets (which is the default). Later, can also test other configurations (the server compiled non-natively, WebRTC, etc.).

kripken commented 6 years ago

Actually, even before doing any web stuff, I'd recommend building the client and server natively, and seeing that that works (it should, but just to be sure, plus to get a feel for things).

noahcoetsee commented 6 years ago

Ok! So, I am just going to build the project and play around with it a tad?

oxr463 commented 5 years ago

@FeaturedSpace any progress on this?

noahcoetsee commented 5 years ago

No, I've been busy with Uni, and I haven't worked out what I wanna do yet