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.
| 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!