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

I'm developing a rules enforcement system, need help

General Discussion of the Intricacies

Moderator: CCGHQ Admins

Re: I'm developing a rules enforcement system, need help

Postby Jonix » 19 Aug 2009, 11:09

Ignore my last question, I figured that abilities like "all creatures you control gain +1/+1" give advantages whith each copy made.
Jonix
 
Posts: 43
Joined: 27 May 2009, 17:27
Has thanked: 2 times
Been thanked: 2 times

Re: I'm developing a rules enforcement system, need help

Postby frwololo » 20 Aug 2009, 04:04

Just a remark out of my personal experience:
There are very good engines out there, but a good simulator does not necessarily mean a good gaming experience.

So I disagree when people say you should perfectly understand the comprehensive rules before starting coding...

I actually think the comprehensive rules themselves ARE the engine (I mean, they are so precise that if you want to have a perfect engine, you just have to translate them into code - I'm not saying it is easy)

So in the end, you have a perfect magic simulation with rules enforcement... then what? Who will use it if you have no graphics, no network, no AI, who will use it if it's only an engine ?

For network games for example, people use software such as MWS because it does not do any rules enforcement, and therefore does not need to be updated whenever a new version of the comprehensive rules gets out. Programs that do rules enforcement cannot be always up to date and we have to live with that.

My point being that rather than looking for rules perfection and 100% cards coverage, you should think about what you want to do with your game. Coding the engine alone might take 2 years, but nobody's gonna play it if it has no user interface. So that will be 2 years of work for nothing (except the fun of creating the engine, which I agree is quite worth it already)
You say you are not a programmer, so try to start small is what I'm saying.

MTG Forge and Wagic are quite successful despite not respecting the rules entirely.
frwololo
DEVELOPER
 
Posts: 265
Joined: 21 Jun 2008, 04:33
Has thanked: 0 time
Been thanked: 3 times

Re: I'm developing a rules enforcement system, need help

Postby Marek14 » 20 Aug 2009, 08:05

I think that since there are multiple projects these days, everyone can concentrate on the one thing that interests him the most. Good rules engine doesn't really need an user interface - it's UI-independent, it can treat UI as a black box that it sends information to and receives information from. The development of UI is completely different thing.

Anyways, even if the rules engine is developed "on the run", i.e. gradually, there still has to be an overall plan. Some things are simply very hard to do if they are not taken into account from the beginning. Artificial Evolution is easy if you prepare for it - very hard if you don't. If you plan to introduce exotic mana, you'd better have more complex structure of mana pool from the beginning so you wouldn't have to change it later (i.e. have each point of mana as separate object instead of just having a set of six numbers and calling it "mana pool"). If you want to have replacement effects, you have to think about their implementation. If you want Reflecting Pool and Exotic Orchard, you'd better start thinking from the beginning how it's supposed to work, and how to stop infinite loops of checking in case two of them are in play... If you want to have split cards and flip cards and have them working correctly, the basic architecture must be robust enough to support them (for example anything that works with converted mana cost must know what to do if it gets fed two CMC's at once).

With the amount of programs today, a new program is an opportunity to look at where the major problems were so far, and attempt to avoid them. Manalink is almost perfect in its execution, but it's plagued by problems stemming from its legacy code, I think MagMa has similar problems. MTG Forge is basically a fractal implementation (i.e. it comes closer and closer to real thing), but it looks like some old problems grew to the size when they are basically impossible to correct (like the impossibility of letting the computer start). Incantus was the closest in rules implementation (until the darn M10 threw a wrench in the gears, I didn't have much info since then), but it still needs to change some things, and the recoding to make it perfect might be massive :( Botarena might be the one to watch for because of it's frequent updates, but I didn't play too much with it.

(As for Wagic, I used it even less than BotArena, so I am not really sure where it stands.)

So if someone wants to put rules first, no problem. He'll avoid some of the problems. The community can take it.
Marek14
Tester
 
Posts: 2759
Joined: 07 Jun 2008, 07:54
Has thanked: 0 time
Been thanked: 296 times

Re: I'm developing a rules enforcement system, need help

Postby Jonix » 20 Aug 2009, 08:21

Let me clear things out.

Like I said, I'm no programmer. I have no intention of creating an engine. My goal is to "convert" CompRules into a system suitable for implementation in real software (if anyone ever would want to make one).

So, basically my system will extend the Comp Rules in way so it is very precise and clear, so that if anyone would use this system as a base for their program they will not have to hardcode too many cards (if any).

Generally, my system is a "translation" of the rules into a "language" any programmer can understand. Also, another important goal is to achieve maximum user-frienlyness.

And, of course, I do it for pure fun. I love Magic and anything related to it, so I really want to make a contribution.
Jonix
 
Posts: 43
Joined: 27 May 2009, 17:27
Has thanked: 2 times
Been thanked: 2 times

Re: I'm developing a rules enforcement system, need help

Postby mtgrares » 21 Aug 2009, 17:17

MTG Forge is basically a fractal implementation (i.e. it comes closer and closer to real thing), but it looks like some old problems grew to the size when they are basically impossible to correct (like the impossibility of letting the computer start).
Yes thats about right, lol. MTG Forge is my baby and only implements "simple" rules and doesn't even have power/toughness layers, well just a 2 layer system I think. It is a little over 1,800 cards including planeswalkers but we haven't tried to code the new M10 rules. In my mind MTG Forge just implements the "bare bones" needed to play Magic, at first it didn't even have a mana pool.
mtgrares
DEVELOPER
 
Posts: 1352
Joined: 08 Sep 2008, 22:10
Has thanked: 3 times
Been thanked: 12 times

Re: I'm developing a rules enforcement system, need help

Postby Jonix » 08 Oct 2009, 08:59

Ok, just checking in. The project is not postponed, though I had hardly any progress, since I've been very busy at work.

Hopefully, soon you will see some progress. Most likely, it will be in a form of wiki, so anyone can contribute to the project.
Jonix
 
Posts: 43
Joined: 27 May 2009, 17:27
Has thanked: 2 times
Been thanked: 2 times

Re: I'm developing a rules enforcement system, need help

Postby zerker2000 » 14 Oct 2009, 03:48

mtgrares wrote:at first it didn't even have a mana pool.
Marek14 wrote: instead of just having a set of six numbers and calling it "mana pool"
I feel these quotes are connected somehow :P(for those who haven't seen forge code, the mana pool is basically a card with a six int array representing mana contents).
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.


--Eladamri, the Seed of Freyalise
zerker2000
Programmer
 
Posts: 569
Joined: 09 May 2009, 21:40
Location: South Pasadena, CA
Has thanked: 0 time
Been thanked: 0 time

Re: I'm developing a rules enforcement system, need help

Postby Marek14 » 14 Oct 2009, 06:06

zerker2000 wrote:
mtgrares wrote:at first it didn't even have a mana pool.
Marek14 wrote: instead of just having a set of six numbers and calling it "mana pool"
I feel these quotes are connected somehow :P(for those who haven't seen forge code, the mana pool is basically a card with a six int array representing mana contents).
It's not any inside knowledge. It's simply that six-int array is the simplest implementation, but not sufficient for some more complex cards.
Marek14
Tester
 
Posts: 2759
Joined: 07 Jun 2008, 07:54
Has thanked: 0 time
Been thanked: 296 times

Re: I'm developing a rules enforcement system, need help

Postby Incantus » 15 Oct 2009, 00:40

Marek14 wrote:It's not any inside knowledge. It's simply that six-int array is the simplest implementation, but not sufficient for some more complex cards.
Yeah, that's what Incantus does.
Incantus
DEVELOPER
 
Posts: 267
Joined: 29 May 2008, 15:53
Has thanked: 0 time
Been thanked: 3 times

Re: I'm developing a rules enforcement system, need help

Postby Marek14 » 15 Oct 2009, 07:48

Incantus wrote:
Marek14 wrote:It's not any inside knowledge. It's simply that six-int array is the simplest implementation, but not sufficient for some more complex cards.
Yeah, that's what Incantus does.
Still? :) Haven't had contact with the incantus group for some time :(
Marek14
Tester
 
Posts: 2759
Joined: 07 Jun 2008, 07:54
Has thanked: 0 time
Been thanked: 296 times

Re: I'm developing a rules enforcement system, need help

Postby frwololo » 19 Oct 2009, 00:57

Wagic also uses such an array. Problems arise when you start to have "specialized" mana that can only be used for ...
frwololo
DEVELOPER
 
Posts: 265
Joined: 21 Jun 2008, 04:33
Has thanked: 0 time
Been thanked: 3 times

Re: I'm developing a rules enforcement system, need help

Postby telengard » 20 Oct 2009, 03:18

I had a generic number type pool in my app too at first.

What I had to do was have generic mana and then "encumbered" mana. The encumbered mana would have condition objects that were applied (i.e. can only be used for X) and also a one_shot flag (i.e. can only be used towards a single X). The AI will always end up using the encumbered first the way it currently plays (which in some very corner cases might not be optimal, esp with the one-shot).

(I simplified the above by using the word mana, my game, Dreamblade, has "spawn points" but they pretty much do the same thing).

~telengard
Author of Dreamblade:
viewtopic.php?f=51&t=1215
User avatar
telengard
DEVELOPER
 
Posts: 379
Joined: 23 May 2009, 23:04
Has thanked: 2 times
Been thanked: 27 times

Re: I'm developing a rules enforcement system, need help

Postby mtgrares » 10 Dec 2009, 21:03

frwololo wrote:Wagic also uses such an array. Problems arise when you start to have "specialized" mana that can only be used for ...
The mana pool is insane once you start thinking about snow mana and other stuff. A few cards have something like "Can only spend this mana on creatures", or Imperiosaur.

So your mana pool is transformed into ints and associated details (maybe just a string).
mtgrares
DEVELOPER
 
Posts: 1352
Joined: 08 Sep 2008, 22:10
Has thanked: 3 times
Been thanked: 12 times

Re: I'm developing a rules enforcement system, need help

Postby Jonix » 15 Dec 2009, 15:23

Another thing, if a card has a creature sacrifice as an additional casting cost, will the "sacrifice" ability of the sacrificed card trigger?

Example: player casts Bone Splinters. As an additional cost player sacrifices Aerie Ouphes. Will the ability of the Aerie Ouphes trigger?
Jonix
 
Posts: 43
Joined: 27 May 2009, 17:27
Has thanked: 2 times
Been thanked: 2 times

Re: I'm developing a rules enforcement system, need help

Postby Marek14 » 15 Dec 2009, 15:37

Jonix wrote:Another thing, if a card has a creature sacrifice as an additional casting cost, will the "sacrifice" ability of the sacrificed card trigger?

Example: player casts Bone Splinters. As an additional cost player sacrifices Aerie Ouphes. Will the ability of the Aerie Ouphes trigger?
Yes, but not the ability you mean.

The sacrifice ability of Aerie Ouphes is an activated ability, and this very fact means it NEVER triggers (only triggered abilities do that). If you want to use it, you have to announce it, and sacrifice Aerie Ouphes as its cost.

Aerie Ouphes's persist, on the other hand, is a triggered ability, and that WILL trigger when you sacrifice it (provided other conditions are met).

There is Savra, Queen of the Golgari and Thraximundar, which DO have abilities that specifically trigger on sacrificing something.
Marek14
Tester
 
Posts: 2759
Joined: 07 Jun 2008, 07:54
Has thanked: 0 time
Been thanked: 296 times

PreviousNext

Return to Magic Rules Engine Programming

Who is online

Users browsing this forum: No registered users and 9 guests


Who is online

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

Login Form