Jump to content

  • Log In with Google      Sign In   
  • Create Account

Networked Game


Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
4 replies to this topic

#1   Members   -  Reputation: 380

Like
0Likes
Like

Posted 10 January 2013 - 07:55 PM

Okay so. I'm working on a project for University. It's an FPS.

 

I have made a basic server and the client and server can communicate via UDP (fairly simple stuff)

 

My question basically is, how should I deal with sending data from the client to the server and broadcasting the data of all players back to the client.

 

I've never really done anything like this before so it's all new to me.

 

Any advice would be appreciated.


/********************************************************************************\
/**********************He Who Dares, Wins**********************************\
/********************************************************************************\

#2   Members   -  Reputation: 160

Like
0Likes
Like

Posted 10 January 2013 - 08:57 PM

I'd like to preface this with: I have very little networking experience, but I think I have a possible solution. 

  • When the user connects to the game, add their address info to a list or map. // This will allow you to send info to one person or iterate through them all. 
  • When a user sends info to the server and it determines what to do, send the response to everyone on the list or map

Let me know if that helps at all. 


-[My Blog]-


#3   Members   -  Reputation: 288

Like
0Likes
Like

Posted 10 January 2013 - 10:12 PM

first and foremost, your networking should have several components each running in different threads.

you should have a thread at the server that processes unreliable inputs from the client. Each time the server receives an input from the client, the client is simulated

and the time stamp is recorded.

At specific time intervals, another server thread, copy information on client states and send to all clients. Each of the threads must be mutex protected due to data sharing.

 

Have another thread handle reliable message both from server and client.

Have another thread recieve messages from server and client and send them to an input queue, reliable message queue, game update queue depending on the packet header

designed by you. each queue is dequeued by the threads that will process them and each queue must be mutex protected due to data addition and removal.

This is just a rough idea of how to go about it.



#4   Crossbones+   -  Reputation: 4230

Like
1Likes
Like

Posted 11 January 2013 - 01:56 PM

Please head over to the Networking Forum, and cehck out the FAQ.  There are tons of resources you can find there, and it's a better place for this question.

 

BTW, making a multiplayer FPS playable over the internet is HARD even for advanced programmer.  Good luck!


My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

#5   Crossbones+   -  Reputation: 4230

Like
0Likes
Like

Posted 11 January 2013 - 01:59 PM

first and foremost, your networking should have several components each running in different threads.

you should have a thread at the server that processes unreliable inputs from the client. Each time the server receives an input from the client, the client is simulated

and the time stamp is recorded.

At specific time intervals, another server thread, copy information on client states and send to all clients. Each of the threads must be mutex protected due to data sharing.

 

Have another thread handle reliable message both from server and client.

Have another thread recieve messages from server and client and send them to an input queue, reliable message queue, game update queue depending on the packet header

designed by you. each queue is dequeued by the threads that will process them and each queue must be mutex protected due to data addition and removal.

This is just a rough idea of how to go about it.

 

IMO, there's not real need for all these threads.  You can design a good networking system with threads, but unless you really know what you are doing, a simple loop with a select (or whatever networking API you use) can work just as good, or often better, as over-engineering can be an issue.


My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.




PARTNERS