Monday, May 5, 2008

Misc.

Two things. Feel free to start your own open source project with my Java source code. I suggest SourceForge or Google. And my only suggestion is not to use "Magic: The Gathering" in the description, but instead just use "trading card game". Zip file with the full program and source code, download it here.

Secondly, when the computer blocks with multiple blockers a window should popup but doesn't. I should fix this soon. I think a previous version won't have this problem, download it here. Thanks for the error reports.

3 comments:

Slyphidine said...

The problem with the damage window not popping up is only an issue when you use the "resizable game area" option. If you opt for the smaller view, the damage window does pop up when multiple creatures block one of your creatures.

Notwithstanding, thank you for helping me to kill countless hours at work. Keep up the good work!

procris said...

Hi Forge!
First of all - sorry for my bad English – foreign language for me (i’m russian :), and thanks for great work!
I read you blog since the first comments, cause this theme is actual for me.
I also program a client for a CCG (not the MTG – for Russian freeware CCG called “Boomb.It”).
The similarity between our projects is the AI module, so I have almost the same tasks as you. I write program in Java, GUI completely written in Java2D (you can look the gameplay at http://www.youtube.com/watch?v=Ajv4CVj3Xis).
The rules of “Boomb.It” are not the same as for MTG, but have many similar mechanics.
So, some words about AI programming in my game (hope some things may be useful for you).
During game AI uses “costs” algorithm for estimating the cards “cost”. This value is computed from 3 parameters:
1) Cards characteristics and abilities (power/lives for creatures, mana cost, etc.) – this is a static value (but it can vary, if, for example, the cards characteristics changes).
2) Game situation – dynamical value, depends on several game parameters – such as player/enemy lives, cards in games zones etc.
3) Additional cost (may be negative) – for some cards by cards id’s – written as separated class for taking into account special cards abilities.
Also, there is a method for checking if AI may play card for the moment – it returns “true” or “false” (for example this method will return “false” for card with “damage opponent creature” ability, if there are no creatures in enemy game).
All this methods works with XML representation of the card. The structure of the card XML description consists of the simple “actions” with parameters, which game “engine” can threat (for simple example “move card” action : action=”move” zone_from=”game” zone_to=”graveyard”). So, AI can parse the cards abilities without additional programming (so you can add new cards as simple XML files, and AI can play this cards, no additional program code needed). For the complex cards I plan to add a special class “customCost”, which can be dynamically loaded by the program and returns a complex analyzed “cost”. Also in the plans – adding the “combo patterns” algorithm for allowing AI play the chains of cards. “Combo patterns” algorithm varies the “cost” of cards in such a way for AI plays the right sequences of cards. After the computing of cards costs, AI uses MiniMax algorithm.
So, if you want to discuss this - always waiting you opinions on procris [at] mail.ru.
Thank you for reading.
With best regards!

Forge said...

Thank slyphidine, I the "resizeble game area" option was a very messy late addition. I'm not sure how useful it is anyways.

Hi Procris, your program looks very interesting. I'll e-mail you. I hope there is an English version. :)