What is this?
This is the source code for judochess.com, a fork of Tempest chess.
The sound files were licensed from another source, and so they are not included here. The game artwork is fully owned and is included in the repository. The website project is a little broken -- phpBB is not included, and a few licensed graphics are also missing. The side pages that provide the important functionality still work (for example, CreateAccount.aspx).
The majority of this repository is under the MIT license. Portions of four dependencies are redistributed here under other licenses:
- protobuf-net (https://github.com/mgravell/protobuf-net) (Apache License 2.0)
- Nito.Async (http://nitoasync.codeplex.com/) (Microsoft Public License)
- ManagedMediaHelpers (https://github.com/loarabia/ManagedMediaHelpers) (Microsoft Public License)
- WriteableBitmapEx (http://writeablebitmapex.codeplex.com/) (Microsoft Public License)
Apart from these four items, you are free to use this code in any way that complies with the MIT license.
How do I get started?
Besides Windows, everything you need is free.
Make sure you have...
- Windows 7 or 8 (Pro version recommended).
- Visual Studio 2013. You can download the free "Visual Studio Express 2013 with Update 3 for Web". Students may be able to access a paid version for free through their institution -- see DreamSpark.
- The Silverlight Development Kit. This might already come with your version of Visual Studio 2013.
- Microsoft SQL Server (Express). It is easiest to get started with Express with Tools (SQLEXPRWT). Unless you know what you are doing, you should install this with the default options!
- Mercurial. You might prefer TortoiseHg, which integrates a user interface.
Download the source code
If you installed TortoiseHg, first create a folder for the project. Right click on the project folder and follow the context menu to TortoiseHg > Clone. Enter https://email@example.com/judochess/judochess as the source and then click Clone. Mercurial will download the project from BitBucket.
If you only installed the command line tools, open the Windows Command Prompt. Assuming you want to store the project in the folder %USERNAME%\Documents\Code\Tempest, enter:
cd %USERNAME%\Documents\Code\ hg clone https://firstname.lastname@example.org/judochess/judochess
(You will need to make the Code folder first, or you could put the project somewhere else.)
Download and attach the test database
In the Downloads section you can download an [already-configured MSSQL database]. You should save the .mdf and .ldf files to a folder somewhere. This database contains 5 accounts: a, b, c, d, and e. The password for each account is 'a' (without the quotes).
Attach the database to an instance of Microsoft SQL Server:
- Launch Microsoft SQL Server Management Studio. It will prompt you for login information. Assuming you installed MSSQL with the default settings, you should be able to just click Connect.
- In the Object Explorer window at the left, right click on the Databases label, then click on Attach...
- Click on Add...
- Navigate to where you extracted the .mdf database file. Note: Management Studio is picky about what files you can access. You might not be able to see the files in your profile directory. You can place the Tempest.mdf and Tempest_log.ldf files in C:\Program Files\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL\DATA.
- Select the Tempest.mdf file and then click OK. Click OK again to attach the the database.
Compile and run the the game!
Open the Tempest.sln file with Visual Studio. Compilation should "just work", and you shouldn't have to configure anything. Launch an instance of the Server project, and then launch the Client project. When the project is set to Debug mode, the client will attempt to connect to the local server. You can open multiple browser tabs of the test page to connect multiple clients to the server.
Note: some of the references refer to the Release binaries, so you may need to switch from Debug mode to Release mode the first time you launch the project to get it to work.
- Client: The Silverlight project for the client.
- Server: The main server code.
- Website: The (incomplete) ASP.NET project for the website.
- Nito.Async: Part of the Nito.Async library (see License information). This is a dependency for the server.
- SilverlightMessages: The main network code that is shared between the Client and Server projects. The Client project references SilverlightMessages.
- SilverlightLogic: The main game logic code that is shared between the Client and Server projects. The Client project references SilverlightLogic.
- Messages: Nothing more than file links to the same code as in SilverlightMessages. The Server project references Messages. The reason for this convoluted setup is that, at least when the project was started, it wasn't possible to share libraries between Silverlight and .Net projects.
- Logic: Similar to Messages, contains nothing more than links to the same files as in SilverlightLogic. The Server project references Logic.
- Shared: Mostly the database schema that is shared between the Server and Website projects.
- NinjaChess: A basic Judochess bot, TestBot(C).
As it is now, the server requires Windows to run. There are a number of web hosts that provide Windows Server. The server software requires minimal resources -- a virtual private server with a 1 GHz processor and 1 GB of memory is sufficient to run everything. Configuring this is beyond the scope of this short readme.
Be aware that the server location is hard coded in the Client project at the top of Lobby.cs. (You should fix that! Pass it as a parameter to the Silverlight app...)
It might be possible to get the server running under Linux with Mono. The main obstacle will be replacing Microsoft SQL Server. For now, it's easiest to stick with Windows Server.