Skip to content
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

Webrtc merge #38

Open
wants to merge 85 commits into
base: master
Choose a base branch
from
Open

Webrtc merge #38

wants to merge 85 commits into from

Conversation

modeswitch
Copy link
Collaborator

Webrtc multiplayer support for BananaBread; Updated art assets and new levels from gk; Updated Makefile to avoid rebuilding packages all the time; Added manifest.txt and publish.sh to make packaging for upload to demo site easier

Alan Kligman and others added 30 commits January 13, 2013 18:16
This reverts commit d570815.
Conflicts:
	cube2/game/setup_low.js
	cube2/js/game-setup.js
	cube2/src/web/Makefile
@kripken
Copy link
Owner

kripken commented Aug 29, 2013

Great, thanks. Comments:

  1. Please add // XXX EMSCRIPTEN comments where you modified the engine cpp files
  2. We need the benchmarking stuff to work (benchmark.html). It fails on [12:44:17.278] TypeError: levelTitleContainer is null @ file:///home/alon/Dev/BananaBread/cube2/js/game-setup.js.
  3. We also need the shell benchmarking to work, js js/game-setup.js in the cube2 dir. I tried to fix that and got further with
diff --git a/cube2/js/game-setup.js b/cube2/js/game-setup.js
index 6d74f1a..de9a56c 100644
--- a/cube2/js/game-setup.js
+++ b/cube2/js/game-setup.js
@@ -1,9 +1,18 @@
 // Setup compiled code parameters and interaction with the web page

+var shell = typeof window == 'undefined';
+
+if (shell) {
+  load('game/headless.js');
+  load('game/headlessCanvas.js');
+  console = { info: print, log: print };
+  navigator = { userAgent: 'shell', platform: 'shell' };
+}
+
 var Query = {
   parse: function parse(queryString) {
     var result = {};
     var parts = queryString.split('&');
     parts.forEach(function(part) {
       var key = part.split('=')[0];
       if(!result.hasOwnProperty(key))
@@ -69,21 +78,14 @@ else
 var params = Query.parse(window.location.search.substring(1));
 console.info('params', params);

 var url = window.location.toString();
 url = clearQuery(url, 'serve');
 url = clearQuery(url, 'windowed');

-var shell = typeof window == 'undefined';
-
-if (shell) {
-  load('game/headless.js');
-  load('game/headlessCanvas.js');
-}
-
 function checkPageParam(param) {
   console.log('checkPageParam:', param);
   return Query.defined(params, param);
 }

 Date.realNow = Date.now;
 if (checkPageParam('deterministic')) {

but then it hangs. I wonder if we don't just want to disable networking or something like that.

@klaussilveira
Copy link

Sorry to bump this, but why wasn't it merged?

@slacka
Copy link

slacka commented Jan 12, 2017

What was the hold up on this? Any chance @kripken or @modeswitch could fix the conflicts so it can be merged?

@kripken
Copy link
Owner

kripken commented Jan 13, 2017

I don't remember the history here, but webrtc support in emscripten itself has stagnated, the tests have been disabled. We need more help in that area.

@noahcoetsee
Copy link
Contributor

I believe we should switch to a more robust library like socket.io or engine.io with NodeJS for server side, like Inexor has done.

@VinnyVicious
Copy link

@modeswitch @kripken I know this is necroposting, but I was curious about BananaBread as an example of networking on Emscripten.

Are there more modern approaches? Or is this PR still a good piece of code to read and learn from?

@roxanne-longyanran
Copy link

roxanne-longyanran commented Nov 4, 2022 via email

@kripken
Copy link
Owner

kripken commented Nov 4, 2022

@VinnyVicious I actually am not sure what the best example of that is atm. Might want to open a discussion on the emscripten repo perhaps.

@modeswitch
Copy link
Collaborator Author

@VinnyVicious This was intended to be a proof-of-concept. The underlying concepts should still work, even though the code is outdated. I won't guarantee that there isn't a more modern approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants