Open modeswitch opened 11 years ago
Great, thanks. Comments:
// XXX EMSCRIPTEN
comments where you modified the engine cpp files[12:44:17.278] TypeError: levelTitleContainer is null @ file:///home/alon/Dev/BananaBread/cube2/js/game-setup.js
.js js/game-setup.js
in the cube2 dir. I tried to fix that and got further withdiff --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.
Sorry to bump this, but why wasn't it merged?
What was the hold up on this? Any chance @kripken or @modeswitch could fix the conflicts so it can be merged?
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.
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.
@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?
这里是龙嫣然的邮箱,感谢您的来信。
@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.
@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.
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
andpublish.sh
to make packaging for upload to demo site easier