Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (616)
Games in Android Showcase (173)
games submitted by our members
Games in WIP (659)
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  
  Multiplayer Game Server  (Read 1963 times)
0 Members and 1 Guest are viewing this topic.
Offline Xyle
« Posted 2009-04-24 01:50:17 »

Ok, so here I am again.... months and months on this.

If you have a Server that listens for connections from a client and a client connects saying they wish to host a game, the server will launch a game on the server. Now how do you make it so that the client can communicate directly with the game, not through the server and make it so the game can communicate directly with the client, again not through the server?

Do you pass the server socket to the game and use a different port? Then tell the client what new port to use to talk to the game? I really dont think this method would be correct.

I really dont want the clients that are connected to games to have to send messages to the server, then have the server send the message to the game and vice versa.

Any suggestions would be greatly appreciated!

Life is just a game, learn to play!
╬-YellzBellz Games!-╬ Cheesy
Offline quixote_arg

Junior Devvie

Projects: 1


« Reply #1 - Posted 2009-04-24 02:14:44 »

You can do a P2P like scheme where the server sends the players the addresses of other players, so that they can communicate within each other


Player 1, with IP connects to the server
Player 2, with IP connects to the server

Server sends both players each other's IP, and they can connect in a peer 2 peer fashion

you must program you clients to be able to listen to other clients
Offline Xyle
« Reply #2 - Posted 2009-04-24 02:54:21 »

I appreciate that but ultimately I will be taking this to a webserver and using Applets so P2P architecture wouldn't be applicable.

The clients will have to go through the webserver, I just want them to be able to talk to the game that has been instantiated on the webserver by the Parent Server program and the game to be able to talk to the clients directly without any of the messages from the client or the game having to go through the server program and get parsed, etc.

I am working on a client server application just to ease the developement, but I will be porting whatever I get going to the Applet.

Life is just a game, learn to play!
╬-YellzBellz Games!-╬ Cheesy
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Xyle
« Reply #3 - Posted 2009-04-24 02:58:47 »

I thought I read somewhere that you can pass the socket information from the server to the game and that would allow the game to talk to the client directly.

I'll see if I can get that going.

Edit: I'm an idiot, I've been using this already for quite a while with my chat program.  Shocked

So what I'm looking for is a way for the client to talk directly to the Game that gets launched by the Server Program instead of having to talk to the server, have the server parse the code and see what kind of message it is, who its supposed to go to, etc.

Life is just a game, learn to play!
╬-YellzBellz Games!-╬ Cheesy
Offline Xyle
« Reply #4 - Posted 2009-04-24 04:06:55 »

I dont know what the hell I'm talking about, between RL Work, programming 40+ hours a week, loving the family, working around the house, gettin all liquored up on the weekends, and working on the website sometimes I get a little upside down!

As long as you pass the socket info to the newly created Game thread running from the server, that game can send and receive messages to the client.

Life is just a game, learn to play!
╬-YellzBellz Games!-╬ Cheesy
Offline markmistry

Junior Devvie

« Reply #5 - Posted 2009-05-05 15:03:48 »

Have you come across a situation where a client might be behind a firewall/nat if port forwarding is not setup on the router for that individual client no traffic will reach the client acting as a server.
I keep my game servers seperate from the clients and limit clients to 1000 per game server(not had chance to test ).all client communication has to go through a game server because of the firewall/port/routing problem. Just a thought :O)
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

Coldstream24 (19 views)
2015-09-03 00:41:28

Andrew_3ds (31 views)
2015-09-01 19:08:10

afikri (20 views)
2015-08-31 09:30:22

afikri (27 views)
2015-08-31 09:30:07

afikri (15 views)
2015-08-31 09:27:24

afikri (17 views)
2015-08-31 09:26:40

Roquen (32 views)
2015-08-29 11:30:54

GamerC4 (41 views)
2015-08-22 20:38:50

GamerC4 (37 views)
2015-08-22 20:37:18

GamerC4 (43 views)
2015-08-22 20:37:01
HotSpot Options
by Roquen
2015-08-29 11:33:11

Rendering resources
by Roquen
2015-08-17 12:42:29

Rendering resources
by Roquen
2015-08-17 09:36:56

Rendering resources
by Roquen
2015-08-13 07:40:51

Networking Resources
by Roquen
2015-08-13 07:40:43

List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30 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!