Why Forge Swing GUI is currently hold with duct tape
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Why Forge Swing GUI is currently hold with duct tape
by Snacko » 12 Jul 2011, 08:45
Swing is single threaded, this means every creation / manipulation of Swing objects has to be done on the even dispatch thread.
This has a heavy implication that you dont bog down the even dispatch thread with heavy computation or the GUI wont update. The exact example of this done wrong is the progress bar which doesn't update if you move it around, but just smears.
Currently as a duct tape fix the whole Forge code runs on the even dispatch queue!
To disable the tape fix you have to comment the code in Gui_NewGame.java
The good course of action would be to fix this at some point. I'm just leaving it here for anyone wanting to do any GUI work on Forge.
You can read more here :
basically you need to use invokeLater or SwingWorker
http://www.javaworld.com/javaworld/jw-0 ... tml?page=1
This has a heavy implication that you dont bog down the even dispatch thread with heavy computation or the GUI wont update. The exact example of this done wrong is the progress bar which doesn't update if you move it around, but just smears.
Currently as a duct tape fix the whole Forge code runs on the even dispatch queue!
To disable the tape fix you have to comment the code in Gui_NewGame.java
- Code: Select all
SwingUtilities.invokeLater(new Runnable() {
public void run() {
AllZone.setComputer(new ComputerAI_Input(new ComputerAI_General()));
new Gui_NewGame();
}
});
The good course of action would be to fix this at some point. I'm just leaving it here for anyone wanting to do any GUI work on Forge.
You can read more here :
basically you need to use invokeLater or SwingWorker
http://www.javaworld.com/javaworld/jw-0 ... tml?page=1
Re: Why Forge Swing GUI is currently hold with duct tape
by friarsol » 12 Jul 2011, 12:02
Thanks for the Notes Snacko, but I slightly disagree. The good course of action is to nuke it all and start from scratch. Our UI needs a major makeover.Snacko wrote:The good course of action would be to fix this at some point. I'm just leaving it here for anyone wanting to do any GUI work on Forge.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Why Forge Swing GUI is currently hold with duct tape
by Braids » 15 Jul 2011, 18:07
if we could implement more of the UI in terms of (a list of?) decisions you or the AI can make at this moment and the effects of each of these decisions, this would greatly help minimax.
do we need a separate View layer? (as in Model View Controller)
do we need a separate View layer? (as in Model View Controller)
"That is the dumbest thing I've ever seen." --Rob Cashwalker, regarding Innistrad double-sided cards. One of the first times he and I have ever agreed on something.
-
Braids - Programmer
- Posts: 556
- Joined: 22 Jun 2011, 00:39
- Location: Unknown. Hobby: Driving myself and others to constructive madness.
- Has thanked: 1 time
- Been thanked: 1 time
Re: Why Forge Swing GUI is currently hold with duct tape
by Braids » 17 Aug 2011, 19:03
i'm rewriting some of the UI startup code. thanks for the pointer, Snacko. i should be able to avoid the pitfall you describe during the execution of my new code. well, it's a start. better than nothing.
@Snacko, could you review my code once i've committed it? if i don't hear from you, i'll try to PM you after the commit.
@Snacko, could you review my code once i've committed it? if i don't hear from you, i'll try to PM you after the commit.
"That is the dumbest thing I've ever seen." --Rob Cashwalker, regarding Innistrad double-sided cards. One of the first times he and I have ever agreed on something.
-
Braids - Programmer
- Posts: 556
- Joined: 22 Jun 2011, 00:39
- Location: Unknown. Hobby: Driving myself and others to constructive madness.
- Has thanked: 1 time
- Been thanked: 1 time
Re: Why Forge Swing GUI is currently hold with duct tape
by Snacko » 17 Aug 2011, 21:52
Pm me after commit as I don't follow commits very closely.
Re: Why Forge Swing GUI is currently hold with duct tape
by cuhnkedrik » 10 Oct 2023, 01:43
Minimax could be considerably improved if the user interface provided more information about the choices you or the AI had right now and the outcomes of those choices.
Is a View layer really necessary?
Is a View layer really necessary?
- cuhnkedrik
- Posts: 2
- Joined: 04 Oct 2023, 09:41
- Has thanked: 0 time
- Been thanked: 0 time
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 91 guests