Full featured multiplayer or artificial intelligence Chess game

Check the online demo!
This Diem plugin is about Chess game.

Provides a graphical HTML/CSS/JAVASCRIPT client, and an Artificial Intelligence server.

It allows to play against a distant friend or an aggressive AI.

Can also act as a Chess AI webservice.

Heavily unit tested ( 427 unit tests for now )

Installation

  • In a console, from your project root dir, run:
git clone git://github.com/ornicar/dmChessPlugin.git plugins/dmChessPlugin  
  • In config/ProjectConfiguration.class.php, add dmChessPlugin to the list of enabled plugins:
class ProjectConfiguration extends dmProjectConfiguration
{  
  public function setup()  
  {  
    parent::setup();  
 
    $this->enablePlugins(array(  
      // your enabled plugins  
      'dmChessPlugin'  
    ));  
  • In a console, from your project root dir, run:
php symfony dm:setup  

There is a symfony/doctrine bug where generating migrations for models using doctrine inheritance. This plugin uses doctrine inheritance, so untill the bug is fixed, you cannot generate migrations for your project when you install this plugin.

Play on your site

Just drag and drop the Chess/Play widget somewhere on your site. Play.

Learn from code

I made this plugin to show how complex things can be done easily with Diem plugins.
Have a look to:

  • usage of the Dependency Injection Container (config/dm/services.yml)
  • usage of Doctrine inheritance (config/doctrine.schema.yml)
  • usage of the Event Dispatcher (lib/event)
  • plugin translation file (data/dm/i18n/en_fr.yml)
  • Chess rules aware Model (lib/model)
  • artificial intelligence drivers (lib/ai)
  • PHP -> JavaScript communication (lib/asset/dmChessJavascriptConfig)
  • interaction with a runnable standalone AI program (lib/crafty)
  • jQuery implementation (web/js)

Tweak it

By replacing services implementation classes in your config/dm/services.yml, you may tweak absolutely every part of the plugin to match your needs.
To tweak the style of the game, just use a CSS file.

Build a heavy game server

Bu default the AI is not executed on your server. The AI moves are asked to a web service. This service is provided by another instance of dmChessPlugin installed on http://chess.diem-project.org.

So if you plan to have many visitors playing Chess on your site, you should consider running the AI on your own server instead of sending tons of requests to mine :)

Artificial Intelligence drivers

You can change the AI driver by putting these lines in your
/config/dm/services.yml

parameters:  
  
  dm_chess_ai.options:  
    driver:                   web # can be "stupid" or "web" or "crafty"  

The stupid driver plays randomly and is just used for test purpose.

Web driver

Enabled by default, will use the chess.diem-project.org web service to make AI play. Requires no configuration from you to work.

Crafty driver

The crafty service run crafty on your server. Crafty is an open source Chess AI program you can install on your server. It will give you the ability to tweak it, and will improve A.I. response time since no requests to chess.diem-project.org will be sent no more.

Provide your own Chess A.I. web service

If you installed crafty on your server, you can transform your dmChessPlugin onto a Chess A.I. web service:
/config/dm/services.yml

parameters:  
  dm_chess_ai_server.options:  
    enabled:                  true  

Now other instances of dmChessPlugin can set the web service url to your url instead of mine:
/config/dm/services.yml

parameters:  
  dm_chess_ai_driver_web.options:  
    url:                      http://your-domain.com/+/dmChessAiServer/play  

Contribute

If you want to help making it better, or provide translations in your language, your help is welcome! Please send a request to http://www.symfony-project.org/plugins/dmChessPlugin.

  • morewebDecember 28, 2009 9:49 PM

    .. I said "fun". I didn't say "usefull" :D ..

  • ThibaultDecember 29, 2009 12:31 PM

    Hehe. We can't just spend all time on serious things. I was happy to work for a few days on something useless.

    Anyway, this can be usefull to show what a complex Diem plugin is made with.
    It also demonstrates although Diem is a CMS, it can do more than websites.

  • manuJanuary 13, 2010 9:12 PM

    what does mean 'Just drag and drop the Chess/Play widget somewhere on your site'?

    Can you how to call this chess plugin from my application?

    Thanks

  • Thibault DJanuary 17, 2010 2:56 PM

    @manu

    Once the plugin is installed, a new widget appears on the front toolbar "Add" menu. Drag&drop this widget on your site. That's all.

Add a comment

dmChessPlugin, created on December 28, 2009 by Thibault D, used by 6 projects

Fork Diem on GitHub