Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

It’s really interesting to see you reverse engineer in some cruel sense, since because I have a good deal of chess experience and almost no gamedev experience my first thought when seeing the raycast thing is “Why on earth are we not using some expanded/customized version of an FEN to keep track of what’s where? Using raycasts for this is like taking your Bugatti into a supermarket to use as a shopping cart!” Don’t get me wrong, my code is a disaster so I’m in no place to judge, but trying to use physical objects moving to keep track of what is ultimately non-analogue data seems like a solution to beautiful to be true, like trying to create an oil painting every time someone at your bbq joint needs a moist towelette.

In the spirit of not sounding like I’m just clowning on your, let me share one of my own development gems: I couldn’t figure out how to properly get Area2D nodes to work in Godot, so I decided I would just make my collectables rigidbodie2Ds and it’d be fine. Turns out it wasn’t entirely fine, since in a game where rigidbodies bounce off each other trying to “collect” a rigidbody without bouncing off of it isn’t default behavior (wow, so crazy!). My solution? free() the collectable as soon as it detects a collision but before it starts move_and_collide() proper, hoping and praying that it disappears before the player character detects it. Somehow this strategy has managed to work, although if I told you I understood why I’d be lying.

With that out of the way, I’d be pretty curious to know how your evaluate_position() function worked. Assuming you’re not going the ML direction of Lc0, Stockfish, and Alpha0 (if you are I’m super jelly of all the compute you have lying around), are you using a similar “these squares are worth more” framework but set by hand? Or are you trying to brute force finding move combinations that lead to positive material exchanges? I’d try the brute force version myself, but for some reason itch is saying that it cannot be found every time I try to start it.

(+1)

Mistakes were made, what's crazy is that I almost got away with it if bodies teleported instantly. It seemed easier to make the player's pieces in 3D, however I didn't realize how much harder that would make to bot to program due to my engine knowledge. I definitely made an oil painting for a napkin here.



The system I made is super modular. I would have made so many more chess pieces such as the elephant, camel, tiger, and more if I wasn't debugging my bot.

Granted, we didn't have all of the time in the world, I had to prioritize making the game I was imagining because I wanted an outdoor section too. Still it's a little crazy how many inefficient computations I can make at once without lag.

I love sharing nightmare code stories. Half for learning sake, and half for amusement. I think I might have an idea why you had Area2D detection issues. body_enterd only detects bodies while area_entered only detects areas. It's so easy to overlook.



(Congratulations on your fist game jam game by the way!! I loved it) 

Evaluate position is more simple than you might think! Its a function that returns the score of the current board. The bot tries literally every possible combination of moves, than scores the end result. 

Board evaluation
White has a queen (9)Black has a knight (3)=   6
White has a pawn (1)Black has a rook (5)= -4

Then score bonuses would be given if a pawn is close to promotion, the king is close to the center, the rook is cutting off the king's squares. etc.

That's why the bot is so capture hungry. It sees a piece it can take, but can't evaluate it getting taken back BECAUSE of detection issues. The pawn that could take the queen only sees an empty square.

Unfortunately you can't see my work in action because of my detection issues, otherwise my bot would roughly be a 600-1000 elo. In my opinion, the sweet spot for a game jam where some people can be beginners.

Thank you so much for leaving a comment by the way, made my night! 

The modularity would’ve been a huge plus, I found out how important that is later in the dev cycle when I ended up with a bajillion functions shooting all over the place because I hadn’t thought of trying to compress things. Thankfully for us, computers are fast and so in a lightweight engine like Godot you can really get away with a lot of stuff. In the hustle and bustle of modern computing it can be easy to remember that even with a fairly regeular cpu like mine I’ve still got 12 threads performing over 4 billion calculations every second, that’s a lot of math.

Also, you were totally right about the Area2D vs Body2D nodes. The cattails were the third thing I made for my game (right after the walls and the player character), so at that point I didn’t really understand the difference between the two in any meaninful capacity and I was still struggling to wrap my head around the collision system. By that point I had a hammer in the form of my ability to get collision calculations to work, so those cattails were looking suspiciously nail-like. Even later on I couldn’t figure out how to fix it because part of how I got the cattails to work to begin with was by them sending a signal to the main game node, and I didn’t know about object.connect(“signal”,local_function). In hindsight it should’ve been obvious that such a function existed, but I didn’t really have a feel for the way information flowed between nodes so I didn’t think of it. Yesterday I went back in and finally made the cattails work the way they always should’ve (which also cut out almost a dozen lines of code only to add like 4), and now it’s just a really good example of how much I’ve learned through this whole thing (like you’re chessboard example!).

By every combination, what kind of depth are you using here? Just simple “one move white one move black” or what? 600-1k Elo isn’t half bad for a random chess engine whipped up in a week! It even fits in with your modular things since I’m sure you could pump that up another couple hundred elo with some more tuning.