Skip to content

ibra-kdbra/Chessboard-three.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Three.js Chess Game

This is a chess game made using the Three.js library and JavaScript. The game includes a 3D chessboard with realistic lighting and materials, move validation, and support for castling and en passant. The game also includes an AI opponent using the Stockfish chess engine.

Features

  • 3D chessboard with realistic lighting and materials
  • Move validation and support for castling and en passant
  • AI opponent using the Stockfish chess engine

3D Chessboard

The chessboard is created using the Three.js library, which is a cross-browser JavaScript library used to create and display 3D computer graphics in a web browser. The board is rendered using the WebGL API, which is a JavaScript API for rendering interactive 3D and 2D graphics within any compatible web browser.

The board is created using a mesh, which is a collection of vertices, edges, and faces that define the shape of the object. The mesh is then textured with a wood texture to give it a realistic appearance. The lighting is done using point lights and ambient light to create a realistic lighting effect.

Move Validation and Support for Castling and En Passant

The game includes move validation and support for castling and en passant, which ensures that the player can only make valid moves and that pieces are correctly removed from the board when captured.

AI Opponent using the Stockfish Chess Engine

The game includes an AI opponent that uses the Stockfish chess engine, which is one of the strongest chess engines in the world. The AI opponent provides a challenging opponent for players of all levels.

Getting Started

To run the game, clone this repository and open the index.html file in your web browser.

How to Play

  1. Click on a piece to select it.
  2. Click on a valid move to move the piece.
  3. The AI opponent will make its move.
  4. Repeat steps 1-3 until the game is over.

Credits

Conclusion

This 3D chess game is a great example of what can be achieved with the Three.js library. The use of 3D graphics and realistic lighting makes the game more immersive and engaging. The inclusion of AI opponent using the Stockfish chess engine adds a challenge for players of all levels. By exploring the code in this repository, you can learn how to create 3D graphics and games using the Three.js library.