zerker2000 wrote:Cards are stored as forge.Card objects, in heap. To 'plug an engine in', one would remove all/most variables (except uniqueNumber) from that class, and point the getter/setter methods to the database.
i don't think that is the right approach. we still need Card instances in memory so that they can be differentiated from one another. for example, one card {permanent} has counters on it, and the other does not.
the main features of a relational database are

to provide and edit information that is shared among
multiple clients, and

to provide a
powerful query language to as few as one client. i do not think it wise to try to replace Card instances with rows in a table. we have to make them instances at
some point in order to manipulate them in the java programming language. pulling them in and out of a database row would add unnecessary complexity and would hamper performance.
i can't think of a good reason why we would be interested in feature

. i don't think we want to centralize all oracle card information to a cloud of relational database systems for access by multiple clients. it's easier just to release new batches of card txt files with forge upgrade.
reason

would be interesting. we would have the only mtg relational database i know of.
- Code: Select all
select name from all_cards
where text like "%enters the battlefield%" and (color = "W" or color = "B");
but how many of our users know how to write sql queries like this? this sounds like it would be more suited as a (very handy) separate web-based service, rather than part of forge itself.
Rob Cashwalker wrote:There's a lot more to a Card object than just text and numbers, which is where the database could come in handy. The Card object contains ability objects which provide functionality, those abilities are generated during runtime during loading. Those objects couldn't be stored in a database.
yes. i agree.
Rob Cashwalker wrote:Use of a database would streamline display of the deck editor and its filtering features. However it would still need to be populated somewhat dynamically, since the card.txt file can be modified at anytime, and we don't want to maintain a single file with all cards.
i don't see much of a point in keeping both a database and a set of txt files around.
the deck editor's filters could be streamlined by moving from CardLists to Generators. if you want proof, try looking up a card by a substring in its name using the Filter menu in the deck editor. it is
Blightning fast.
beware, it may leave your deck editor in an unresettable state. i would have converted more CardList uses to Generator in there, but the code was very entwined with the CardList implementation in its fields, etc.
i do understand that a deck editor needs to slurp a generator into a CardList at some point in order to be able to do sorting. but if we can apply as many filters as possible before doing that, it would really speed things up.
Edit: as marked.