Page 1 of 1

[Bug] Crash when starting game with very large deck

PostPosted: 30 Aug 2013, 02:25
by UnderFlow
Hi!

I have been experimenting with creating a deck that contains all cards available in Forge, plus a corresponding amount of basic lands (17962 cards total). Using the deck causes the game to crash in the starting player's upkeep. Mulliganing works. The following report was generated in a game where the AI started, but it also happens when the human player starts.

NullPointerException | Open
Code: Select all
Forge Version:    1.4.5-r22726
Operating System: Windows 7 6.1 x86
Java Version:     1.7.0_25 Oracle Corporation

java.lang.NullPointerException
   at forge.card.ability.AbilityUtils.getDefinedPlayers(AbilityUtils.java:709)
   at forge.card.TriggerReplacementBase.meetsCommonRequirements(TriggerReplacementBase.java:284)
   at forge.card.trigger.Trigger.requirementsCheck(Trigger.java:265)
   at forge.card.trigger.TriggerHandler.canRunTrigger(TriggerHandler.java:288)
   at forge.card.trigger.TriggerHandler.runNonStaticTriggersForPlayer(TriggerHandler.java:261)
   at forge.card.trigger.TriggerHandler.runWaitingTrigger(TriggerHandler.java:232)
   at forge.card.trigger.TriggerHandler.runTrigger(TriggerHandler.java:168)
   at forge.game.phase.PhaseHandler.onPhaseBegin(PhaseHandler.java:408)
   at forge.game.phase.PhaseHandler.startFirstTurn(PhaseHandler.java:960)
   at forge.game.GameAction.startGame(GameAction.java:1515)
   at forge.game.Match$1.run(Match.java:103)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Using a 2000 card deck does not cause the crash.

Link to the deck: https://dl.dropboxusercontent.com/u/5988273/AllCards.zip

Re: [Bug] Crash when starting game with very large deck

PostPosted: 30 Aug 2013, 09:01
by gos
. Thoughtbound Primoc causes this behavior. Possibly other cards may as well, but you can start by removing that card and see if it fixes things.

Re: [Bug] Crash when starting game with very large deck

PostPosted: 30 Aug 2013, 16:20
by UnderFlow
Thanks! I don't have time right now, but I will try to get it working and report back next week.

Re: [Bug] Crash when starting game with very large deck

PostPosted: 30 Aug 2013, 20:17
by Zirbert
I just wanted to thank you specifically for posting a link to the deck! I've occasionally started to compile such a beast in the deck editor, but always got bored partway though clicking "Add 4" 10,000+ times, and never quite figured out an easier way.

-Zirbert, Frequent Overlooker of the Obvious

Re: [Bug] Crash when starting game with very large deck

PostPosted: 01 Sep 2013, 22:17
by UnderFlow
The cause of the bug indeed appears to be Thoughtbound Primoc, along with Wild Mammoth that seems to use the same code. I have updated the downloadable version (https://dl.dropboxusercontent.com/u/5988273/AllCards.zip) to not include them. I have also removed Safe Haven (triggers from the library) and added the Java source code for generating the deck to the zip file for the interested (very Quick and Dirty, may cause eye-bleeding in seasoned programmers).


Zirbert wrote:I've occasionally started to compile such a beast in the deck editor, but always got bored partway though clicking "Add 4" 10,000+ times, and never quite figured out an easier way.
I got all the way to D until I noticed that I could write a program. :D

Re: [Bug] Crash when starting game with very large deck

PostPosted: 02 Sep 2013, 15:19
by gos
. Thoughtbound Primoc fixed in 1.4.7 :)

Re: [Bug] Crash when starting game with very large deck

PostPosted: 08 Sep 2013, 16:28
by cliffburton18
Description: [Yup, I also was trying to start a game with all cards in the game on both decks. Also, for those getting bored selecting all the cards, try holding "shift" while selecting the first and last line (just like in excel) :D

OutOfMemoryError | Open
Code: Select all
Forge Version:    1.4.6-r22922
Operating System: Windows 7 6.1 x86
Java Version:     1.7.0_15 Oracle Corporation

java.lang.OutOfMemoryError: Java heap space
   at java.util.ArrayList.<init>(Unknown Source)
   at java.util.ArrayList.<init>(Unknown Source)
   at forge.Card.<init>(Card.java:115)
   at forge.card.cardfactory.CardFactory.readCard(CardFactory.java:362)
   at forge.card.cardfactory.CardFactory.getCard(CardFactory.java:236)
   at forge.card.cardfactory.CardFactory.getCard(CardFactory.java:231)
   at forge.item.PaperCard.toForgeCard(PaperCard.java:211)
   at forge.game.GameNew.preparePlayerLibrary(GameNew.java:130)
   at forge.game.GameNew.newGame(GameNew.java:253)
   at forge.game.Match.startGame(Match.java:90)
   at forge.control.FControl.startGameWithUi(FControl.java:397)
   at forge.gui.home.sanctioned.CSubmenuConstructed$6.run(CSubmenuConstructed.java:135)
   at java.awt.event.InvocationEvent.dispatch(Unknown Source)
   at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
   at java.awt.EventQueue.access$200(Unknown Source)
   at java.awt.EventQueue$3.run(Unknown Source)
   at java.awt.EventQueue$3.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.run(Unknown Source)