It is currently 27 Apr 2024, 19:19
   
Text Size

Cards database, configuration file...

General Discussion of the Intricacies

Moderator: CCGHQ Admins

Cards database, configuration file...

Postby frwololo » 13 Aug 2008, 00:52

Hello, this is my first post here although I've been lurking around for a few months now. I'm working on a game project for the PSP, for which a demo video can be seen at http://fr.youtube.com/watch?v=Dh42ne3g2cE
(I know that some of you know about this project :mrgreen: )

There are lots of cool apps here that try to do rules enforcement, so I was wondering how these apps were defining the cards' behavior ?
Obviously, the easiest way is to hardcode it in the application, but that gives no flexibility for other people who want to add cards.
My app currently uses a configuration file for cards that have basic abilities (creatures, cards that create mana,...), but it is very limited.

The ideal would be some sort of scripting language rather than a plain text file, but I have no idea where to start for that...
It seems that FireMox has a quite complex XML file format to do that, but how is it processed afterwards ?
Incantus has a card DB. I haven't tried the editor yet (is it included in the game) but from what I've read, it is quite powerful... Could I have some basic explanations, or examples, on how this is done ?

Thanks in advance for your replies
Last edited by frwololo on 13 Aug 2008, 09:20, edited 1 time in total.
frwololo
DEVELOPER
 
Posts: 265
Joined: 21 Jun 2008, 04:33
Has thanked: 0 time
Been thanked: 3 times

Re: Cars database, configuration file...

Postby The Scientist » 13 Aug 2008, 06:42

first let me say that the video looks cool, it seems you have done a pretty good job.

Atm, I help with incantus, which defines abilties and mechanics in the engine and if someone wants to add a card, they just have to paste in oracle text, which will take care of most characteristics, and then use the mechanics on the cards. Triggers have a certain format, but most of it is predefined. To do that we made a basic command list. (http://users.telenet.be/incantus/Incant ... mmands.txt)
Those function are handy to have because then you can create most effects.

here's an example of Mogg Fanatic (note that incantus is working on a new engine, so this format may still change a bit)
Code: Select all
name = 'Mogg Fanatic'
cardnum = 219
expansion = '10E'
type = characteristic('Creature')
supertype = no_characteristic()
subtypes = characteristic(['Goblin'])
cost = 'R'
color = characteristic(['R'])
text = ['Sacrifice Mogg Fanatic: Mogg Fanatic deals 1 damage to target creature or player.']

play_permanent(card, cost)

in_play_role = Permanent(card, Creature(1, 1))

@activated(card, txt=text[0])
def effects(source):
    payment = yield SacrificeCost()
    target = yield Target(target_types=isCreatureOrPlayer)
    source.dealDamage(target, 1)
    yield
Yes, there is a Card Editor to edit the db file, but you have to ask incantus about it.

Incantus was already capable of doing a lot of cards (check the Elves versus Goblins demo), but using the new format, incantus hopes to do even complex stuff like layers dependancy and copy effects.

Hope it helps

feel free to join us on #incantus at EFNET where you can chat with more people working on incantus
The Scientist
 
Posts: 94
Joined: 05 Jun 2008, 07:39
Has thanked: 0 time
Been thanked: 0 time

Re: Cars database, configuration file...

Postby frwololo » 13 Aug 2008, 09:20

Thanks, I'm amazed that the first reply I get answers all of my questions :D
As I thought, Incantus is badass and has a nice scripting language as a backbone !

I'll try to join you on IRC from time to time (might be difficult because of timezone issues). My project has lots of flaws and I could learn a lot from you guys. My long term goal is a cool AI (rather than lots of cards), so who knows, maybe I'll be able to help Incantus in the future :)
frwololo
DEVELOPER
 
Posts: 265
Joined: 21 Jun 2008, 04:33
Has thanked: 0 time
Been thanked: 3 times

Re: Cards database, configuration file...

Postby The Scientist » 13 Aug 2008, 10:49

incantus has as goal to have a program with perfect rules enforcement, using 99 % of the printed Vintage legal cards (aka no banding and some other exceptions, although we think banding is actually doable)
if we can, we like to include AI, but the opinion is that AI is very hard to do.

Also, we (the bunch of us helping with incantus) are from all over the world, this means at any given time there should be someone active in the channel ;-)
The Scientist
 
Posts: 94
Joined: 05 Jun 2008, 07:39
Has thanked: 0 time
Been thanked: 0 time

Re: Cards database, configuration file...

Postby MageKing17 » 14 Aug 2008, 03:27

Saw your blog, we'd love to see you on #incantus some time to talk. Don't worry about timezones, either. I, at the very least, keep strange hours. ;)
User avatar
MageKing17
Programmer
 
Posts: 473
Joined: 12 Jun 2008, 20:40
Has thanked: 5 times
Been thanked: 9 times

Re: Cards database, configuration file...

Postby frwololo » 11 Dec 2008, 04:39

I recently updated the parser for Wagic, and although overall it's a mess, there are a few nice things.
That's the code for Royal Assassin
Code: Select all
[card]
text={T}: Destroy target tapped creature.
auto={T}:destroy target(creature[tapped])
id=1175
name=Royal Assassin
rarity=R
type=Creature
mana={1}{B}{B}
power=1
subtype=Human Assassin
toughness=1
[/card]
That's the code for Terror:
Code: Select all
[card]
text=Destroy target nonartifact, nonblack creature. It can't be regenerated.
target=creature[-black;-artifact]
auto=bury
id=1182
name=Terror
rarity=C
type=Instant
mana={1}{B}
[/card]
I still think that Incantus's way of doing things is the best I've seen so far in terms of flexibility. It only has one drawback : if you change major things in your code, you might have to update all the cards ?
Does anybody know about Firemox's system ? I'm looking for some sort of documentation...to see how far their xml files allow to go...

Edit : the full "documentation" for wagic's cards is at : http://wololo.net/wagic/create-your-own-cards/ and the relevant files that parse all this sh*t are MTGAbility.cpp and TargetChooser.cpp , at http://code.google.com/p/wagic/
frwololo
DEVELOPER
 
Posts: 265
Joined: 21 Jun 2008, 04:33
Has thanked: 0 time
Been thanked: 3 times


Return to Magic Rules Engine Programming

Who is online

Users browsing this forum: No registered users and 12 guests


Who is online

In total there are 12 users online :: 0 registered, 0 hidden and 12 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 12 guests

Login Form