![](smile.gif)
How to Make a multiplayer Game
hi everyone!!!
this is my call of despair!!
i ve been looking and looking and trying and trying... i cant get it done... even finding usefull info... the good thing is that i m not alone
I beleived i had pretty simple case here... there it is:
- i got a 3d basic engine driven by opengl... a simple teapot bind to a camera... a win32 application! lots of fun yet!
- my nightmare start here... i just want a start the same lets call it game... on another computer by lan tcp or else... and see the teapot moving on both screen!!!
is that so hard to do? well so far its definitly frustrating... i tought it will be easy... well, i was wrong...
anybody out there feels the pain? tanks in advance for your inputs!!!
golgoth!
Never argue with an idiot. They just drag you down to their level and beat you with experience.
![](smile.gif)
November 22, 2003 08:40 PM
Thanks for your consern!! hehe... so deep in this thing that i forgot to ask for any ideas, tutorials... exemples that works!!!! anyone can help or looking in the same direction???
am i alone?
golgoth
am i alone?
golgoth
Link
Go to the tuts and then to networking. That might help you. I am not there yet in my programming yet.
[edited by - XDarkScar on November 24, 2003 1:44:43 AM]
Go to the tuts and then to networking. That might help you. I am not there yet in my programming yet.
[edited by - XDarkScar on November 24, 2003 1:44:43 AM]
Easy way of programming: Coding, Debugging, Swearing.
Google / Game Tutorials / GameDev.Net / My Project server. Check it out.
Project: N/A / Percent Complete: 0% / Due Date: N/A
Google / Game Tutorials / GameDev.Net / My Project server. Check it out.
Project: N/A / Percent Complete: 0% / Due Date: N/A
November 24, 2003 12:54 AM
Make sure you can establish a connection and send data.
If you can do this, then there are two extremely common issues with dealing with TCP (it turns out they are somewhat related).
The first deals with blocking reads. Most of the time folks sit
there at a read() system call and the remote side just sits there because there is nothing to read (even if you''ve written something on the "server" side).
You can fix this by switching to non-blocking reads, which will let your application run even when there isn''t any data. Effectively, you just read from the socket into memory, then interpret the data as the type you wish when you have enough.
The second problem is how to get data to show up immediately after it is written on the server side. Typically, TCP is a buffering protocol. Its efficiency drops the smaller the data packets are. However, in real life, sometimes transmit times are more important than efficiency (like in games!!!). To turn off the buffering and have the data sent immediately as its written, just turn on the TCP_NO_DELAY option (see setsocketopt call). This will force data to be transmitted to the client as soon as it is written.
These may not be the problems you are having, but these were a couple that I ran into along the way.
If you can do this, then there are two extremely common issues with dealing with TCP (it turns out they are somewhat related).
The first deals with blocking reads. Most of the time folks sit
there at a read() system call and the remote side just sits there because there is nothing to read (even if you''ve written something on the "server" side).
You can fix this by switching to non-blocking reads, which will let your application run even when there isn''t any data. Effectively, you just read from the socket into memory, then interpret the data as the type you wish when you have enough.
The second problem is how to get data to show up immediately after it is written on the server side. Typically, TCP is a buffering protocol. Its efficiency drops the smaller the data packets are. However, in real life, sometimes transmit times are more important than efficiency (like in games!!!). To turn off the buffering and have the data sent immediately as its written, just turn on the TCP_NO_DELAY option (see setsocketopt call). This will force data to be transmitted to the client as soon as it is written.
These may not be the problems you are having, but these were a couple that I ran into along the way.
November 24, 2003 07:17 AM
I believe example 4 from the ReplicaNet SDK shows what you want to achieve. You can download it from www.replicanet.com
Hi ,
make sure you can send and receive data true network sockets ... you could use the Windows API to do that, but i''m sure there is a less obscure way t do it ...
Once you can send data, make yourself a protocol:
before sending the coords of your teapot, send a string anouncing the data you will send ... send "TEAPOT_POSXY" and then send (18, 24) ... (it''s just an example ...
)...
The protocol should be known to each application (each client...) ...
The last time I used sockets and stuff, it was with Java langage wich made it really easy ... i''m not sure with Windows though ... check on google.com for opening network sockets in C/C++ .... keep us posted , my game project will soon come to opening sockets in Windows
)
!!
Regards!
- Moonover
make sure you can send and receive data true network sockets ... you could use the Windows API to do that, but i''m sure there is a less obscure way t do it ...
Once you can send data, make yourself a protocol:
before sending the coords of your teapot, send a string anouncing the data you will send ... send "TEAPOT_POSXY" and then send (18, 24) ... (it''s just an example ...
![](smile.gif)
The protocol should be known to each application (each client...) ...
The last time I used sockets and stuff, it was with Java langage wich made it really easy ... i''m not sure with Windows though ... check on google.com for opening network sockets in C/C++ .... keep us posted , my game project will soon come to opening sockets in Windows
![](smile.gif)
!!
Regards!
- Moonover
- Moonover "We shall descend"
November 25, 2003 07:42 PM
I would recommand using Quazal Net-Z Personal Edition. It''s free for personal use, recommended by professional game developers and available on any platform, including consoles... http://www.quazal.com
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement