FreecivWebClient
From Freeciv
Contents |
[edit] Freeciv Web Client
It uses a webservice which allows a browser to communicate with a civclient process on the server. The mapview is rendered using the HTML canvas element which is drawn upon using Javascript.
The latest release of the Freeciv Web Client can be tested here: http://code.google.com/p/freeciv-forever/
(note that a lot of the technical details are out-dated in this article...)
The latest version can be found here: http://code.google.com/p/freeciv-forever/source/checkout
Note that some of the information in this wiki page is outdated.
[edit] Development
Contact: Andreas R. - <andrearo AT pvv.ntnu.no>
[edit] Java
Install Java JDK 6 http://java.sun.com/javase/downloads/index.jsp Make sure that java and javac are installed correctly, and that the classpath is setup correctly for Java and Resin.
[edit] Resin Application Server
resin-3.1.2 - http://www.caucho.com/download/ Use the example resin.conf as a starting point. http://svn.gna.org/viewcvs/*checkout*/freeciv/branches/freeciv-web/client/gui-web/doc/resin.conf
You will also need Log4J :
http://commons.apache.org/logging/apidocs/org/apache/commons/logging/impl/Log4JLogger.html
Get those things, copy all the .jar files into your resin/lib directory.
resin will still give an error message about server-config.wsdd Maybe you can ignore it. Maybe you can copy/paste this stuff and figure out where to put it:
http://www.cppblog.com/wform/archive/2006/04/27/6365.aspx
I put it in about 6 different places, and it still complains. But it also works fine, afaict.
And, finally, do NOT start resin ./bin/httpd.sh as 'root' user. That would imply running 'civserver' as root, which will bomb out.
[edit] Compile Freeciv web client
- SVN checkout webclient branch from here: http://code.google.com/p/freeciv-forever/source/checkout
- Compile Freeciv client: First run: ./autogen.sh --enable-client=web
Then run: make && make install
[edit] Install webapp
The web client is now build using maven... See http://code.google.com/p/freeciv-forever/source/browse/trunk/freeciv-web/README
1. Copy /client/gui-web/www-docs to /home/projects/freecivweb
2. Copy the main Freeciv source (everything!) to /home/projects/freecivweb/freeciv
[edit] Running the web client from the browser
- Start Resin 'bin/httpd.sh start'
- Point your web browser to http://localhost:8080
- If that fails, try this: http://localhost:8080/webapp/intro.jsp
- Press 'Start new game'. Wait until you see that the civclient and civserver have been started (logging to message box at bottom of screen).
- Enter the '/start' command in the textfield at the bottom of the screen. Then the game will start. Wait...
[edit] Debugging:
If something goes wrong, see the Javascript console in Firefox.
- Testing the civclient: gdb --args civclient -a --debug=3 -- -NHTTPport 2000 -autostartserver
- WSDL for the Freeciv webservice: http://localhost:8080/axis/FreecivWebService.jws?wsdl
- Testing a Freeciv webservice (Java) method: http://localhost:8080/axis/FreecivWebService.jws?method=getFreecivState
- Testing the civclient C webservice:
http://localhost:2000/civwebserver
(If civclient is run with -NHTTPport 2000 parameter)
Always returns: "Sorry! I only speak with 'POST' method". Meaning that at least there is a server socket listening at port 2000.
-Logging: See resin/log/jvm-default.log (The civclient and civserver will log std.err and std.out here).
[edit] External Links
- Canvas tutorial
- Canvas in Opera
- Javascript SOAP Client
- Drawing graphics with Canvas
- Canvas Class Reference
- Axis webservices
- FPS Shooter using Canvas
