Ren'Py Chess Engine Source Code

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Post Reply
Message
Author
User avatar
r3dhummingbird
Newbie
Posts: 9
Joined: Sat Oct 31, 2020 11:57 am
Completed: Learn to Code RPG https://freecodecamp.itch.io/learn-to-code-rpg
itch: r3dhummingbird
Discord: lynn#9327
Contact:

Ren'Py Chess Engine Source Code

#1 Post by r3dhummingbird »

Itch.io link: https://r3dhummingbird.itch.io/renpy-chess-game

I built a chess GUI built using python-chess https://github.com/niklasf/python-chess and Stockfish (for chess AI). You can use it as a standalone playable or integrate it as a minigame into a Ren'Py visual novel project. The source code is available inside the game folder. Feel free to post feature requests (or bug reports if any) on the itch.io page.

Gameplay
The game supports Player vs. Player and Player vs. Computer. In PvC, player can choose to play as either Black or White.

Click on a piece and all of its available moves will be highlighted in blue. Click on any of the legal destination squares to make a move. Press Flip board view to flip the view, with White on the bottom by default.

Image

Flip-board view
Image

Pawn promotion
Image

Image

Image

Image
Attachments
promotion.gif
threefold.gif
stalemate.gif
pvc.gif
foolsmate.gif
flip_board.gif
Last edited by r3dhummingbird on Sat Oct 31, 2020 5:59 pm, edited 2 times in total.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Ren'Py Chess Engine Source Code

#2 Post by Imperf3kt »

Is this built on top of viewtopic.php?f=51&t=50997 ?
You may want to check the checkmate conditions, I once got an error instead of losing but didn't take note of how.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
r3dhummingbird
Newbie
Posts: 9
Joined: Sat Oct 31, 2020 11:57 am
Completed: Learn to Code RPG https://freecodecamp.itch.io/learn-to-code-rpg
itch: r3dhummingbird
Discord: lynn#9327
Contact:

Re: Ren'Py Chess Engine Source Code

#3 Post by r3dhummingbird »

Imperf3kt wrote: Sat Oct 31, 2020 4:30 pm Is this built on top of viewtopic.php?f=51&t=50997 ?
You may want to check the checkmate conditions, I once got an error instead of losing but didn't take note of how.
Thanks for the comment! That was actually my account from two years ago :D This time I didn't implement all the chess backend logic from scratch but used python-chess: https://github.com/niklasf/python-chess. If there is a bug with the chess logic/stockfish engine that's probably hard to fix. I'm happy to look at the logs if anyone runs into any more crashes.
Completed Work
Learn to Code RPG: https://freecodecamp.itch.io/learn-to-code-rpg

User avatar
Autumnotopia
Regular
Posts: 59
Joined: Sun May 19, 2019 8:53 pm
Completed: Making Friends
Tumblr: autumnotopiadev
Github: autumngreenley
itch: autumnotopia
Contact:

Re: Ren'Py Chess Engine Source Code

#4 Post by Autumnotopia »

Oh, cool! I was using your previous version in my VN, so I'm excited to look over the new one :D
Image
A game about loneliness, chess, and fighting monsters with magic

Post Reply

Who is online

Users browsing this forum: No registered users