It is currently 17 Apr 2021, 00:50
   
Text Size

Network Multiplayer (Multi-human players)

Post MTG Forge Related Programming Questions Here

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

Re: Network Multiplayer (Multi-human players)

Postby elcnesh » 01 Sep 2014, 15:50

So it's been a few days, and I've done a lot of work on expanding on the original patch.

Most game objects (Game, Player, Card, SpellAbility, SpellAbilityStackInstance) now have a dedicated view object, which are the only objects passed around in any of the view code. For now, I've merged the view code for the Game itself with the HumanPlayerController, making that object the sole link between the game state and the GUI. For a network game this would then be split into two classes: the controller at the server, and the view at the client.

However, the code is a bit of a mess right now, and there's some problems (mostly with the Input classes) that I can't easily solve. There's around 150 errors and it's growing above my head a bit :P Would anybody care to setup a branch so I can commit it there? Then multiple people can help thinking about it without me having to post patches here. (I'd set up the branch myself, but I'm not exactly sure how to do it and I don't want to mess up the repository.)
elcnesh
 
Posts: 290
Joined: 16 May 2014, 15:11
Location: Netherlands
Has thanked: 34 times
Been thanked: 92 times

Re: Network Multiplayer (Multi-human players)

Postby elcnesh » 02 Sep 2014, 08:38

(triple-post :P)

The branch has been made! It still has some errors though, as some code (mostly related to Inputs, GameEvents and Dev Mode buttons) still has to be refactored. After that, it's only testing, and I think we should be able to merge it back into trunk pretty soon.
If people could help out with thinking about or coding the missing parts, that'd be great! :)
elcnesh
 
Posts: 290
Joined: 16 May 2014, 15:11
Location: Netherlands
Has thanked: 34 times
Been thanked: 92 times

Re: Network Multiplayer (Multi-human players)

Postby elcnesh » 05 Sep 2014, 00:07

(quadruple-post! sorry for hijacking this thread for updates, but at least now everyone gets to see what's happening :P)

The branch is error-free, and I'm working out the last problems (mostly NPE's :P) in the code. But I'm really happy to announce that most of it is working already, and I've played my first game using the new View objects! :D

The only things that needs to be done before merging the branch back into trunk is (a) testing all affected parts thoroughly (including questing, deck editor, workshop etc. - unfortunately these also had to be modified); and (b) refactoring the android code, which are mostly trivial changes but should still be done with care of course (and tested).

The most important change is that ALL communication between the game (model) and the GUI (view) now happens with two interfaces: the model sends input requests to IGuiBase, which is now picked up by GuiDesktop; and the view sends requests to IGameView, which is now picked up by PlayerControllerHuman. The only thing required for network play is to implement network versions of the interfaces (both on the server and client side, so four classes in total), and it should all work.
elcnesh
 
Posts: 290
Joined: 16 May 2014, 15:11
Location: Netherlands
Has thanked: 34 times
Been thanked: 92 times

Re: Network Multiplayer (Multi-human players)

Postby troyready » 05 Sep 2014, 00:08

I say no apology needed -- for those of us following along with great anticipation, your posts are great!
troyready
 
Posts: 9
Joined: 03 Jul 2014, 22:41
Has thanked: 1 time
Been thanked: 0 time

Re: Network Multiplayer (Multi-human players)

Postby elcnesh » 09 Sep 2014, 14:09

First test results! And they're positive! :D

Before merging back into trunk, however, some more testing is needed:
* More testing of normal matches, especially with funky cards;
* Testing other playing types: sealed, draft, gauntlet, quests, etc.;
* Watching AI vs. AI matches;
* Testing the Android version for all the above as well (it may very well be unstable!).

Sol and Dan, could you create desktop and Android builds of the branch? If we could get some people beside me to test this, it'd all go a whole lot faster. I simply don't have the time and creativity to do that myself ;)
elcnesh
 
Posts: 290
Joined: 16 May 2014, 15:11
Location: Netherlands
Has thanked: 34 times
Been thanked: 92 times

Re: Network Multiplayer (Multi-human players)

Postby Agetian » 09 Sep 2014, 16:49

elcnesh wrote:First test results! And they're positive! :D

Before merging back into trunk, however, some more testing is needed:
* More testing of normal matches, especially with funky cards;
* Testing other playing types: sealed, draft, gauntlet, quests, etc.;
* Watching AI vs. AI matches;
* Testing the Android version for all the above as well (it may very well be unstable!).

Sol and Dan, could you create desktop and Android builds of the branch? If we could get some people beside me to test this, it'd all go a whole lot faster. I simply don't have the time and creativity to do that myself ;)
Awesome job thus far! I would love to test but sadly my current business schedule won't permit me to, so I hope someone else will be able to assist. Good luck!

By the way, I would advise to wait until 1.5.26 is released before merging this branch back into trunk even if the testing appears to show positive results (so that we have enough time later to fix up whatever may suddenly spring up and go wrong at a later time without breaking a soon-to-come release).

- Agetian
Agetian
Programmer
 
Posts: 3403
Joined: 14 Mar 2011, 05:58
Has thanked: 655 times
Been thanked: 521 times

Re: Network Multiplayer (Multi-human players)

Postby drdev » 09 Sep 2014, 18:55

elcnesh, have you tried just running forge-gui-mobile-dev as a Java Application? That should allow you to verify the behavior of the mobile game without needing to connect an Android device or build a .apk. That's how I do almost all my testing while developing.
drdev
Programmer
 
Posts: 1958
Joined: 27 Jul 2013, 02:07
Has thanked: 189 times
Been thanked: 565 times

Re: Network Multiplayer (Multi-human players)

Postby elcnesh » 09 Sep 2014, 19:02

I can't seem to find a main type...

Edit: nvm, found it in mobile-dev :)
elcnesh
 
Posts: 290
Joined: 16 May 2014, 15:11
Location: Netherlands
Has thanked: 34 times
Been thanked: 92 times

Re: Network Multiplayer (Multi-human players)

Postby friarsol » 10 Sep 2014, 00:53

I switched to this branch to check it out tonight. But was getting the following crash using my normal Profile:

Once I switched to a fresh profile (by changing my profile.properties), things went through. Not sure how exactly that's happening.

ExceptionInInitializerError | Open
Code: Select all
Forge Version:    SVN
Operating System: Windows 8 6.2 amd64
Java Version:     1.7.0_51 Oracle Corporation

java.lang.ExceptionInInitializerError
   at forge.quest.io.QuestDataIO$DraftTournamentToXml.unmarshal(QuestDataIO.java:661)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
   at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:474)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:406)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:257)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
   at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:474)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:406)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:257)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
   at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
   at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
   at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1185)
   at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1169)
   at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1040)
   at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1031)
   at forge.quest.io.QuestDataIO.loadData(QuestDataIO.java:146)
   at forge.control.FControl.initialize(FControl.java:235)
   at forge.view.Main.main(Main.java:59)
Caused by: java.lang.NullPointerException
   at java.io.File.<init>(File.java:277)
   at forge.util.FileUtil.readFile(FileUtil.java:159)
   at forge.quest.io.ReadPriceList.readFile(ReadPriceList.java:78)
   at forge.quest.io.ReadPriceList.setup(ReadPriceList.java:61)
   at forge.quest.io.ReadPriceList.<init>(ReadPriceList.java:52)
   at forge.quest.QuestEventDraft.<clinit>(QuestEventDraft.java:88)
   ... 26 more
When I get booted in with the fresh profile, I get this crash when trying to download the card prices:

NullPointerException | Open
Code: Select all
Forge Version:    SVN
Operating System: Windows 8 6.2 amd64
Java Version:     1.7.0_51 Oracle Corporation

java.lang.NullPointerException
   at java.io.File.<init>(File.java:277)
   at forge.download.GuiDownloadService.run(GuiDownloadService.java:242)
   at java.lang.Thread.run(Thread.java:744)
friarsol
Global Moderator
 
Posts: 7566
Joined: 15 May 2010, 04:20
Has thanked: 242 times
Been thanked: 954 times

Re: Network Multiplayer (Multi-human players)

Postby elcnesh » 10 Sep 2014, 13:29

Thanks for the report! That (and a host of other) bugs have been fixed in the last few commits. I completely rewrote parts of the engine (the Google BiMap is bugged somehow :?) and now everything is a lot more stable. :)

@Agetian: I'll definitely wait a bit before merging, I'm not gonna commit this big a change without at least a couple of people verifying that everything works as intended.

Known issues:
  • No playback controls in AI vs AI;
  • Human vs Human is bugged (not sure if it can even work under the new code :( );
  • Display of split cards on stack is weird (but functions correctly otherwise).
elcnesh
 
Posts: 290
Joined: 16 May 2014, 15:11
Location: Netherlands
Has thanked: 34 times
Been thanked: 92 times

Re: Network Multiplayer (Multi-human players)

Postby friarsol » 10 Sep 2014, 14:15

elcnesh wrote:[*] Human vs Human is bugged (not sure if it can even work under the new code :( );
Does that mean Mindslaver doesn't work? Human vs Human and "control another player" were very tightly coupled when they were implemented.
friarsol
Global Moderator
 
Posts: 7566
Joined: 15 May 2010, 04:20
Has thanked: 242 times
Been thanked: 954 times

Re: Network Multiplayer (Multi-human players)

Postby friarsol » 11 Sep 2014, 01:55

Not sure why but the 'A' key doesn't seem to run the "Alpha Strike" command like it should. The 'E' key runs End Turn.

Additionally I got this error:

Description: [describe what you were doing when the crash occurred]

ConcurrentModificationException | Open
Code: Select all
Forge Version:    SVN
Operating System: Windows 8 6.2 amd64
Java Version:     1.7.0_51 Oracle Corporation

java.util.ConcurrentModificationException
   at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:859)
   at java.util.ArrayList$Itr.next(ArrayList.java:831)
   at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48)
   at forge.view.CombatView.addAttackingBand(CombatView.java:72)
   at forge.view.LocalGameView.updateCombatView(LocalGameView.java:188)
   at forge.view.LocalGameView.getCombat(LocalGameView.java:178)
   at forge.view.LocalGameView.getCombat(LocalGameView.java:168)
   at forge.screens.match.TargetingOverlay$OverlayPanel.paintComponent(TargetingOverlay.java:366)
   at javax.swing.JComponent.paint(JComponent.java:1054)
   at javax.swing.JComponent.paintChildren(JComponent.java:887)
   at javax.swing.JComponent.paint(JComponent.java:1063)
   at javax.swing.JLayeredPane.paint(JLayeredPane.java:585)
   at javax.swing.JComponent.paintChildren(JComponent.java:887)
   at javax.swing.JComponent.paint(JComponent.java:1063)
   at javax.swing.JLayeredPane.paint(JLayeredPane.java:585)
   at javax.swing.JComponent.paintChildren(JComponent.java:887)
   at javax.swing.JComponent.paint(JComponent.java:1063)
   at javax.swing.JComponent.paintToOffscreen(JComponent.java:5219)
   at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1529)
   at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1452)
   at javax.swing.RepaintManager.paint(RepaintManager.java:1249)
   at javax.swing.JComponent._paintImmediately(JComponent.java:5167)
   at javax.swing.JComponent.paintImmediately(JComponent.java:4978)
   at javax.swing.RepaintManager$3.run(RepaintManager.java:808)
   at javax.swing.RepaintManager$3.run(RepaintManager.java:796)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
   at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:796)
   at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:769)
   at javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:718)
   at javax.swing.RepaintManager.access$1100(RepaintManager.java:62)
   at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1677)
   at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
   at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
   at java.awt.EventQueue.access$200(EventQueue.java:103)
   at java.awt.EventQueue$3.run(EventQueue.java:694)
   at java.awt.EventQueue$3.run(EventQueue.java:692)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:703)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
   at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
I had a Windborn Muse in play. AI had a few goblins, and tried to attack with them, but could only afford to pay for one.
friarsol
Global Moderator
 
Posts: 7566
Joined: 15 May 2010, 04:20
Has thanked: 242 times
Been thanked: 954 times

Re: Network Multiplayer (Multi-human players)

Postby friarsol » 12 Sep 2014, 01:32

friarsol wrote:Not sure why but the 'A' key doesn't seem to run the "Alpha Strike" command like it should. The 'E' key runs End Turn.
Ahh I see what's going on. It does actually work, but a repaint isn't triggered afterwards, so the Attacking icon doesn't show up properly.
friarsol
Global Moderator
 
Posts: 7566
Joined: 15 May 2010, 04:20
Has thanked: 242 times
Been thanked: 954 times

Re: Network Multiplayer (Multi-human players)

Postby elcnesh » 12 Sep 2014, 09:00

Actually, I only fixed alpha strike yesterday ;) but you're right it doesn't update properly yet.

Mindslaver is fixed now, but hotseat is basically dead under the new code. I'm not sure if anyone ever used it anyway (except maybe for testing?). Apart from that and AI vs AI playback controls, I haven't found anything that's not working, so more testing is definitely welcome! :)
elcnesh
 
Posts: 290
Joined: 16 May 2014, 15:11
Location: Netherlands
Has thanked: 34 times
Been thanked: 92 times

Re: Network Multiplayer (Multi-human players)

Postby Agetian » 12 Sep 2014, 11:54

elcnesh wrote:Actually, I only fixed alpha strike yesterday ;) but you're right it doesn't update properly yet.

Mindslaver is fixed now, but hotseat is basically dead under the new code. I'm not sure if anyone ever used it anyway (except maybe for testing?). Apart from that and AI vs AI playback controls, I haven't found anything that's not working, so more testing is definitely welcome! :)
Glad to hear that most things are operational! Good job thus far, keep it up! Hotseat was quite interesting, I know I used it for some deck testing experiments, not sure if anybody else ever used it though (there were a couple reports in the bug thread though, so I assume somebody did :) ).

- Agetian
Agetian
Programmer
 
Posts: 3403
Joined: 14 Mar 2011, 05:58
Has thanked: 655 times
Been thanked: 521 times

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 19 guests


Who is online

In total there are 19 users online :: 0 registered, 0 hidden and 19 guests (based on users active over the past 10 minutes)
Most users ever online was 1371 on 09 Feb 2020, 16:22

Users browsing this forum: No registered users and 19 guests

Login Form