It is currently 26 Apr 2024, 12:28
   
Text Size

AI Engine

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

AI Engine

Postby 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?
juzamjedi
Tester
 
Posts: 575
Joined: 13 Nov 2008, 08:35
Has thanked: 6 times
Been thanked: 8 times

Re: AI Engine

Postby 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...
The Force will be with you, Always.
User avatar
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

Postby 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.
mtgrares
DEVELOPER
 
Posts: 1352
Joined: 08 Sep 2008, 22:10
Has thanked: 3 times
Been thanked: 12 times

Re: AI Engine

Postby 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.
frwololo
DEVELOPER
 
Posts: 265
Joined: 21 Jun 2008, 04:33
Has thanked: 0 time
Been thanked: 3 times

Re: AI Engine

Postby 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. :)
juzamjedi
Tester
 
Posts: 575
Joined: 13 Nov 2008, 08:35
Has thanked: 6 times
Been thanked: 8 times

Re: AI Engine

Postby 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

Postby 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.
juzamjedi
Tester
 
Posts: 575
Joined: 13 Nov 2008, 08:35
Has thanked: 6 times
Been thanked: 8 times


Return to Forge

Who is online

Users browsing this forum: No registered users and 170 guests


Who is online

In total there are 170 users online :: 0 registered, 0 hidden and 170 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 170 guests

Login Form