Game Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesGame Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old March 27th, 2007, 11:34 AM
iamtotti iamtotti is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2007
Posts: 1 iamtotti User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 m 59 sec
Reputation Power: 0
Questions about multiplaying structure and implementations

Hello! I am a newbie to multiplaying game programming.
I am currently working on a 3D Multiplaying Internet Game. The 3D part is working fine. I am planning to communicate using TCP with threads. Sending struct to the others in order to let the game status up to date.

However, I am getting trouble in threads.

Actually, I have got two plans. The first one, one server with three clients. clients send the data to server and server update all the information and broadcasts to the clients. Then, the clients has only three threads. One for their i/o and two for their tcp sockets send/rec operations. However, server might need to have 7 threads. Six for communications and one for self i/o.

The second plan is all peer. Each player broadcasting their new inputs to the others. So, in order to collect and boardcast at the same time, two threads for send and receive for each pair of connection. And, finally, 7 threads needed, as one for self i/o, 6 for 3 others players send/receive connection.

I want to implement the second plan. Am my algorithm alright? I dont have such experiences in implement that. Would it be feasible?

Besides, what else have to be taken care in implementing this kind of structure? I am going to include an unsigned long int variable as a synchronization tool in each struct sent. Would it be too heavy in work load?

In opengl, the redering per second is about 150-180 frames. Could it be possible that the socket could send 150-180 data struct per second?? My data struct is only about 32bytes each.

I have been seraching through the internet. However, the information available is not much. The deadline is coming. Please help!

Reply With Quote
  #2  
Old March 27th, 2007, 04:38 PM
BioSlayer's Avatar
BioSlayer BioSlayer is offline
C# Addict.
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Location: Earth
Posts: 283 BioSlayer User rank is Sergeant (500 - 2000 Reputation Level)BioSlayer User rank is Sergeant (500 - 2000 Reputation Level)BioSlayer User rank is Sergeant (500 - 2000 Reputation Level)BioSlayer User rank is Sergeant (500 - 2000 Reputation Level)BioSlayer User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 4 Days 8 h 52 m 11 sec
Reputation Power: 22
I would go with the first plan, since it follows the KISS philosophy.

As for the ability to send all those packets you should do the math.

So 32 bytes = 256 bits with 180 sent a second you would have 46080 or 46k bits transmitted a second. But that’s excluding the overhead of TCP.
So it might work, it depends on the connection.
__________________
There are none so blind as those who will not see. — Jonathan Swift

My 2D Physics Engine.
My Remake of UQM.
Both are written in C#.

Reply With Quote
  #3  
Old March 28th, 2007, 07:41 AM
Hugh of Borg's Avatar
Hugh of Borg Hugh of Borg is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jun 2004
Location: Switzerland
Posts: 566 Hugh of Borg User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hugh of Borg User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hugh of Borg User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hugh of Borg User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hugh of Borg User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hugh of Borg User rank is Second Lieutenant (5000 - 10000 Reputation Level)Hugh of Borg User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 6 Days 18 h 4 m 38 sec
Reputation Power: 82
I would definitely prefer the first approach. Sending data to a central from which to be processed and distributed is much easier on bandwidth and systems complexity.

About sending updated: traditionally you'll only send updates to the clients. So if you have a moving player you only send an update when the player changes his speed or direction. This way the client can do the predictable changes on it own. You'll want to send a general update from time to time to ensure synchronization...
__________________
- Hugh of Borg

The first thing young borg are taught: Keep away from Microsoft software!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesGame Development > Questions about multiplaying structure and implementations


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway