Planechase multiplayer crash/hang when planeswalking with auto-generated planar decks
- Dominant language
- Java
- Stars
- 2.7k
- Forks
- 1.1k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 163
Description
[forge.log](https://github.com/user-attachments/files/31897576/forge.log)
In a 4-player Commander Planechase game with 3 AI opponents, the game can become permanently stuck when a player planeswalks.
Java CPU usage drops to ~0%, so this does not appear to be an AI evaluation loop. The game thread throws an IndexOutOfBoundsException inside Player.planeswalk(), apparently attempting to access index 0 of an empty zone/list.
I was using an automatically generated Planechase deck. I am not sure whether Forge generated valid planar decks/zones for all AI opponents.
**Relevant exception**
```
java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
at java.base/java.util.ArrayList.get(ArrayList.java:427)
at forge.util.collect.FCollection.get(FCollection.java:409)
at forge.game.zone.Zone.get(Zone.java:206)
at forge.game.player.Player.planeswalk(Player.java:2655)
at forge.game.ability.effects.PlaneswalkEffect.resolve(PlaneswalkEffect.java:48)
```
**Steps to reproduce**
1. Start a 4-player Commander game.
2. Enable Planechase.
3. Use an auto-generated/random Planechase deck.
4. Add 3 AI opponents.
5. Play normally and planeswalk.
6. Eventually a planeswalk fails to complete and the game becomes stuck.
7. The next plane is never revealed.
**Observed behavior**
The game stops progressing after the planeswalk begins.
Java shows effectively 0% CPU usage while stuck.
forge.log contains the IndexOutOfBoundsException above.
The error occurred more than once in the same session after different active planes, so it does not appear to be tied to one specific plane.
Examples seen in the log include:
`Miranda planeswalks to [Minamo (514)]`
followed later by the crash in Player.planeswalk().
A separate occurrence happened while The Lux Foundation Library (307) was active.
**Expected behavior**
Forge should select/reveal the next plane and continue the game. If a player's planar deck/zone is empty, Forge should either regenerate/recycle it or handle the empty zone gracefully rather than throwing an exception.
_Possible cause_
It looks like Player.planeswalk() calls Zone.get(0) on an empty planar zone. Since I used an auto-generated Planechase deck, it may be possible that one or more AI opponents did not receive a properly populated planar deck/zone.
**Environment**
Desktop
Windows 11
4-player Commander
Planechase enabled
1 human + 3 AI
Auto-generated/random Planechase deck
**Additional information**
Full forge.log available and includes repeated instances of:
Game-XX > java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
...
at forge.game.player.Player.planeswalk(Player.java:2655)
Contributor guide
Research direction
Start with forge.game.player.Player.planeswalk() around line 2655, then trace the empty-zone access through forge.game.zone.Zone.java and forge.game.ability.effects.PlaneswalkEffect.java. Reproduce the four-player Commander Planechase scenario with an auto-generated deck and inspect forge.log. Done means the next plane is revealed and the game continues without an IndexOutOfBoundsException when a planar zone is empty.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100