SOURCE CODE
If you’re a Unity developer and you’re curious how REX was made, download the project files and see for yourself! And if you’re not a Unity developer, it’s a totally free download, so you should try it out! It’s really fun and very easy to learn.
The copyright music I used in the game was licensed from a website called the Envato Market, so I can’t include it in the project archive. However, I have replaced the files with open source tracks from the Free Music Archive (freemusicarchive.org) so that you can still see how the code operates on the music files.
AI BEHAVIOUR
Some people have asked me how the AI works: knowing what you’re up against can definitely help you plan your moves! It can also remove some of the fun knowing exactly what’s happening under the hood, so if you don’t want to have the AI behaviour spoiled, don’t read this next bit! ;)
How it works:
NOVICE
The Novice AI plays almost 100% at random. If there is a piece it can take it will take it, regardless of the cost; if not, a random piece moves randomly.APPRENTICE
Neither the Novice nor the Apprentice are capable of thinking ahead, they merely observe the current state of the board and make a decision based solely on that information. Like the Novice, the Apprentice AI will always capture when it can, but it prioritizes what pieces it will use to fight you with based on the value of the pieces involved in the attack (when given the choice, it would rather kill your King with its Guards instead of its Priests, for example). If it can’t make a capture, it cautiously moves its pieces forward one space at a time, risking the lowest valued pieces first.SKILLED
The better AIs can plan ahead and make truly cunning decisions. There are spots on the board they prefer to have their pieces on, and they make moves based on a number of strategic factors. The Skilled AI can think one full turn ahead: it rates and compares the dozens (and sometimes hundreds) of your possible responses to all of the moves it currently has available, then chooses its next move based on that information.EXPERT
The Expert AI can think two full turns into the future, so depending on the state of the board, it rates and compares anywhere from 3,000 to over 61,000 possible outcomes! It is very difficult to beat, but it is possible.IMPOSSIBLE
The Impossible AI can think three full turns ahead, meaning it’s comparing anywhere from 20,000 to over 1.4 million possible outcomes every turn! Needless to say, it is truly impossible to defeat, and even forcing it into a draw can be quite difficult.
So there you have it! If you have any more specific questions about how it all works, just send me a message or leave a comment below!
OVER 1,700 DOWNLOADS
Thank you so much to everyone who has downloaded and given REX a try. I’m extremely grateful to GameJolt for Featuring the game and I really love to get feedback, good or bad, so let me know what you think, and as always, please report any bugs you find!
Have a great weekend! -MD
2 comments