Opponent AI implemented
It was by far the most difficult thing to make in this game, but now the AI for a functioning and challenging Opponent is finally working.
The coding itself was the "easy" part for this. The researching and planning was the hard part. I found the Minimax-Algorithm on my search for possible AI-Solutions and decided to try it out.
It is basically an AI for turn-based games, where you assume that both players play perfectly. There is a "Maximizer" and a "Minimizer". They want to gain the highest/lowest score possible of all possible outcomes. The algorithm looks through all possible future-turns and calculates a score at the end of each possibilities (the end-state of the game or the maximal depth where you want to search), and then decides which turn to make to get to that "perfect future". Here is a video from Sebastian Lague, which helped me a lot to understand what this is about: https://www.youtube.com/watch?v=l-hh51ncgDI
The problem was, that my card-game has over 6 Million possible outcomes and I couldn't construct such a complex game tree, which is required for the Minimax-Algorithm if the data should be complete. I also had no idea how I should simulate the gameboard for my AI to check all the different possibilities, as I didn't want to make a new board in the background.
In the end, I decided that my AI should only think about the present. It calculates the best attack for each turn and places a card so that the most efficient attack is done.
Of course there are a few exceptions in this behavior, but I don't want to spoiler you ;)
Anyway, with this my game is functioning how I wanted it to and the last steps, music and visual effects, are now in the planning.
Hope you enjoy what I made so far.
Files
Cards' Master
A little card game, that I want to make into a fully playable experience.
More posts
- Progress is now savedFeb 29, 2020
- Unlockable OpponentsFeb 08, 2020
- Deckbuilding now availableJan 21, 2020
- Added a main menu and a collectionJan 19, 2020
Leave a comment
Log in with itch.io to leave a comment.