Page 1 of 1

Lobby Player vs Quest Player

PostPosted: 12 Jan 2014, 22:21
by friarsol
I believe this question is mostly for Max, but figured I'd post it just in case there was other ancillary concerns that popped up due to the conversation:

I'm trying to reuse AnteResult with Gain Ownership cards (like Darkpact). Along with this, I'm moving some logic out of the Quest WinLose View to Match.executeAnte() where it makes more sense. Now I believe I have everything setup properly, but one thing I just ran across seems odd to me, and prevents things from working...

The "Quest Player" LobbyPlayer questPlayer = FServer.instance.getLobby().getQuestPlayer() that adds cards into the trunk of the Quest in QuestWinLose, doesn't seem to match any of the players actually participating in the Match.

So when I do questPlayer.getPlayer(lastGame) I get null, instead of getting one of the registered Players in lastGame.getRegisteredPlayers() as I was expecting?

lastGame.getRegisteredPlayers() gives me a list of two Players named:
1) Sol
2) Wyatt Earp (or whoever I happened to be playing)

But FServer.instance.getLobby().getQuestPlayer() gives me:
a LobbyPlayerHuman named:
1) Human

Any idea why the LobbyPlayer that enters a quest match isn't actually the Quest Player?

Re: Lobby Player vs Quest Player

PostPosted: 13 Jan 2014, 05:56
by Max mtg
Sol, Please do not move any quest-specific logic to Match. Match (part of game package) will not know about quests and how they are handled. There's going to be only a "Quest" GameMode in forge.game.
If quest mode is ever needed for multiplayer, we'll exract a dedicated module for it
So I believe a better destination for that quest logic is forge.quest.* package.

forge.game.player.LobbyPlayer.getPlayer(Game) is a factory method to create ingame Player from the Lobby* one. I'll rename it to avoid further confusion.

The code to find your quest player from a list of ingame ones looks like this:
Code: Select all
for (Player p : lastGame.getRegisteredPlayers()) {
    if (p.getLobbyPlayer().equals(questPlayer)) { /* Give them prizes */ }
}

Re: Lobby Player vs Quest Player

PostPosted: 13 Jan 2014, 15:35
by friarsol
Max mtg wrote:Sol, Please do not move any quest-specific logic to Match. Match (part of game package) will not know about quests and how they are handled. There's going to be only a "Quest" GameMode in forge.game.
If quest mode is ever needed for multiplayer, we'll exract a dedicated module for it
So I believe a better destination for that quest logic is forge.quest.* package.
Nope, I wasn't planning on it. There's just some duplicate code in executeAnte and QuestWinLose, that I was merging into executeAnte. The actual part that would add/remove cards from the Quest trunk still would happen in QuestWinLose.

Re: Lobby Player vs Quest Player

PostPosted: 13 Jan 2014, 17:35
by Max mtg
friarsol wrote:Nope, I wasn't planning on it. There's just some duplicate code in executeAnte and QuestWinLose, that I was merging into executeAnte. The actual part that would add/remove cards from the Quest trunk still would happen in QuestWinLose.
Ok, sound great then.