Captive Imagination
September 06, 2010, 08:42:36 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Check out the teaser site for the first official game by Captive Imagination: http://www.galaxiesbeyond.com
 
   Home   Help Search Calendar Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Server creates game for clients  (Read 732 times)
0 Members and 1 Guest are viewing this topic.
Xyle
Newbie
*
Offline Offline

Posts: 11


View Profile WWW
« on: April 15, 2009, 10:30:22 PM »

I've been spending alot of time on the underlying base for my game architecture and wanted to post something that I was looking at for fellow users to judge, point at and laugh or to give a nod in affirmation.

When a hosting client first starts up
they tell server who they are
the server starts a new game thread, which in essence is nothing more than a client with game code
the server gives this new game thread the hosting clients playerID for message passing
the server gives the hosting client the new game thread playerID for message passing
with the hosting client and the new game thread each having each others playerID they can communicate directly without the server having to parse messages or be involved at all.

This is the kind of Multiplayer architecture I've been wanting to create for a few months now and I believe JGN is very capable of doing this. My main holdup right now is how to make the server create a game instance and give it a playerID so that connecting clients can communicate directly with the game without any middlemen.

I will definitely keep poking around and hopefully something here will click, unless someone says this is backwoods, hill billy, campfire jig dancing technique!  Shocked
Logged

Life is just a game, learn to play!
__________________________
╬-Mighty Realms! Java Online Games-╬
Grin
darkfrog
Administrator
Inspired Imagination
*****
Offline Offline

Posts: 2650


View Profile
« Reply #1 on: April 16, 2009, 08:41:45 AM »

That sounds fine.

What are you stuck on specifically figuring out how to make the server create a game instance?
Logged
Xyle
Newbie
*
Offline Offline

Posts: 11


View Profile WWW
« Reply #2 on: April 16, 2009, 08:37:35 PM »

Yes, thats were I'm at now. Last night I looked at just using the client code and expanding on that because in reality the Game will be just another client for a group of clients to talk to.

I ran a few tests last night and the server started doing some weird things like repeating a hosting client login and stuff, but I'm sure I'll be able to get it figured out.

Thanks for the go forward stamp, this 1 little uncertainty on the whole network architecture has left me stumped and wondering for a long time.

Thanks.
Logged

Life is just a game, learn to play!
__________________________
╬-Mighty Realms! Java Online Games-╬
Grin
Xyle
Newbie
*
Offline Offline

Posts: 11


View Profile WWW
« Reply #3 on: April 19, 2009, 09:51:55 PM »

Ok, that didnt work.

I basically took the client code, changed a few things like adding parameters to the constructor, but some strange things happen.

What happens though is that once client is connected and passing messages to server, I send "-05MyGame" to the server which tells it to launch a game with the following code...

hGame[gameCount] = new HeartsGame(playerName,playerId,tStr);

Which basically launches a new game with PlayerName as the host and playerID is stored in the instance so that the hGame can send messages to the client.

The problem is that the server is having some troubles, saying message failed alot and keeps trying, but it starts new instances of the actual game, so in the end I have 6 game gui's connected.

I'll keep stabbing it, til it either succumbs or I get too tired.
Logged

Life is just a game, learn to play!
__________________________
╬-Mighty Realms! Java Online Games-╬
Grin
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.18 seconds with 20 queries.