MagicWars 1.2.0 With Script Engine!
by nantuko84
Moderators: nantuko84, CCGHQ Admins
MagicWars 1.2.0 With Script Engine!
by nantuko84 » 08 Dec 2009, 17:29
Hi everyone!
I'd like to share with you what's happening with MagicWars and what will appear in new version that comes soon.
Along with many bugs fixes (and for sure new bugs
)), MagicWars 1.2.0 will have the following features:
1) Different Printings Support: you can add different versions of the same card (e.g. 2 copies of Shock Tenth Edition and 2 copies from Onslaught set) to your deck and see then in play
2) Script Engine: now you can create your own cards! read about this below
3) Basic AI: once you've added your card, you can try one of three decks to play with
Today I'd like to start cycle of topics here describing what Script Engine is and how to add new cards to MagicWars.
So what does Script Engine mean for players? It means that since now you can add new cards by yourself. No need to wait for new releases just to get to know whether a card you wanted to play so much online was added or not. All you need is just study groovy a little (really easy language) and read future articles. They would explain what should be done to create some specific cards, what API is available and, for sure, will bring some examples of existing cards.
Let's start with card description format today.
Card location
All scripted cards are stored in cards/groovy folders. As there can be too many cards in future, we separated them using first three letters of card names. So "Shock" will be stored in cards/groovy/S/h/o/Shock.card while "Goblin Guide" in cards/groovy/G/o/b/Goblin Guide.card.
We have already generated some cards for you to help you to create magic cards. They are saved in cards/todo/<SET_NAME>. They are not counted as implemented, so to start with you need to copy them from there to cards/groovy folder (with keeping in mind 3 letter structure: S/h/o/Shock).
Card data
Here is the card file for "Shock":
name
card name, nothing special to add here
only is that it should be the same as file name
types
includes card type and its sub types
card types are "Instant", "Sorcery", "Creature", "Artifact", "Planeswalker", "Enchantment", "Land"
sub type are additional info about card type
it may be "Equipment", "Aura", as well as "Merfolk", "Wolf", etc.
manacost
mana symbols devided by spaces and with slash for hybrid, examples:
"0", "2", "B B", "B\R", "3 B R G", "2 G\U"
text
oracle text
it can be used by script so it's better to divide them into several parts
prints
sets where this card was printed
you will see all of them in deck editor and can use any of them in your decks
print entry format:
["set code", "rarity", "multiverseId", "collectorId"]
set code should be official code of a set(you can find it here: http://en.wikipedia.org/wiki/Core_Sets)
rarity: "M","R","U" or "C"
multiverseId comes from gatherer for every card and should be unique even for the same card but from different sets http://gatherer.wizards.com/Pages/Default.aspx
collectorId can also be found in gatherer (it's an ordinal number in the set)
n.b. don't forget to put comma between several prints
script
the most important thing: script by itself
can be empty if card is so called "vanilla creature" - creature with static abilities only
there are also power and toughness for creatures
and not mandatory property color (by default card color is defined by its manacost)
That's it for today!
Finally I will give you an example how to fill data for vanilla creatures:
First opening gatherer Gatherer, type "Sky Ruin Drake" and press "Search"
it will open a card with such url:
http://gatherer.wizards.com/Pages/Card/ ... eid=192211
look at the number at the end, multiveseid, we will use it in prints:
["ZEN", "C", 192211, 66]
where 66 is collector number and can be found at the bottom:
Card #: 66
the final result will look like:
Then start MagicWars and you can try it!
See you
I'd like to share with you what's happening with MagicWars and what will appear in new version that comes soon.
Along with many bugs fixes (and for sure new bugs
![Wink ;)](./images/smilies/icon_wink.gif)
1) Different Printings Support: you can add different versions of the same card (e.g. 2 copies of Shock Tenth Edition and 2 copies from Onslaught set) to your deck and see then in play
2) Script Engine: now you can create your own cards! read about this below
3) Basic AI: once you've added your card, you can try one of three decks to play with
Today I'd like to start cycle of topics here describing what Script Engine is and how to add new cards to MagicWars.
So what does Script Engine mean for players? It means that since now you can add new cards by yourself. No need to wait for new releases just to get to know whether a card you wanted to play so much online was added or not. All you need is just study groovy a little (really easy language) and read future articles. They would explain what should be done to create some specific cards, what API is available and, for sure, will bring some examples of existing cards.
Let's start with card description format today.
Card location
All scripted cards are stored in cards/groovy folders. As there can be too many cards in future, we separated them using first three letters of card names. So "Shock" will be stored in cards/groovy/S/h/o/Shock.card while "Goblin Guide" in cards/groovy/G/o/b/Goblin Guide.card.
We have already generated some cards for you to help you to create magic cards. They are saved in cards/todo/<SET_NAME>. They are not counted as implemented, so to start with you need to copy them from there to cards/groovy folder (with keeping in mind 3 letter structure: S/h/o/Shock).
Card data
Here is the card file for "Shock":
- Code: Select all
name = "Shock"
types = ["Instant"]
manacost = "R"
text = ["Shock deals 2 damage to target creature or player."]
prints = [
["10E", "C", 129732, 232],
["9ED", "C", 83261, 220],
["8ED", "C", 45352, 222],
["7ED", "C", 13074, 219],
["6ED", "C", 14609, 206],
["STH", "C", 5143, 98],
["BTD", "C", 26645, 45],
["ONS", "C", 39482, 227]
]
script = '''\
addSpell({
dealDamage($target, 2, $this)
})
setTarget("Creature|Player")
'''
name
card name, nothing special to add here
only is that it should be the same as file name
types
includes card type and its sub types
card types are "Instant", "Sorcery", "Creature", "Artifact", "Planeswalker", "Enchantment", "Land"
sub type are additional info about card type
it may be "Equipment", "Aura", as well as "Merfolk", "Wolf", etc.
manacost
mana symbols devided by spaces and with slash for hybrid, examples:
"0", "2", "B B", "B\R", "3 B R G", "2 G\U"
text
oracle text
it can be used by script so it's better to divide them into several parts
- Code: Select all
addAbility({
$player.drawCard()
})
setDescription(text[2])
prints
sets where this card was printed
you will see all of them in deck editor and can use any of them in your decks
print entry format:
["set code", "rarity", "multiverseId", "collectorId"]
set code should be official code of a set(you can find it here: http://en.wikipedia.org/wiki/Core_Sets)
rarity: "M","R","U" or "C"
multiverseId comes from gatherer for every card and should be unique even for the same card but from different sets http://gatherer.wizards.com/Pages/Default.aspx
collectorId can also be found in gatherer (it's an ordinal number in the set)
n.b. don't forget to put comma between several prints
script
the most important thing: script by itself
can be empty if card is so called "vanilla creature" - creature with static abilities only
there are also power and toughness for creatures
and not mandatory property color (by default card color is defined by its manacost)
That's it for today!
Finally I will give you an example how to fill data for vanilla creatures:
First opening gatherer Gatherer, type "Sky Ruin Drake" and press "Search"
it will open a card with such url:
http://gatherer.wizards.com/Pages/Card/ ... eid=192211
look at the number at the end, multiveseid, we will use it in prints:
["ZEN", "C", 192211, 66]
where 66 is collector number and can be found at the bottom:
Card #: 66
the final result will look like:
- Code: Select all
name = "Sky Ruin Drake"
manacost = "4 U"
types = [ "Creature", "Drake" ]
power = 2
toughness = 5
text = ["Flying"]
prints = [
["ZEN", "C", 192211, 66]
]
Then start MagicWars and you can try it!
See you
Re: MagicWars 1.2.0 With Script Engine!
by telengard » 09 Dec 2009, 01:35
Sounds cool. How is the performance of Groovy as far as AI etc?
~telengard
~telengard
Author of Dreamblade:
viewtopic.php?f=51&t=1215
viewtopic.php?f=51&t=1215
-
telengard - DEVELOPER
- Posts: 379
- Joined: 23 May 2009, 23:04
- Has thanked: 2 times
- Been thanked: 27 times
Re: MagicWars 1.2.0 With Script Engine!
by nantuko84 » 09 Dec 2009, 07:30
performance for script:
now we have about 100 scripted cards, I didn't measure how much it takes to load only scripted cards, but all 650 cards are loaded by 1-2 sec.
but it is only if we are talking about card parameters loading that are described above (name,type,power,prints,etc.)
about card implementation scripts: this morning found out that GroovyEngine works much faster that GroovyShell we used before as it has cache for scripts loaded so decks containing several copies of the same card will be loaded faster. may be in future we will compile some cards into java classes, not sure at the moment
ai: it is early to talk about ai performance now, as it was initial state and ai is really basic. the main purposes of 1.2.0 was to make ai work in separate thread as second player. actually it is possible to make it acting as a bot, it will login and then click on any window as usual player does. moreover you can start two clients and run ai in both of them, then go for coffee or pop corn and enjoy them fighting with each other in different windows - you will see what they have at their hands, what they choose and so on
![Smile :)](./images/smilies/icon_smile.gif)
now we have about 100 scripted cards, I didn't measure how much it takes to load only scripted cards, but all 650 cards are loaded by 1-2 sec.
but it is only if we are talking about card parameters loading that are described above (name,type,power,prints,etc.)
about card implementation scripts: this morning found out that GroovyEngine works much faster that GroovyShell we used before as it has cache for scripts loaded so decks containing several copies of the same card will be loaded faster. may be in future we will compile some cards into java classes, not sure at the moment
ai: it is early to talk about ai performance now, as it was initial state and ai is really basic. the main purposes of 1.2.0 was to make ai work in separate thread as second player. actually it is possible to make it acting as a bot, it will login and then click on any window as usual player does. moreover you can start two clients and run ai in both of them, then go for coffee or pop corn and enjoy them fighting with each other in different windows - you will see what they have at their hands, what they choose and so on
![Smile :)](./images/smilies/icon_smile.gif)
Re: MagicWars 1.2.0 With Script Engine!
by Marek14 » 09 Dec 2009, 10:28
If someone was to implement things like D'Avenant Archer, No Mercy or O-Naginata, where would they go in the directory structure?
Re: MagicWars 1.2.0 With Script Engine!
by nantuko84 » 09 Dec 2009, 10:40
Good question, Marek14!Marek14 wrote:If someone was to implement things like D'Avenant Archer, No Mercy or O-Naginata, where would they go in the directory structure?
They should be saved in Dav, Nom and Ona folders, skipping all non letter symbols.
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 6 guests