How to setup a Stendhal webclient development environment

From Arianne
Jump to navigation Jump to search
This article describes an experimental Websocket Environment. You are most likely looking for one of the articles linked from Configure a development environment (IDE) or Host a Stendhal Server instead.


The websocket support in Stendhal is still very basic, hardly enough for a client used by people dealing with /support. You cannot play with it.


This is a quick guide assuming you are using Eclipse:

  • Check out Marauroa, Branch perception_json into a new project
  • Check out (or reuse) Stendhal into another project.
  • Define a project dependency from Stendhal to Marauroa
    • Right-click on the stendhal project -> Properties
    • Project References
    • Check the marauroa project
  • Add all libraries *except* marauroa.jar to the classpath
    • Right-click on the stendhal project -> Properties
    • Java Build Path
    • remove marauroa.jar
  • Create a Run Configuration, *under the stendhal project*, that launches marauroa.server.net.web.WebSocketServer
  • Add the project root folders of both Marauroa and Stendhal to the classpath
    • In the Run (or Debug) Configuration:
    • Select Classpath tab
    • Click on User Entries line
    • Click Advanced
    • Pick Add Folders, and click OK
    • Select both the marauroa and stendhal folders, and click OK
  • Create server.ini file if you don't already have one
    • under stendhal project, run games.stendhal.server.core.engine.GenerateINIT
  • Right click on the project root folder and select "Refresh" to update the file list
  • Edit server.ini to add these lines, replacing "accountname" with the name of your account for testing:

<source lang="ini"> http_port=8080 debug_fake_web_username=accountname </source>

  • Launch the WebSocketServer run configuration
  • Visit http://localhost:8080/stendhal-text.html or http://localhost:8080/stendhal.html
    • Best to do this using firefox, with firebug extension installed (if you will be developing or studying the client)
    • You can add #charname to the end of the above urls. Note those characters must belong to the account name configured.
  • You can try the chat commands if near an NPC. Movement does not work right now, but you can /teleport the user