Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (778)
Games in Android Showcase (231)
games submitted by our members
Games in WIP (856)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  2 Player M:TG Online Card Game...  (Read 5635 times)
0 Members and 1 Guest are viewing this topic.
Offline LordWilson

Junior Newbie

Who runs it???...TKE Runs it...

« Posted 2003-04-15 01:52:45 »

I'm developing an online card game for Magic:  The Gathering that will, at first, be only a 2 Player game.  I am proficient in Java, but the Socket Programming is where I'm the most ignorant...

Firstly, I want this to be as live action as possible (basically, if I move a card on the table, then the other player sees me moving the card)...I don't think this type of animation is too demanding, so I'm planning on using TCP/IP.  

My questions is, once the connection between the two players is made (when connecting, one serving as the server, and the other the client), am I going to be able to have each of the players be able to send and receive messages simultaneously?  And if so, how do I do that?

I guess my ignorance of SocketProgramming is showing through now, but I have this notion that in order to receive something, you have to be listening for that particular someting.  Is it possible to have the GUI running on ONE thread, and when a message is needed to be sent, I can send that on ANOTHER thread?  While simultaneously listening on yet ANOTHER thread for information coming from the other client (in case he plays/moves a card)?

Once again, I'm new to this socket programming thing...and any input will be helpful.  Also, if I'm completely missing something, or if you think i'm looking too much into this, please, your other suggestions are welcome.  



Don't talk...You'll seem less stupid that way...
Offline blahblahblahh

JGO Coder

Medals: 1

« Reply #1 - Posted 2003-04-15 18:52:44 »

With just two players, use the following pattern (this is the simplest solution, but not the most intelligent - more intelligent methods aren't appropriate for such a simple case).

One client opens a ServerSocket, and dedicates a Thread to:

- listening to the ServerSocket (SS)
- Fetching a Socket from the SS when an incoming connection occurs.
- all the stuff we're about to do with the Socket

Each client dedicates two threads (the first client above can have one of these as a re-use of the SS thread it already has) to the Socket.

For each client, one thread is attached to the Socket.getInputStream(), the other on Socket.getOutputStream(). The Threads have various public methods like [for a thread on an OutputStream:] "sendTextMessage( String message )" or [for a thread on an InputStream] "addStreamListener( StreamListener )".

Note: the StreamListener is a class (or preferably an interface) you write that has methods like "receivedTextMessage( String message)". If it's an interface, you could have your GUI implement it, and whenever "receivedTextMessage" is called, it could update a JList of received messages, and call repaint().

That's the process, hopefully it makes sense? I'm half-asleep right now, and have checked what I wrote, and it seems sensible, but I'm too tired to know for sure Sad.

malloc will be first against the wall when the revolution comes...
Offline GergisKhan

Junior Devvie

"C8 H10 N4 O2"

« Reply #2 - Posted 2003-04-16 16:55:36 »

Not to be a stick in the mud, but I know many of the artists for M:tG and what they have said of WoTC, which is now part of Hasbro, is that they are ruthless when it comes to licensing and copyrights.  I would advise you to beware of any sort of violations.


"Go.  Teach them not to mess with us."
          -- Cao Cao, Dynasty Warriors 3
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline javatypo

Junior Devvie

« Reply #3 - Posted 2003-04-18 22:23:37 »

who the heck invented legal issues anyway!!??
Offline GergisKhan

Junior Devvie

"C8 H10 N4 O2"

« Reply #4 - Posted 2003-04-18 22:43:13 »


Two sides to that coin, unfortunately.  Those of us who want to take something and make it better, as I see LordWilson is trying to, and those of us who want to profit from the hard work we've put in (the artists who originally created the art, and are usually paid on comissions).

In between that are pirates, both corporate (those who actually hold the copyrights, and in some cases, abuse them) and individuals (who steal other people's work without regard to the ramifications of doing so).

It's not a fun spot to be in.  The only reason I brought it up is that Hasbro is KNOWN to enforce their copyrights, so even if LordWilson was writing this game to teach himself programming, or as an experiment, they might go after him.

Of course, MtG could never be produced as a commercial game without their express permission.  But that's not my point.


"Go.  Teach them not to mess with us."
          -- Cao Cao, Dynasty Warriors 3
Offline cfmdobbie

Senior Devvie

Medals: 1

Who, me?

« Reply #5 - Posted 2003-04-18 23:25:55 »

Yeah, be careful.  The Wizards basically claim they own the concept of a customisable card game, and have vigorously defended that claim in the past.  Watch your step.

Not that I agree with them in this case, however!  I find the concept of a single company laying claim to an entire genre of games despicable.

Hellomynameis Charlie Dobbie.
Offline GergisKhan

Junior Devvie

"C8 H10 N4 O2"

« Reply #6 - Posted 2003-04-19 12:29:06 »


I am working with a CCG developer who has specifically run up against Wizards of the Coast on this.  Just so you know how crazy it can get:

1) they have a patent for the MtG style of CCG

2) they vigorously defended it.

3) Hasbro bought them specifically to get hold of that patent, as it applies to two games they wanted: Yu-Gi-Oh! and Dragonball Z.

So yes, they are dangerous.


"Go.  Teach them not to mess with us."
          -- Cao Cao, Dynasty Warriors 3
Pages: [1]
  ignore  |  Print  

hadezbladez (353 views)
2018-11-16 13:46:03

hadezbladez (184 views)
2018-11-16 13:41:33

hadezbladez (356 views)
2018-11-16 13:35:35

hadezbladez (86 views)
2018-11-16 13:32:03

EgonOlsen (2179 views)
2018-06-10 19:43:48

EgonOlsen (2221 views)
2018-06-10 19:43:44

EgonOlsen (1379 views)
2018-06-10 19:43:20

DesertCoockie (2012 views)
2018-05-13 18:23:11

nelsongames (1671 views)
2018-04-24 18:15:36

nelsongames (2310 views)
2018-04-24 18:14:32
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!