Permalink
Browse files

multiplayer docs and makefile updates

  • Loading branch information...
1 parent b62f601 commit 9976ac0eff64ee909453b3c3dcebdff5b63e48bb @kripken committed Jan 5, 2013
Showing with 21 additions and 6 deletions.
  1. +18 −3 cube2/server.py
  2. +3 −3 cube2/src/web/Makefile
View
@@ -5,10 +5,25 @@
Instructions for websocket networking:
+Mode 1: Two clients (one with embedded server)
+
+ 1. Run this script
+ 2. Run a webserver (e.g. python -m SimpleHTTPServer 8888)
+ 3. Run http://localhost:8888/game.html?low,low,windowed,serve in one browser
+ 4. Run http://localhost:8888/game.html?low,low,windowed in another browser
+ 5. In the second browser, do /connect
+
+ 'windowed' runs in non-fullscreen mode, useful to run two browsers at once - scroll
+ all the way down to see the canvas. 'serve' runs the embedded server in that
+ client.
+
+Mode 2: Server and client
+
1. Run this script
- 2. Run server.html
- 3. Run the client from index.html
- 4. In the client, do /connect
+ 2. Run a webserver (e.g. python -m SimpleHTTPServer 8888)
+ 3. Run http://localhost:8888/server.html
+ 4. Run http://localhost:8888/game.html?low,low
+ 5. In the client, do /connect
Note that you likely need to run the server and client in different browsers or at least browser windows, since browsers throttle background tabs.
'''
View
@@ -421,14 +421,14 @@ client: client.bc
cd .. ; cd .. ; python $(EMSCRIPTEN)/tools/file_packager.py high.data --crunch=$(CRUNCH_QUALITY) --preload $(ZOOM_FILES) --pre-run > game/preload_high.js
cd .. ; cd .. ; python $(EMSCRIPTEN)/tools/file_packager.py four.data --crunch=$(CRUNCH_QUALITY) --preload $(CYBER1_FILES) --pre-run > game/preload_four.js
cd .. ; cd .. ; python $(EMSCRIPTEN)/tools/file_packager.py five.data --crunch=$(CRUNCH_QUALITY) --preload $(ZOOMOUT_FILES) --pre-run > game/preload_five.js
- cd .. ; cd .. ; $(CXX) $(CXXFLAGS) src/web/client.bc src/web/libz.a -o game/bb.debug.js -s DISABLE_EXCEPTION_CATCHING=1 -s EXPORTED_FUNCTIONS="['_main', '__ZN4game18setplayermodelinfoEPKcS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_b', '__Z7executePKc', '__Z10executestrPKc', '_setforcecamera', '_bb_splash', '_bb_playsoundname']" -O2 --closure 0 src/web/enet/.libs/libenet.a -s SOCKET_DEBUG=0
- #cd .. ; cd .. ; $(CXX) $(CXXFLAGS) src/web/client.bc src/web/libz.a -o game/bb.js -s DISABLE_EXCEPTION_CATCHING=1 -s EXPORTED_FUNCTIONS="['_main', '__ZN4game18setplayermodelinfoEPKcS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_b', '__Z7executePKc', '__Z10executestrPKc', '_setforcecamera', '_bb_splash', '_bb_playsoundname']" -O2 src/web/enet/.libs/libenet.a #-s PROFILE_MAIN_LOOP=1
+ cd .. ; cd .. ; $(CXX) $(CXXFLAGS) src/web/client.bc src/web/libz.a -o game/bb.debug.js -s DISABLE_EXCEPTION_CATCHING=1 -s EXPORTED_FUNCTIONS="['_main', '__ZN4game18setplayermodelinfoEPKcS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_b', '__Z7executePKc', '__Z10executestrPKc', '_setforcecamera', '_bb_splash', '_bb_playsoundname']" -O2 --closure 0 src/web/enet/.libs/libenet.a
+ cd .. ; cd .. ; $(CXX) $(CXXFLAGS) src/web/client.bc src/web/libz.a -o game/bb.js -s DISABLE_EXCEPTION_CATCHING=1 -s EXPORTED_FUNCTIONS="['_main', '__ZN4game18setplayermodelinfoEPKcS1_S1_S1_S1_S1_S1_S1_S1_S1_S1_S1_b', '__Z7executePKc', '__Z10executestrPKc', '_setforcecamera', '_bb_splash', '_bb_playsoundname']" -O2 src/web/enet/.libs/libenet.a
server.bc: libenet $(SERVER_OBJS)
$(CXX) $(CXXFLAGS) -o server.bc $(SERVER_OBJS) $(SERVER_LIBS)
server: server.bc
- cd .. ; cd .. ; $(CXX) $(CXXFLAGS) src/web/server.bc -o server.html -s EXPORTED_FUNCTIONS="['_main']" -O2 --closure 0 src/web/enet/.libs/libenet.a -s SOCKET_DEBUG=0
+ cd .. ; cd .. ; $(CXX) $(CXXFLAGS) src/web/server.bc -o server.html -s EXPORTED_FUNCTIONS="['_main']" -O2 --closure 0 src/web/enet/.libs/libenet.a
master: libenet $(MASTER_OBJS)
$(CXX) $(CXXFLAGS) -o sauer_master $(MASTER_OBJS) $(MASTER_LIBS)

0 comments on commit 9976ac0

Please sign in to comment.