AI Engine
by mtgrares
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
AI Engine
by juzamjedi » 16 Apr 2009, 18:34
I was sitting back and wondering today how easy it would be to take the AI engine from MTG Forge and use it in another application. Suppose someone wanted to use the MTG Forge AI with the rules engine from Incantus (or etc.). Ignoring the language difference for a moment - would this even be feasible with the way that the AI is implemented in MTG Forge?
Re: AI Engine
by Rob Cashwalker » 16 Apr 2009, 20:28
Not likely. Right now, the rules engine is spread out across alot of classes, and some parts are implemented by the cards themselves. The AI is spread out all over the place just the same, and again, each card carries its own AI code.
rares has posted his concepts for dividing the different engines, which would be one of the first steps, but I'd doubt that it could ever be inter-operable...
rares has posted his concepts for dividing the different engines, which would be one of the first steps, but I'd doubt that it could ever be inter-operable...
The Force will be with you, Always.
-
Rob Cashwalker - Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
Re: AI Engine
by mtgrares » 17 Apr 2009, 16:38
Ideally yes, but no. The AI is actually composed of the "AI brain" which pays for mana costs and the AI code that is embedded into each card, for example the computer will play Giant Growth on a creature that it will attack with. The AI code for Giant Growth is in the Java source code, so bits of the AI are throughout the whole program. (The computer still makes mistakes with Giant Growth because the computer randomly doesn't attack when it could in order to be a little unpredictable.)
The AI routines for attacking and blocking are separate from the other code and might could be used by another project, they are called something like Computer_Attack2.java and Computer_Block2.java.
The AI routines for attacking and blocking are separate from the other code and might could be used by another project, they are called something like Computer_Attack2.java and Computer_Block2.java.
- mtgrares
- DEVELOPER
- Posts: 1352
- Joined: 08 Sep 2008, 22:10
- Has thanked: 3 times
- Been thanked: 12 times
Re: AI Engine
by frwololo » 20 Apr 2009, 01:06
I don't intend to bash or anything, but from what I've seen the quality level of the code of the two apps is very different, and it would be awkward to put some code from forge into incantus.
Last time I talked to thescientist and Mageking17 (a while ago) they were strongly against an AI for Incantus because it would never be perfect.
The code in forge is very card-specific, which makes it very powerful in some occasions, but overall very difficult to maintain as the number of cards grows.
If people were to add an AI to Incantus, I'd rather suggest to start from scratch with a minmax algorithm rather than understand the code in MTGForge. That, or contact the author of Deckbot, which as an AI that is way more flexible than the one in forge.
Last time I talked to thescientist and Mageking17 (a while ago) they were strongly against an AI for Incantus because it would never be perfect.
The code in forge is very card-specific, which makes it very powerful in some occasions, but overall very difficult to maintain as the number of cards grows.
If people were to add an AI to Incantus, I'd rather suggest to start from scratch with a minmax algorithm rather than understand the code in MTGForge. That, or contact the author of Deckbot, which as an AI that is way more flexible than the one in forge.
Re: AI Engine
by juzamjedi » 20 Apr 2009, 07:03
Thanks for the suggestion on Deckbot, I will take a look at that as it may fit the itch that I want to scratch.
Re: AI Engine
by jpb2 » 21 Apr 2009, 16:40
It will be doubtful that you will be able to take any AI from one game and plug it into another unless the two components were designed with this in mind. There is no API for magic components. It would be easier to write an AI from scratch than to try to hack code from one project into another.
- jpb2
- Posts: 11
- Joined: 21 Apr 2009, 16:36
- Has thanked: 0 time
- Been thanked: 0 time
Re: AI Engine
by juzamjedi » 21 Apr 2009, 20:21
Thanks for the response jpb.
This is why I asked in the first place. I haven't looked at the code for forge at all and was curious if the capability to plug in was supported or not. From the responses I have gotten it seems that this is not possible. But hey you don't know if you don't ask.
Making a good AI for a complex game like this is *very* hard. I applaud the forge team for taking on the task and hope that it continues to improve even if the methods wouldn't work as a plug in.
This is why I asked in the first place. I haven't looked at the code for forge at all and was curious if the capability to plug in was supported or not. From the responses I have gotten it seems that this is not possible. But hey you don't know if you don't ask.
Making a good AI for a complex game like this is *very* hard. I applaud the forge team for taking on the task and hope that it continues to improve even if the methods wouldn't work as a plug in.
7 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 170 guests