3 Replies - 1784 Views - Last Post: 07 December 2010 - 11:08 AM Rate Topic: -----

#1 lexxe  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 4
  • View blog
  • Posts: 44
  • Joined: 05-December 10

P2P connection

Posted 05 December 2010 - 11:49 PM

Here is what I'm doing. This is my first project, and its going to be a simple fighting game. Its going to be glorified rock, paper, scissors. I'm going to have a couple different characters people can pick from, and play vs computer or a second player. Is there a way(how would I do it) to do an online fight against another person(obviously I'd need a server or something to run this through) or could i do a direct connect to their ip address?

Again, this is my first program, so this is a little more advanced than I'm capable of, but any help would be appreciated.

Is This A Good Question/Topic? 0
  • +

Replies To: P2P connection

#2 mavarazo  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 37
  • View blog
  • Posts: 182
  • Joined: 25-October 10

Re: P2P connection

Posted 06 December 2010 - 12:18 AM

P2P Connection is always a bit tricky (firewall, router-config, etc.).

Anyway, define a class to handle the communiction. You need the IP-Address and a port to handle it. Make a method to send a command and one that listens on the port to retrieve a message.
Read some infos on wikipedia of network communictation to get some ideas how to improve it.
Was This Post Helpful? 1
  • +
  • -

#3 CodeGrappler  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 41
  • View blog
  • Posts: 120
  • Joined: 29-November 10

Re: P2P connection

Posted 06 December 2010 - 11:45 AM

You will want to look at TcpListener and TcpClient

You can have the client start a TcpListener if the player chooses to host a game and you could have the client start a TcpClient if it's going to be connecting to a host.

As far as the firewall and router issues go you will want to look up UpNp for port forwarding.
Was This Post Helpful? 1
  • +
  • -

#4 lexxe  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 4
  • View blog
  • Posts: 44
  • Joined: 05-December 10

Re: P2P connection

Posted 07 December 2010 - 11:08 AM

Thanks a bunch for both of your replies. I'm still in the planning stage of my program, and I'm going to tackle getting the basics down. I'll keep this thread updated in the future if/when I get to this stage in development.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1