My basic chess starter kit

From Jocly Wiki
Jump to: navigation, search

It is important to understand that even if Jocly can implement almost any 2 players abstract strategy game, you can rely on some modules that may provide a higher level of API to make things easier. In this case, we will start from a basic chess game that already provides a number of useful services from the Jocly chess module. The following instructions may not apply if you want to implement a checkers variant for instance.

The very first thing is to make sure you have everything in place to run a regular chess game on your site.

Remember your custom chess variant can only run from your site. If it is for your private usage only or for development, you can run a web server on your local machine. Being a Linux user, i generally run my own server locally using:

python -m SimpleHTTPServer

and i access it from http://localhost:8000/ but there are many other ways to run your web server locally on any platform.

(This also works for Mac OS X: Start a Simple Web Server from Any Directory on Your Mac)

The system uses the jquery.jocly jQuery plugin to automatically creates an iframe on the Jocly servers to run the game and to provide a way to inject your own graphics and code into the iframe.

First copy the last version of these three files to your server (or local machine) from the GitHub project repository (you can directly right click + save as):

Your development directory should look like this:

[my-http-server-directory]/my-custom-game/
    dev-stub.html
    jquery.jocly.min.css
    jquery.jocly.min.js

Start a browser tab to this page (for instance http://localhost:8000/my-custom-game/dev-stub.html).

Speaking about browsers, prefer Firefox or Chrome to IE in order to have 3D available.

You should now be able to run a regular chess version and have basic mode/restart/take-back/fullscreen controls and view options.

Dev-chess-variant-10.png