Jump to content

Network Gaming, use sockets or SQL?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
11 replies to this topic

#1
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
I was thinking, which is the best way to use for multiplayer games... use sockets or one centralized server with a database and a table holding all the info (for example the x,y of the player etc) and the clients will always get that data.. i know it might be slower, but isn't that worth it.. because that way you will not have to design a server side, because the db will have everything, so you will concentrate on the client side only.. is that better or worse?

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
I think it depends on the type of game. A lot of LAN games simply have a "master" client and a bunch of other clients. I'm thinking of StarCraft/WarCraft as an example. Other games lend themselves well to the Client/Server model.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
But do you think it will lag a lot because of the queries and such?

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
It depends on the optimizations and size of the database. Network traffic is more likely to cause lag than DB access.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#5
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
So basically the DB approach is more feasible in most scenarios? Hmm.. good, I thought it was the other way round.

#6
Guest_Jordan_*

Guest_Jordan_*
  • Guests
I've found that client-to-client often lag more than client-to-server games. Many of the XBox 360 games (IE: Gears of War) use a client-to-client connection model. If the user that is the server suddenly starts downloading something on another device in the house, the entire game lags for everyone.

#7
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
Yeah, but you can still make a dedicated server client, and the clients connect to that.. to avoid the problem you are stating.

#8
Guest_Jordan_*

Guest_Jordan_*
  • Guests
You mean client-to-server or you mean make a player a server?

#9
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
Uhm, I forgot the exact terms, but one is the server software that 'listens' and the client is the one that will connect to that software... so in order to overcome your problem just make a dedicated server (hardware) as a server (using software)

#10
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
Keep scalability in mind. In a client-to-server model, the performance often depends on the server which can become expensive. However, in a peer-to-peer model, that cost is handed off to the client. If the software engineer is clever enough when designing the application layer protocol, one laggy peer should not effect the entire network.

#11
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
But what if the laggy peer is the server? What can you do bout that (except finding a better peer)?

#12
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
In a peer-to-peer model, we assume there are multiple peers. Every peer is both a server and a client. If one peer is slow, the software should find a faster one - which can be implemented in numerous ways. This is what a decent BitTorrent client usually does.