Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (536)
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 1689 times)
0 Members and 1 Guest are viewing this topic.
Offline Xyle
« Posted 2009-04-24 03: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 Member


Projects: 1


Jengibre


« Reply #1 - Posted 2009-04-24 04: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

So:

Player 1, with IP 1.2.3.4 connects to the server
Player 2, with IP 2.3.4.5 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 04: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 04: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 06: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 Member





« Reply #5 - Posted 2009-05-05 17: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.

 

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

The first screenshot will be displayed as a thumbnail.

CogWheelz (13 views)
2014-07-30 21:08:39

Riven (21 views)
2014-07-29 18:09:19

Riven (14 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

E.R. Fleming (32 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (42 views)
2014-07-24 01:59:36

Riven (42 views)
2014-07-23 21:16:32

Riven (29 views)
2014-07-23 21:07:15

Riven (30 views)
2014-07-23 20:56:16
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!