Jump to content
  • entries
    940
  • comments
    5,894
  • views
    863,939

Networking


Josh

2,571 views

 Share

I spent a few days setting up a server application and attempting to implement NAT punch through. You can read the details of my adventures here.

Here's what I think:

  • I can probably get it working.
  • There's a lot of weird hardware and configurations out there I can't realistically test.
  • There will always be a certain failure rate which translates into angry users who I can't help.

So I started to think about this backwards, by first asking what we want the user experience to be. Here's what we want:

  • Fast and reliable P2P networking.
  • Public listing of game servers.
  • In-game voice communication.

And we have three possible ways to get there:

  • NAT punch-through with Leadwerks master server.
  • Packet relay with Leadwerks master server.
  • Steam networking.

What method gives us the best user experience? Steam networking will ultimately produce the lowest failure rate with the P2P communication.

What method is the easiest to implement? Steam networking already has the features we want working right now.

The only downside is that it won't function outside of Steam. If you are making a fast-paced multiplayer game Steam would be your only option for publishing. If you are building an application that cannot use Steam, you cannot use this for networking. I believe anyone can utilize Steam networking during testing using the "Spacewar" test app, and then when you get your own Steam app ID you can move over to that.

Considering these options, I think Steam networking is the right choice and I am going to proceed to implement this in Leadwerks 4.6. Accepting the limitation of Steam-only distribution for this is the way to move forward. We already are harnessing a lot of Steam features and it would be stupid not to take advantage of the most important one.

With any luck, we'll all be fragging and chatting online within six weeks.

TgWI68Q.thumb.png.2056065aa542af1b193268e1729e28aa.png

  • Like 3
 Share

5 Comments


Recommended Comments

Okay, Steamworks has two networking APIs. The first is older and works almost just like Enet. The newer recommended one is incredibly simple. I think this will actually boil down to just four commands for the basic networking:

bool P2P::Send(uint64_t steamid, BankStream* data, const int channel = 0, const int flags = 0)
bool P2P::Send(uint64_t steamid, Bank* data, const int channel = 0, const int flags = 0)
bool P2P::Send(uint64_t steamid, void* data, const int size, const int channel = 0, const int flags = 0)
Message* P2P::Read(uint64_t steamid, const int channel = 0)
bool P2P::AcceptConnection(uint64_t steamid)
bool P2P::Disconnect(const bool force = false)

If NAT punch-through fails then packets will be relayed through Steam servers.

Link to comment

I like that there is a strong, doable solution though I know you (and some customers) would have preferred to be independent from Steam.  Since you're already with Amazon, I'm surprised that there isn't a reliable solution through them with AWS or something.

Link to comment
19 hours ago, gamecreator said:

I like that there is a strong, doable solution though I know you (and some customers) would have preferred to be independent from Steam.  Since you're already with Amazon, I'm surprised that there isn't a reliable solution through them with AWS or something.

I think there is, but its through their game engine.

Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...