It is currently 27 Apr 2024, 19:17
   
Text Size

New constructed game screen for N players

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Re: New constructed game screen for N players

Postby drdev » 18 Jan 2014, 06:46

I realized there was no way to view the card image or detail on the home screen while new FDeckViewer dialog was open, so I decided to add detail and picture panels to the dialog itself.

I also added a new "View Deck" button at the bottom of FDeckChooser (beside the Random Deck button) to make this new dialog more discoverable instead of needing to know to double-click.

What do you think? Anything else I should add?

FDeckViewer.png

Thanks.
-Dan
drdev
Programmer
 
Posts: 1958
Joined: 27 Jul 2013, 02:07
Has thanked: 189 times
Been thanked: 565 times

Re: New constructed game screen for N players

Postby moomarc » 18 Jan 2014, 08:01

@Dan: looks good! Nice to be able to get a better view of the cards.

@Agetian: I never changed any of the deck chooser functionality and am sure it was working exactly as it did before when. The preference file is only updated when a match starts, so quitting before starting a match would not register changes to deck selections. So I have to assume that it has something to do with the new deck chooser implementation. Is that the only deck section that's not being saved, or is it all of them? I haven't really played matches the last two days... Just launch Forge, test whatever I was working on, then quit again :D
-Marc
User avatar
moomarc
Pixel Commander
 
Posts: 2091
Joined: 04 Jun 2010, 15:22
Location: Johannesburg, South Africa
Has thanked: 371 times
Been thanked: 372 times

Re: New constructed game screen for N players

Postby Agetian » 18 Jan 2014, 13:18

@ drdev: Looks great so far!

@ moomarc: It seems that not everything is saved or loaded back. In particular, the exact deck that was chosen last is not remembered (so, I always get the topmost deck selected for all players when Forge is started). The tab itself is remembered, so if I was on the Random Color Decks tab, all players will have Random 3 (which, for some reason, is the topmost option) selected for them. If I was on the Custom User Decks tab, all players will have the first (topmost) prebuilt deck selected for them. The exact deck that was last chosen is not remembered across Forge launches.

- Agetian
Agetian
Programmer
 
Posts: 3472
Joined: 14 Mar 2011, 05:58
Has thanked: 677 times
Been thanked: 561 times

Re: New constructed game screen for N players

Postby moomarc » 18 Jan 2014, 13:58

That must have broken with the change to deck manager then. I know it was saving each player's decks properly earlier in the new screen setup. I'll try look at it today some time.
-Marc
User avatar
moomarc
Pixel Commander
 
Posts: 2091
Joined: 04 Jun 2010, 15:22
Location: Johannesburg, South Africa
Has thanked: 371 times
Been thanked: 372 times

Re: New constructed game screen for N players

Postby drdev » 18 Jan 2014, 14:43

moomarc wrote:That must have broken with the change to deck manager then. I know it was saving each player's decks properly earlier in the new screen setup. I'll try look at it today some time.
That's one of the known issues I referred to earlier. I can work on that today, unless you'd prefer to moomarc?
drdev
Programmer
 
Posts: 1958
Joined: 27 Jul 2013, 02:07
Has thanked: 189 times
Been thanked: 565 times

Re: New constructed game screen for N players

Postby moomarc » 18 Jan 2014, 15:06

You probably have a better idea of where to look. I know that when a game started and the registered players were made from the lobby players, the decks were saved then using a getState() call (in CSubmenuConstructed on start button press). I only have about an hour today that I might get to look, so if I haven't fixed it in an hour, it's all yours. Next week is going to be hectic for me so was hoping to get avatar selection working over the weekend.
-Marc
User avatar
moomarc
Pixel Commander
 
Posts: 2091
Joined: 04 Jun 2010, 15:22
Location: Johannesburg, South Africa
Has thanked: 371 times
Been thanked: 372 times

Re: New constructed game screen for N players

Postby moomarc » 18 Jan 2014, 16:08

I've had a quick look and it has something to do with the initial DeckChoser initialization. The preferences are being saved fine, its just reading them back in. I'm not sure how to fix it unfortunately so I'll leave it for the guys that know what they're doing.
-Marc
User avatar
moomarc
Pixel Commander
 
Posts: 2091
Joined: 04 Jun 2010, 15:22
Location: Johannesburg, South Africa
Has thanked: 371 times
Been thanked: 372 times

Re: New constructed game screen for N players

Postby drdev » 18 Jan 2014, 16:38

moomarc wrote:I've had a quick look and it has something to do with the initial DeckChoser initialization. The preferences are being saved fine, its just reading them back in. I'm not sure how to fix it unfortunately so I'll leave it for the guys that know what they're doing.
I'll take a look.
drdev
Programmer
 
Posts: 1958
Joined: 27 Jul 2013, 02:07
Has thanked: 189 times
Been thanked: 565 times

Re: New constructed game screen for N players

Postby moomarc » 18 Jan 2014, 17:04

Just in case it helps, I came across one strange bit of behaviour while trying to track the issue. Commenting out setSelectCommand (VSubmenuConstructed lines 413-418 results in the deck bottons in the player panels listing only the deck type, instead of deck type and selections. I expected it to do nothing except prevent the command from being created. Hope that helps.
-Marc
User avatar
moomarc
Pixel Commander
 
Posts: 2091
Joined: 04 Jun 2010, 15:22
Location: Johannesburg, South Africa
Has thanked: 371 times
Been thanked: 372 times

Re: New constructed game screen for N players

Postby drdev » 18 Jan 2014, 20:08

It wasn't easy, but I was able to fix it so the previously played deck is restored, as well as fix it so that deck doesn't start out of view.
drdev
Programmer
 
Posts: 1958
Joined: 27 Jul 2013, 02:07
Has thanked: 189 times
Been thanked: 565 times

Re: New constructed game screen for N players

Postby moomarc » 18 Jan 2014, 21:01

Thanks Dan! Looked at the changes needed and that was just so out of my depth.
-Marc
User avatar
moomarc
Pixel Commander
 
Posts: 2091
Joined: 04 Jun 2010, 15:22
Location: Johannesburg, South Africa
Has thanked: 371 times
Been thanked: 372 times

Re: New constructed game screen for N players

Postby drdev » 19 Jan 2014, 18:39

Update. I just committed a fix so the random color deck options are displayed in the correct order. I also made it so it doesn't show an unnecessary column header for that single column.
drdev
Programmer
 
Posts: 1958
Joined: 27 Jul 2013, 02:07
Has thanked: 189 times
Been thanked: 565 times

Re: New constructed game screen for N players

Postby moomarc » 21 Jan 2014, 07:34

I need a little help with something... I was re-instating the random deck checkboxes (singletons, no artifacts and no small) seeing as it wasn't actually hooked up to anything anymore. While I was at it I moved them from the start button panel into the deck panel where they are added after the deck chooser when the deck is repopulated after changing to a random deck type. It's working perfectly except for one thing - when I change deck section focus jumps back to player one. I've tried tracing why it's happening but I could only get as far as knowing that player 1's avatar is gaining focus which then calls changePlayerFocus etc. How do I trace what calls are being made exactly?

If it helps, I added an IDecksComboListener to each FDeckChooser's combo box when they're first populated:
Code: Select all
//in VSubmenuConstructed.populate():

//existing code
for (FDeckChooser fdc : deckChoosers) {
    fdc.populate();
    //new listener added here
    fdc.getDecksComboBox().addListener(new IDecksComboBoxListener() {
        @Override
        public void deckTypeSelected(DecksComboBoxEvent ev) {
            VSubmenuConstructed.this.populateDeckPanel(false);
        }
    });
}
The getDecksComboBox() is just a basic method in FDeckChooser
Code: Select all
public DecksComboBox getDecksComboBox() {
    return decksComboBox;
}
Without that listener, the current player keeps focus correctly, but I need to call populateDeckPanel in order to add in the checkboxes when required. According to console prints, the deck is populated for the correct player first, then player 1's avatar gains focus which subsequently changes player and repopulated the deck panel for player one. It doesn't make sense to me! Why is it giving focus to that avatar? I've tried println's after pretty much every requestFocusInWindow call that I could find and none of those seem to be involved. I'm just stymied.

I can't even post a patch or the code I have so far because my modem was struck by lightning while I was unplugging other things, and I won't be able to replace it until some clients pay up their overdue payments. But if someone tried to track this down the other relevant code is:
Code: Select all
//in populateDeck after adding the deckChooser:
if (!firstBuild && deckChoosers.get(playerWithFocus).getSelectedDeckType().toString().contains("random") {
    // this code just moved from pnlStart:
    final String constraints = ....
    decksFrame.add(cbSingletons, constraints);
    ...etc for cbArtifacts and cbRemoveSmall
Edit: a simple call to populateDeckPanel() produces exactly the same thing. I just didn't go this route originally because I only wanted to repopulate on deck type change, not every deck selection.

Edit 2: funny thing, it turns out DECKGEN_NOSMALL is never actually used anywhere. I'll remove it as I move the variants across.

-----

In other news I've started moving variants over to the new match setup screen. I've made the change to registered player. I still need to move across the deck section selectors applicable to each section, change methods that deal with GameType to instead work with List<GameType> And I'll probably have to change a few other things. I'll see as I go.
-Marc
User avatar
moomarc
Pixel Commander
 
Posts: 2091
Joined: 04 Jun 2010, 15:22
Location: Johannesburg, South Africa
Has thanked: 371 times
Been thanked: 372 times

Re: New constructed game screen for N players

Postby moomarc » 21 Jan 2014, 17:43

Just to clarify, the first edit in my last post was misleading and I was asleep or something because some info was missing. It meant to say that a simple call to populateDeckPanel from onDeckClicked (from a listener that listens to change of deck selection rather than deck section change) still produces the broken behaviour where focus is given to player 1's avatar.
-Marc
User avatar
moomarc
Pixel Commander
 
Posts: 2091
Joined: 04 Jun 2010, 15:22
Location: Johannesburg, South Africa
Has thanked: 371 times
Been thanked: 372 times

Re: New constructed game screen for N players

Postby Max mtg » 21 Jan 2014, 19:03

The random deck switches should be used together with each random deck individually (meaning a special view for random colored deck creation to hold those options and their removal from global context), what do you think?
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 84 guests


Who is online

In total there are 84 users online :: 0 registered, 0 hidden and 84 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 84 guests

Login Form