Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (496)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
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 2914 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.  

Thanx...

LordWilson

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

JGO Coder


Medals: 1


http://t-machine.org


« 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.
- ...plus 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 Member




"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.

gK

"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 Member





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

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

Junior Member




"C8 H10 N4 O2"


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

javatypo,

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.

gK

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

Senior Member


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 Member




"C8 H10 N4 O2"


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

Charlie,

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.

gK

"Go.  Teach them not to mess with us."
          -- Cao Cao, Dynasty Warriors 3
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

BurntPizza (14 views)
2014-09-19 03:14:18

Dwinin (32 views)
2014-09-12 09:08:26

Norakomi (58 views)
2014-09-10 13:57:51

TehJavaDev (80 views)
2014-09-10 06:39:09

Tekkerue (40 views)
2014-09-09 02:24:56

mitcheeb (62 views)
2014-09-08 06:06:29

BurntPizza (46 views)
2014-09-07 01:13:42

Longarmx (32 views)
2014-09-07 01:12:14

Longarmx (37 views)
2014-09-07 01:11:22

Longarmx (36 views)
2014-09-07 01:10:19
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org 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‑gaming.org
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!