Want to help ?

Do not post feature requests here, please.
Before posting bugs report check the Image Bug reporting help & guidelines
Forum rules
Do not post Features/Improvments request here (i.e : AI being stupid is not a bug, not being able to do a mulligan is not a bug, etc..etc..)
Before posting, please read the Bugs reporting guideline
xienwolf
Posts: 2
Joined: Wed Jul 15, 2009 2:57 pm

Re: Want to help ?

Post by xienwolf »

I've just recently stumbled upon this and I must say it is quite lovely. I started in on Magic a long time ago and no other CCG has quite lived up to it, especially in computerized mode (I'm looking at you YuGiOh!).

Anyway, I am rather adept at C++ modding, but not raw code mechanics just yet. I've done rather extensive work modding Civilization recently. I was annoyed by a few of the current bugs and limitations so started to look at modding this code to live up to my ideals when I saw how you load the data. I am curious why you chose .dat files in the relatively strange format which is used here instead of XML. I admit I am mostly just comfortable with XML at this point, but it would really seem that the structure of Magic Cards would lend itself quite nicely to XML data storage and loading. True once you have the data loaded everything would work just the same for mechanics, so it is mostly a style/readability/moddability issue. So I am just curious if you had a choice, and if so, why this one?
wololo
Site Admin
Posts: 3728
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: Want to help ?

Post by wololo »

Nice question.
The main reason I didn't use XML at first was because I didn't have a parsing lib. It was easier in terms of programming when I started the project to have a simple plain text file.
Another big issue with the xml format is that it is annoyingly verbose. It makes it not efficient to parse for the CPU, and speed is a factor on the PSP. It is not even easier to read for a human being.

I have nothing against xml specifically, but unless I am given good examples of what it could achieve better than a simple .ini file for magic cards, I wouldn't see any good reason to switch to it.
Firemox uses XML to describe its cards, and it is awfully verbose and unnecessarily complex.
In some cases, the cards in Firemox reach a complexity where it clearly shows that they should've used a scripting language such as Python or Lua, but not XML.

My point being: if we want to soft-code complex cards, this should be done with a scripting language, and not with XML. And for simple cards, XML is over the top:
<?xml version="1.0" encoding="ISO-8859-1"?>
<card xmlns="http://sourceforge.net/projects/firemox"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://sourceforge.net/projects/firemox ../../validator.xsd"
name="Angel of Light">
<rules-author-comment>riclas</rules-author-comment>
<init>
<registers>
<register index="white" value="1"/>
<register index="colorless" value="4"/>
<register index="power" value="3"/>
<register index="toughness" value="3"/>
</registers>
<colors>white</colors>
<idcards>creature</idcards>
<properties>vigilance flying angel</properties>
</init>
<abilities>
<ability ref="cast-spell"/>
</abilities>
</card>
here's the equivalent in Wagic:
[card]
name=Angel of Light
mana={4}{W}
power=3
toughness=3
type=Creature
subtype=angel
abilities=vigilance,flying
[/card]
Sure, less flexibility, but also less noise.

I've been thinking a lot about using Lua to code some complex cards... I haven't given up on the idea, but it is definitely not a priority.
xienwolf
Posts: 2
Joined: Wed Jul 15, 2009 2:57 pm

Re: Want to help ?

Post by xienwolf »

I vaguely recalled XML being more in-depth than what I have grown accustomed to over the last 2 years with Civilization. I'm not sure precisely what they have done behind the scenes to simplify things, but what I pictured was along these lines:

Code: Select all

<?xml version="1.0"?>
<WTHCardData xmlns="x-schema:WTHCardSchema.xml">
<CardInfos>
	<CardInfo>
		<Ident>ANGEL_OF_LIGHT</Ident>
		<ID>341</ID>	<!-- I don't actually know the ID number for this card -->
		<Desc>Angel of Light</Desc>
		<Costs>
			<Any>4</Any>
			<White>1</White>
		</Costs>
		<Power>3</Power>
		<Toughness>3</Toughness>
		<Types>
			<Type>TYPE_CREATURE</Type>
		</Types>
		<SubTypes>
			<SubType>SUBTYPE_ANGEL</SubType>
		</SubTypes>
		<bFlying>1</bFlying>
		<bVigilance>1</bVigilance>
	</CardInfo>
</CardInfos>
The schema would allow for a large variety of other tags to be utilized, each of which indicating a particular ability on the card. As new cards come out with specialized rules you would attempt to quantify them as an integer or boolean type and make a new tag, changing the name to match the cards whenever they finally name the ability. And for conditional type of abilities you can set up a set of condition definitions to link the abilities to more readily, since many links are rather similar (when attacking, if ___ is owned by you/opponent...)
wololo
Site Admin
Posts: 3728
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: Want to help ?

Post by wololo »

et_phone_home wrote: 1color random created deck VS 1color random created deck.
2 random colors created deck VS 2 random colors created deck.
Just so you know, these two modes have been added to Wagic.
Together they are called the "Random Deck" Mode, and it needs to be unlocked. See the faq to know how to unlock it. Have fun :)
exra
Posts: 8
Joined: Wed Nov 04, 2009 8:22 pm

Re: Want to help ?

Post by exra »

im not sure if this is where i should put this but here it goes.

im currently working on a patch for cards that have for example:

At the beginning of your upkeep, if your opponent has more than 10 life then you lose 1 life. (Vampire Lacerator)

What is the easiest way to get the opponents life total?

Thanks, Exra
wololo
Site Admin
Posts: 3728
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: Want to help ?

Post by wololo »

exra wrote: What is the easiest way to get the opponents life total?
where "source" is a MTGCardInstance, source of the ability:
source->controller->opponent()->life

you'll probably have more luck discussing this here though: viewtopic.php?f=14&t=378
Echo12
Posts: 22
Joined: Sat Nov 28, 2009 10:43 am
Location: Philippines & Singapore
Contact:

Re: Want to help ?

Post by Echo12 »

et_phone_home wrote:
I myself am creating a game based in MTG, but more on a Battle/solitaire base. But it is now in stand by because I'm ending programming another amazing game:) than I'll be back to end this one that is one a very advance stage. I'm just adding more cards.

Can check some screenshots.


Image

Image

Image
Woah! Nice looking game you're creating here. Is this for the PC or PSP? Hope you can share after you finish it. I'll be looking forward for this. :P
Ispayk
Posts: 2
Joined: Sun Dec 20, 2009 8:45 am

Re: Want to help ?

Post by Ispayk »

Wololo,

Just recently stumbled upon this site of yours from a PSP website, and I'm really humbled by the sheer beauty of having an MTG game in my PSP. Thanks to you and to all your comrades for your combined efforts to deliver this kind of open source MTG game. I myself is a programmer and would like to try and contribute to this project. Any download of the complete source in C++ where I can get it so I can study how your engine is working? Visited the googlecode site but I would gladly like to download if possible just the whole source in let's say one archived file in zip or rar. And if possible a description of how the engine works (e.g. a flowchart of somekind how the engine(parser) behaves together with the name of the file involved, let's say the main file is wagic.cpp calling all those involved functions etc...) Just to cope up to the behavior of the engine and how it really works. Thanks in advance and more power to the project!
wololo
Site Admin
Posts: 3728
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: Want to help ?

Post by wololo »

Hi Ispayk, we don't have an archive of the sources, rather, we use SVN which is way more convenient. Download a svn client such as tortoise svn (or use the default one if you have linux) and checkout from: http://wagic.googlecode.com/svn/trunk/
It will guarantee that you always have the latest version of the code.

I don't have any documentation for the code yet. Everything's been going very fast, and everything still changes a lot in the engine. If you have specific questions on the engine (how the graphics work, how JGE works, of the cards abilities work...) I'll gladly answer them though.
Ispayk
Posts: 2
Joined: Sun Dec 20, 2009 8:45 am

Re: Want to help ?

Post by Ispayk »

Ok thanks! I'll try that out. ;)
Locked