Page 3 of 3
Re: Cleanup and hoping to increase performance

Posted:
01 Aug 2012, 17:43
by Max mtg
I am not that confident about the Rob's idea of learning winning strategies from people playing forge.
If someone does not like "svar" in front of "deckwants", it's ok to is just keep "DeckWants:" in card scripts. As long as its about pointing at some favourable cards, that would be enough.
There is a routine to filter CardLists in DeckWants class - it might be a good idea to replace it with a predicate lazy builder.
Re: Cleanup and hoping to increase performance

Posted:
01 Aug 2012, 17:52
by mcrawford620
Yeah, I'll try to rewrite the DeckWants; the tests make it pretty easy to do so. It definitely can live in the CardPrinted instead of the Card since it would never be needed during a game.
I'd never heard of Predicates before so that's all new. I think I'm getting the hang of it, though.
Re: Cleanup and hoping to increase performance

Posted:
01 Aug 2012, 18:05
by Max mtg
friarsol wrote:Looks like cards that start in play via Quests aren't being run through the cardfactory creation.
Eladamri's Vineyard isn't triggering at all from the Green Medium Quest. If I cast a Vineyard in constructed play, it triggers just fine.
fixed in r16400, though it was not related to Card lazy loading at all.
Re: Cleanup and hoping to increase performance

Posted:
02 Aug 2012, 07:16
by Max mtg
I made some more fixes regarding memory allocation mainly
The slowest part by now is really the GUI. See the picture below
Re: Cleanup and hoping to increase performance

Posted:
02 Aug 2012, 15:38
by Chris H.
I launched today's snapshot build by double clicking on the jar file rather than using the launcher. Forge launched without an increased java heap space.
I played a quick game and spent a little time in the deck editor. I did not get a java heap space error.

Re: Cleanup and hoping to increase performance

Posted:
02 Aug 2012, 19:45
by mcrawford620
Right now I'm getting this error when trying to add lands to the LimitedDeck:
- Code: Select all
java.util.NoSuchElementException: Asked for card 'Swamp' from 'ARN': set found, but the card wasn't. :(
at forge.item.CardDb.getCard(CardDb.java:281)
at forge.item.CardDb.getCard(CardDb.java:254)
at forge.game.limited.LimitedDeck.addLands(LimitedDeck.java:245)
Probably it was not being done the right way, but here's what it says:
- Code: Select all
final CardPrinted cp = CardDb.instance().getCard(clrCnts[i].getColor(), aiPlayables.get(0).getEdition());
What should I do there instead?
Re: Cleanup and hoping to increase performance

Posted:
02 Aug 2012, 20:41
by Sloth
mcrawford620 wrote:Right now I'm getting this error when trying to add lands to the LimitedDeck:
- Code: Select all
java.util.NoSuchElementException: Asked for card 'Swamp' from 'ARN': set found, but the card wasn't. :(
at forge.item.CardDb.getCard(CardDb.java:281)
at forge.item.CardDb.getCard(CardDb.java:254)
at forge.game.limited.LimitedDeck.addLands(LimitedDeck.java:245)
Probably it was not being done the right way, but here's what it says:
- Code: Select all
final CardPrinted cp = CardDb.instance().getCard(clrCnts[i].getColor(), aiPlayables.get(0).getEdition());
Why don't you use this?
- Code: Select all
final CardPrinted cp = CardDb.instance().getCard(clrCnts[i].getColor());
If aiPlayables.get(0) comes from a set without basic lands, the getCard you've used has to fail.
Re: Cleanup and hoping to increase performance

Posted:
02 Aug 2012, 20:47
by mcrawford620
Sloth wrote:Why don't you use this?
- Code: Select all
final CardPrinted cp = CardDb.instance().getCard(clrCnts[i].getColor());
If aiPlayables.get(0) comes from a set without basic lands, the getCard you've used has to fail.
That's better, thanks. I think the original intent was to keep the "look" of the lands the same as the rest of the limited deck, pulling them from the same set. But also I didn't know what I was doing.

Is there a way to tell if a set has basic lands?
Re: Cleanup and hoping to increase performance

Posted:
02 Aug 2012, 22:02
by Max mtg
mcrawford620 wrote:Is there a way to tell if a set has basic lands?
- Check isCardSupported(name, set) function to test card's presence in db.
- Obtain a cardPrinted (from any set), then get CardRules and learn which sets contain the card (getSetsPrinted() )
- FModel.editions has all editions with indices so that you can compare them and find the latest one but not exceeding ARN (or other target edition)
Re: Cleanup and hoping to increase performance

Posted:
03 Aug 2012, 19:37
by Max mtg
mcrawford620, please note that LimitedDeck class and its descendants do provide only some methods to build up a deck. They do not extend deck's functionality but rather act as a separate agent, who can be given a number of cards and return a deck.
This is why I removed base class of Deck from your LimitedDeck class.
Instead BuildDeck method is public now and returns a deck, and it is no called by constructor automatically.
I am sorry for having interferred into your code.
Re: Cleanup and hoping to increase performance

Posted:
03 Aug 2012, 19:48
by mcrawford620
You're right, I should not have extended Deck. Thanks for cleaning it up. No apology needed!