Log In  

Cart #54038 | 2018-07-09 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

A simple, cute retro version of classic Chess made in Pico-8. Full implementation of almost all of the Chess rules with a juicy interface and some basic AI to play against. Created as part of the Chess Jam 2018. Here is the game's entry on itch.io.

Jucy animations were very important to me. My Chess AI will never be competetive. So I focused on the game being pretty, readable and fun to play. I wanted to add even more functions but sadly, I ran out of tokens. I tried to squeeze in as many as I could.

That being said, the Chess AI is kicking my butt. Let me know if you've beaten it. Not sure how smart it really is - my Chess is rusty. Also, let me know if you find any bugs.

Note: Game will not recognize draw by Threefold repetition.

P#52226 2018-05-01 12:55 ( Edited 2018-09-27 23:02)

Found a bug with the the Queen putting me into check without LOS, behaving more like a Knight move in fact.

Beautiful board and piece rendition though...:)

P#52229 2018-05-01 13:38 ( Edited 2018-05-01 17:39)

OMG how embarrassing! Bug fixed. Thanks! <3

P#52232 2018-05-01 14:16 ( Edited 2018-05-01 18:16)

Very well put!
As for saving tokens, did not see any obvious wins (you are already decoding string to data).

minor comments:

  • couple of places where you could declare multiple variables using:
local a,b,c=1,2,3
  • use pico API:

can be replaced with:

  • save tokens

can be replaced by:

P#52235 2018-05-01 15:22 ( Edited 2018-05-01 19:22)

gasp What? What function calls does this work on?

P#52240 2018-05-01 15:35 ( Edited 2018-05-01 19:35)

From the Lua manual:

> A call of the form f{fields} is syntactic sugar for f({fields}); that is, the argument list is a single new table. A call of the form f'string' (or f"string" or f[[string]]) is syntactic sugar for f('string'); that is, the argument list is a single literal string.

P#52245 2018-05-01 16:07 ( Edited 2018-05-01 20:07)

Tip: If you leave off the third argument to sub(), it's automatically assumed you want everything up to the end of the string.

So sub("Felice",3) gives you "lice".


P#52263 2018-05-02 07:18 ( Edited 2018-05-02 11:20)

Hey Krystman, this is a really cool chess game. The game has a lot of polish. I like all the animations and presentation of the game. The AI is challenging, maybe 1200 ELO? I could not finish my first game, I was preparing to promote and the game crashed. Unfortunately I don't have a screen grab of the board when this happened, only a screen grab of the error.


P#52264 2018-05-02 07:26 ( Edited 2018-05-02 11:26)

Also, if you have a valid number in a string, you don't have to convert it to a number for flr(). The code inside flr() will do it for you.

> print(flr("1.5"))

Most math functions are willing to take numeric strings, including any format that lua supports, like hex.

> print( cos(".125") )

> print( abs("-12.34") )

> print( band("0xfff0", "0x0fff") )
4080    -- 0x0ff0

> print( bor("0b11110000", "0b00001111") )
P#52265 2018-05-02 07:27 ( Edited 2018-05-02 11:33)

@bbsamurai Oof. That's a serious bug. When did it happen? On your turn or on the computer's? Did it happen when you moved the pawn to promote or at some other time?

P#52266 2018-05-02 07:51 ( Edited 2018-05-02 11:51)

Update: Uploaded Version 3. Fixed this nasty bug:

Also, I tried to reproduce @bbsamurai's issue but couldn't. I will try a few more things. But in the meantime, this new version will continue displaying the board state in case of a crash. So should the game crash on you please take a screenshot and post it here!

P#52282 2018-05-02 12:04 ( Edited 2018-05-02 16:04)

@Krystman: It happened on the AI's turn. The promotion was unavoidable. This error has not happened again, especially since the last update.

I really like the game feel. I think this would be great on mobile.

Here's me getting a victory after a few tries.

P#52309 2018-05-03 04:13 ( Edited 2018-05-03 08:13)

Oh man! You did it! Congrats! I did some testing and the AI's ELO seems to be around 1500. It will beat a Level 3 Stockfish.

I'm pretty sure your bug is still in there. I had another tester report they had a crash. But sadly, they didn't take a screenshot either.

But because the bug is so rare, I have some ideas what the issue could be. Still investigating...

P#52350 2018-05-03 20:35 ( Edited 2018-05-04 00:35)

Seems like the AI is just above 1500 ELO

P#52419 2018-05-05 14:48 ( Edited 2018-05-05 18:48)

Hi Krystman, I wanted to include this game on playpico.com, but it appears to be domain locked to prevent piracy. If you don't want me to include it on PlayPico, that's totally cool, but if you're okay with it being added, would you be kind enough to add that domain to the exclusions list?

If you're not familiar with the site, here's a rundown:

PlayPico was started by me in 2016, and has been around for almost 2 years. All games on there have their code completely untouched, authors fully credited and linked, and BBS descriptions left intact; it's not a site for pirating, hacking, or otherwise, just a list of only games, with various features for helping visitors discover new ones that may otherwise get lost or buried on other sites (such as 24 random games featured every week, and various searching/sorting/filtering features). The site is completely free and ad-free as well, and is just a labor of love.

P#53062 2018-05-27 20:59 ( Edited 2018-05-28 01:18)

your youtube tutorials are helping a bunch man cheers

P#53521 2018-06-13 04:50 ( Edited 2018-06-13 08:50)

With some help from Alex Huang on Twitter I was finally able to fix a nasty bug that would occasionally cause the game to crash. It turns out the bug would occur if the AI had to evaluate a position where the a king was in the upper left corner of the board. Understandably, it was a pretty rare bug so I'm quite relieved I was finally able to track it down.

With this specific bug fixed I'm also publishing the game more widely. I've uploaded it to Kongregate and Newgrounds. If you'd like, you could help me out by giving the game an upvote on those platforms!



Also @Scathe: I whitelisted the game for playpico.com! Go ahead and publish it there too!

P#53953 2018-07-05 10:03 ( Edited 2018-07-05 14:05)

Update: With the game being out on other platforms I've gotten more feedback. One player on Newgrounds noticed that in some circumstances, you could castle with the opposing player's piece. Ooops!

That bug was now fixed!

P#54039 2018-07-09 17:15 ( Edited 2018-07-09 21:15)

I decided to write a little about how I made this game. This is the first article on the design:


P#54469 2018-07-27 13:20 ( Edited 2018-07-27 17:21)
P#54777 2018-08-06 19:58 ( Edited 2018-08-06 23:58)

Okay, this is NICE ! Seems to be smarter than your average bear and speedy too. Surprising in independent interpretive programming languages.

You DEFINITELY need an option to SAVE GAME. I'm working on some ways of dicing up that infernal 256-bytes, but you are in luck !

You can save neatly 64-numbers, just the board size, quite easily to standard storage.

P#54778 2018-08-06 22:08 ( Edited 2018-08-07 02:08)

So cool! Thanks!

P#54822 2018-08-07 16:34 ( Edited 2018-08-07 20:34)

In playing this more, I'm noticing something. It seems right after you make your move, your opponent knows IMMEDIATELY what piece to move of theirs by highlighting it - but then takes time "..." to determine where it should go.

If you can apply its way of immediately knowing which piece to move during turns, could that somehow be a way of speeding up the intelligence of where that same piece wants to move to ?

P#54830 2018-08-07 18:36 ( Edited 2018-08-07 22:37)

@Krystman explains this in the second article above:

> It takes some time to move the cursor to the desired piece. I decided to exploit this to mask some of the "thinking" the AI is doing. The AI will start moving the cursor while it's still calculating their move. Even before the calculations are done, the AI will already have a preliminary candidate for the possible best move. I let the AI move the cursor to that candidate. If the candidate turns out to be the best move, it will look as if the AI took less time to calculate the move than it actually did. If the AI abandons its first candidate for a better move, it will look as if the AI "changed its mind". It makes the AI look more human. On a more technical level, it also gives me some insights into the AIs "thought process".

P#54852 2018-08-08 07:37 ( Edited 2019-02-05 12:26)

Well, with that in mind, I suppose you could slow the computer cursor down a bit, not too much, to give the illusion of deep thought. :)

Still, a marvel of a cart. Were the PICO a true console of yesteryear, back with the Atari 2600 and Sinclair 1000, I would definitely buy this game to add to my library.

P#54855 2018-08-08 10:38 ( Edited 2018-08-08 14:38)

This is very nice! First try, it kicked my butt. The animations and art are amazing. I'll definitely be revisiting this one frequently!

P#56573 2018-09-12 12:21 ( Edited 2018-09-12 16:21)

There should perhaps be a very slight amount of randomization in the computer's choices - it's literally impossible for the computer to play itself as the game fails to end in exactly the same way every single time =)

P#57183 2018-09-27 17:49 ( Edited 2018-09-27 21:49)

I was thinking of a way to speed up the computer tremendously. Now we have two functions that operate independently of each other.

That of _DRAW() and _UPDATE().

Would it be possible to limit the actions of _DRAW().

In other code, every time you use FLIP() you give time away from your code to the computer to draw the screen and update the input status (keyboard and mouse). In loops absent of this command and also absent of functions _UPDATE() and _DRAW() the computer runs maximum speed.

I don't know if you can limit the actions of _UPDATE() or _DRAW(), but if you can, it should speed up the computer's thinking of a valid move considerably.

P#57184 2018-09-27 18:43 ( Edited 2018-09-28 05:10)

@dw817 there's always the obvious method of surrounding the entire _DRAW() event code in an



P#57186 2018-09-27 18:58 ( Edited 2018-09-27 22:58)

Well I'm not sure, CableDragon. Even by bypassing the entire _DRAW() function, doesn't it still get time to do an internal FLIP() automatically every 30- or 60-frames per second ?

This is one of the reasons I haven't adopted _UPDATE() and DRAW() as you get to choose when and where the screen is updated, solely through the command of FLIP(). Only then would the screen be updated and input status be read and no other time.

GFA was the same way. That language ran FAST, so fast that if you did actually forget a PEEKEVENT in your code periodically (same as FLIP()) that you could hang the whole executed program and require task manager to remove it.

P#57187 2018-09-27 19:02 ( Edited 2018-09-28 05:11)

Great little chess game! So juicy and fun!

Only thing I'd love is Easy, Medium, Hard levels to change how many ply it looks ahead. Oh, and chess notation shown on the top line as you or the AI are selecting/moving.

Awesome job, dude!

P#60471 2018-12-31 20:52 ( Edited 2018-12-31 20:54)

Ayy I beat it first try :v

Great AI, definitely around stockfish 3 strength.
Just something to note, you mentioned it doesn't recognise draw by threefold repetition but the AI still tries to preform a draw by repetition in losing positions

P#60720 2019-01-09 18:38

I play chess as well as a toaster but this is nice.

P#65902 2019-07-17 14:32

Beat it! Fantastic Chess game. Gives over-the-board chess some serious competition ;)

P#69635 2019-11-04 14:52

Another great game to add for me and my friends to play in study hall with nothing to do!

P#69658 2019-11-05 16:07

As a chess fan, this is amazing!

P#69724 2019-11-07 18:00

Awesome work/game. I go to a chess club so i'm going to play a lot of times to practice. Thank you.

P#71351 2019-12-23 19:37

Great game and write-up! Really enojoyed seeing your process, the concept of juiciness explains why many puzzle games here are so enjoyable.

P#71422 2019-12-26 18:06

Great game and absolutely awesome computer! I really like that the computer is able to look ahead and prepare for what might come. However, I noticed one problem. I was screwing around in human vs. human mode and reduced the board to just the kings. Now, I am well aware that the chances of this happening in a real game are highly unlikely, but because of the "safety" precautions, there is no way to win the game and you would be forced to quit.

P#72878 2020-02-07 13:58

Love the game,good graphics and I love chess I'm not good enough to beat the AI.(It would be cool if intelligence levels for the AI could be changed,but I don't know if there's space to add that)

P#73496 2020-02-27 02:15

Wow. Reading the articles. Amazing stuff, ever thought about writing a book or something? Where do I learn, apart from the LazyDevs vids?

P#75727 2020-05-02 03:23

omg that took 5 years, the ai is way too good for me lol

P#81522 2020-09-05 18:09

Really great aesthetic and very fun. Kicked my butt the first game I played.

P#83456 2020-10-29 13:05

Very fun and very juicy, the polish is perfect. Even though the game is now 3 years old, so you have probably stopped updating it, controls for P2 when playing in human VS human mode would be nice? :) It would make playing with my sister easier

P#100539 2021-11-21 08:43

don't know why but watching the AI play against another AI is funny. they are evenly matched.
let it sit, then came back and they were still fighting. :l

P#100636 2021-11-22 19:39

YOOO this game has En Passant, thats so awesome

P#126751 2023-03-08 00:07

this is so fun! the animations are cute and nice too :)

P#126819 2023-03-09 00:28

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-02-27 23:36:38 | 0.049s | Q:93