Multiple simulataneous games
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Multiple simulataneous games
by elcnesh » 28 Jan 2015, 15:37
I've been trying to get simultaneous games to work, which basically means changing a lot of static fields/methods and singleton classes to normal objects. However, I've come across something which I don't know how to solve... When a PlayerControllerHuman is asked to make a decision, it directs that decision to SGuiChoose, which will always direct it to the static GuiDesktop (or GuiMobile). But that GuiDesktop then has no idea in which game something is asked, so it can't place the dialog in the proper game window. Somehow the PlayerControllerHuman needs to know a little bit more specific to which Gui it's connected.
Which brings me to the following: this is actually what I implemented in first instance with the Gui code overhaul, but was quickly (and rightly so) removed again by Dan. The problem was that I had made a variable out of the entire IGuiBase, which is definitely not right, as that encompasses much more than a single game. However, I do believe we need some kind of variable to which a PlayerControllerHuman can direct its questions; like an IGameGui, which then gets picked up by the right screen so that multiple games don't interfere. I think we'll otherwise never get to simultaneous games (or network games, for that matter).
Any thoughts on this? Maybe any alternatives that would be less work to implement? I'm not very experienced with this kind of stuff, but right now I'm hitting a wall in coding this, so somewhere something probably has to change...
Which brings me to the following: this is actually what I implemented in first instance with the Gui code overhaul, but was quickly (and rightly so) removed again by Dan. The problem was that I had made a variable out of the entire IGuiBase, which is definitely not right, as that encompasses much more than a single game. However, I do believe we need some kind of variable to which a PlayerControllerHuman can direct its questions; like an IGameGui, which then gets picked up by the right screen so that multiple games don't interfere. I think we'll otherwise never get to simultaneous games (or network games, for that matter).
Any thoughts on this? Maybe any alternatives that would be less work to implement? I'm not very experienced with this kind of stuff, but right now I'm hitting a wall in coding this, so somewhere something probably has to change...
- elcnesh
- Posts: 290
- Joined: 16 May 2014, 15:11
- Location: Netherlands
- Has thanked: 34 times
- Been thanked: 92 times
Re: Multiple simulataneous games
by Myrd » 01 Feb 2015, 01:00
Another possibility is for all the GUI functions to take a game param. Then, in GUI code there can be a map from the game to the tab.
I agree that having an object that keeps that state is cleaner though.
I agree that having an object that keeps that state is cleaner though.
Re: Multiple simulataneous games
by elcnesh » 05 Feb 2015, 12:30
Ok, I've actually managed to get it working! Have played the first games simultaneously on my machine!!!
Some bugs are to be fixed which have to do with quests, but otherwise I think it's ready. I'll post a patch here later today, maybe some of you can test it. It's gonna be quite a huge commit, but I'm fairly confident that the changes I've made are a necessary step in the direction of looser View-Game coupling, which is also a requirement for Network games.
Some bugs are to be fixed which have to do with quests, but otherwise I think it's ready. I'll post a patch here later today, maybe some of you can test it. It's gonna be quite a huge commit, but I'm fairly confident that the changes I've made are a necessary step in the direction of looser View-Game coupling, which is also a requirement for Network games.
- elcnesh
- Posts: 290
- Joined: 16 May 2014, 15:11
- Location: Netherlands
- Has thanked: 34 times
- Been thanked: 92 times
Re: Multiple simulataneous games
by KrazyTheFox » 05 Feb 2015, 14:40
This will help out greatly with quest drafts as well! I'll have to look into that this weekend.elcnesh wrote:Ok, I've actually managed to get it working! Have played the first games simultaneously on my machine!!!
Some bugs are to be fixed which have to do with quests, but otherwise I think it's ready. I'll post a patch here later today, maybe some of you can test it. It's gonna be quite a huge commit, but I'm fairly confident that the changes I've made are a necessary step in the direction of looser View-Game coupling, which is also a requirement for Network games.
-
KrazyTheFox - Programmer
- Posts: 725
- Joined: 18 Mar 2014, 23:51
- Has thanked: 66 times
- Been thanked: 226 times
Re: Multiple simulataneous games
by elcnesh » 10 Feb 2015, 15:06
So the weekend passed by really quickly and Eclipse was failing miserably, but in the end I managed to extract a working patch:
As I said, it's a HUGE change, so if a couple of devs are willing to give it a whirl that'd be great Some known issues:
EDIT: Updated file, fixing some bugs related mainly to quests, win/lose screen display, and viewing cards.
- Forge-Patch-GUI-r28820.txt
- (738.25 KiB) Downloaded 856 times
As I said, it's a HUGE change, so if a couple of devs are willing to give it a whirl that'd be great Some known issues:
- Targeting arrows not working (I know, big, but at least doesn't affect gameplay much)
- Human vs human on Android doesn't always correctly lock the UI of the player without priority;
- Human vs human on Android doesn't always correctly unlock the UI as the turn ends after auto-yielding;
- Human vs human on Desktop has two win screens that could now actually have a function, but right now they don't do very much;
- This patch also includes some preliminary work I've been doing on creating a card script syntax parser integrated into the workshop. Please ignore the red stuff that pops up in the workshop right now, I'll add an option to disable it before committing anything (or get it to work at least partially).
EDIT: Updated file, fixing some bugs related mainly to quests, win/lose screen display, and viewing cards.
- elcnesh
- Posts: 290
- Joined: 16 May 2014, 15:11
- Location: Netherlands
- Has thanked: 34 times
- Been thanked: 92 times
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 40 guests