Skip to main content
gamedev.net
🔒 Locked

Chatting concept

Started by Believe82 Apr 6, 2011 at 4:01 AM 4 replies 2.1k views
Original Post
Believe82
Believe82
Hello,

I am creating a multiplayer game chat system, and i would like to incorporate chat. Now i have some experience with Socket programming, but here's the bit that puzzles me. By the way i am also pretty new to game programming as well so everything i say is an assumption that could be very wrong.

I am wondering, in theory i will use a multiplayer game that could support say 30 players. I am assuming everyone inside this game is a client. How do players chat with other players, if say they selected chat with "this" person, would the message be routed to the server who figures out this person's IP address and Port then routes the message to him?

Does everyone connected to the game have their IP address and Port in some sort of Pool for this game session? So that when players select another player to chat with, their IP address and Port is already determined so the message is directly sent to them?

What is the type of network for a game chat system? For example... P2P, Star, Mesh etc...

On a sort of side note, just for network learning purposes so if anyone knows, what type of network is XFire?, Anyone know how you are able to chat with individual people?

Sorry for all the questions this has just been bugging me lately, thank you for any help.
mightypigeon
mightypigeon
Depends on your networking model (peer to peer or client/server). I'll assume you're going with client/server here.

For each client that is connected to the server, store an ID for it. When a new client connects, send it information about connected clients including their IDs, so each client can replicate this list on their end. Then when they want to send a chat message to a particular player, send a packet to the server specifying which client ID they wish to chat to. The server then forwards the message on to the receiver client. To do a group/global chat, then the server just pushes the chat message out to all clients.
[size="1"]
hplus0603
hplus0603

Does everyone connected to the game have their IP address and Port in some sort of Pool for this game session? So that when players select another player to chat with, their IP address and Port is already determined so the message is directly sent to them?


No, that won't work, because of NAT. (Well, you can often make it work, using NAT punch-through introduction, but it's generally not worth the effort if all you do it for is chat -- and it's not 100% anyway)

Generally, the client already has some identifier for each player, because it shows a list of the players, and it shows player entities on the screen. Thus, the client already knows that "entity 143 is player 'DoomNGloom'." Thus, when the player clicks on DoomNGloom and selects "send private chat message," the client can send a message to the server saying "this text is a private chat message to player 143."
In turn, the server already knows how to send messages to entities, because, well, that's what it does.
enum Bool { True, False, FileNotFound };
Believe82
Believe82
Thanks for the responses guys they clarified my questions a lot!

I was also wondering do you know what topology XFire kind of uses, or the very general basis networking wise of how it works?
frob
frob

I was also wondering do you know what topology XFire kind of uses, or the very general basis networking wise of how it works?



It uses multiple topologies, depending on what you are doing.

The peer-to-peer download support? I'm guessing that uses a peer-to-peer mesh. A set of in-game clients talking? I'm guessing also a P2P mesh. Their web interfaces? I'm guessing that's star (aka client/server) from your perspective and a full mesh server cluster for the backend perspective. Integration with other protocols? Again, star from your perspective, full mesh server cluster on the back end. VoIP is likely a direct connect or loose mesh.


But really, how does that matter in relation to your question?
Believe82
Believe82
Thanks for the response,

It didn't really have a relation to my question, I was just curious.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.