Skip to content

Commit

Permalink
multiplayer docs and makefile updates
Browse files Browse the repository at this point in the history
  • Loading branch information
kripken committed Jan 5, 2013
1 parent b62f601 commit 9976ac0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
21 changes: 18 additions & 3 deletions cube2/server.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -5,10 +5,25 @@
Instructions for websocket networking: 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 1. Run this script
2. Run server.html 2. Run a webserver (e.g. python -m SimpleHTTPServer 8888)
3. Run the client from index.html 3. Run http://localhost:8888/server.html
4. In the client, do /connect 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. Note that you likely need to run the server and client in different browsers or at least browser windows, since browsers throttle background tabs.
''' '''
Expand Down
6 changes: 3 additions & 3 deletions cube2/src/web/Makefile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -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 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 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 .. ; 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.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 #-s PROFILE_MAIN_LOOP=1 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) server.bc: libenet $(SERVER_OBJS)
$(CXX) $(CXXFLAGS) -o server.bc $(SERVER_OBJS) $(SERVER_LIBS) $(CXX) $(CXXFLAGS) -o server.bc $(SERVER_OBJS) $(SERVER_LIBS)


server: server.bc 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) master: libenet $(MASTER_OBJS)
$(CXX) $(CXXFLAGS) -o sauer_master $(MASTER_OBJS) $(MASTER_LIBS) $(CXX) $(CXXFLAGS) -o sauer_master $(MASTER_OBJS) $(MASTER_LIBS)
Expand Down

0 comments on commit 9976ac0

Please sign in to comment.