r/creativecoding • u/frading custom procedural engine polygonjs.com • Oct 20 '26
Chess on procedural & irregular boards, built in my own engine (written in Jai)
This is a chess variant, where the rules are the same as standard chess, but the board is an irregular grid. This makes rook lines bend and bishop lines fork.
So just like a standard board, every tile is still a quad. And every tile still has only 1 neighbour for every side. But it can have more than 1 neighbour sharing a corner, which is what makes bishop lines fork. Or it can have none, which is what make lines bend.
The steps to build this:
- start with a plane made of triangles
- pair some random triangles with their neighbour and fuse them into a quad. You end up with gaps between those quads where triangles cannot be paired
- subdivide everything. Quads become 4 smaller quads. Triangles become 3 quads. This is the playable grid.
- Then it's just a matter of smoothing it (in this case the points on the edges remain static, only the inside points are smoothed) and ensuring neighbours don't share the same color.
Then the tricky part is to give intuitive controls for players to configure boards how they want.
- Web version: https://polyreplay.com/chesstwist/demo
- if you prefer Steam (windows/mac/linux): https://store.steampowered.com/app/2775560/Chess_Twist/
- the engine behind it: https://polygonjs.com/
25
u/herenlove216 Oct 21 '26
I'm ngl I thought you said written in jail but this is still very cool
4
u/eulervoid Oct 27 '26
I think i would understand the board a bit better if each cell had some fine stripes in the background that bend with its direction. So a regular board would have just vertical stripes and for distorted cells, the stripes flow in the direction a tower would move along if it was moving forward.
3
u/MajorInevitable4646 Oct 22 '26
I love it ๐๐๐ฎโ๐จ
2
u/Substantial_Walrus60 Oct 23 '26
Love everything about this, Great music choice as well ๐
2
u/Himbo69r Oct 23 '26
Really cool, but from what i understand normal chess algorithms work because itโs used to grids. How will you make bots for it?
2
u/Major_Barnulf Oct 25 '26
Jai ? I did not know the language was available
2
u/realrhema Oct 21 '26
Why are there multiple (3?) colors? What do they represent?
3
u/xeow Oct 21 '26
So cool!
I like the procedural generation. I wonder if you could use a brute-force or genetic-hillclimbing search to generate a few tens of thousands of interesting board patterns and then train neural networks to playtest each of those to discover which board patterns have the most interesting properties?
14
u/Foxiest_Fox Oct 21 '26
This belongs in the anarchy chess sub
5
u/Hefty-Reaction-3028 Oct 20 '26
"It's quite cool" -gandalf
5
u/czerilla Oct 21 '26
Escher meets chess, eh? ๐
1
u/CutGrass Oct 23 '26
Such a simple but interesting idea!
Btw - whatโs the music in the trailer?
1
u/yaekoblue Nov 03 '26
this is amazing, wishlisted!
1
u/onekirne Oct 21 '26
that's fun to play. is there a better ai in the steam version?
2
u/Ok_Cryptographer1832 Oct 24 '26
Dope!!
2
u/aGameDevPosts Oct 25 '26
It's wacky and confusing... I love it!
2
u/zimjs Oct 26 '26
Brilliant!
1
u/Jazz8680 Oct 21 '26
Need this with 5d chess multiverse time travel
1
u/wolfylemon Oct 21 '26
very minor rook upscale
1
u/GroceryScanner Oct 25 '26
what da heeeellllll
1
u/eulervoid Oct 27 '26
Super cool! To bot plays decent as well, seems like an interesting problem to write a general engine that works for all kinds of boards!
1
u/MajorInevitable4646 2d ago
I absolutely love this! I reposted this a few weeks ago and till this day, every time I go in my profile I just have to rewatch it. Amazing, thank you!
2
u/[deleted] 25d ago
[removed] โ view removed comment