I am making a Pac-Man clone currently. I wish to add network play to the game. I am looking for an API that is robust and fast. Something I can grow with. What is a good API if I have some network experience with winsock?
Cross-Platform Networking API
Assuming you are using C or C++ you can use the preprocessor to program with winsock on Win and Berkeley sockets on any unixoid system (including Linux and MacOS). Use #ifdef, #define etc. Most of the sockets code is equal for Win and unixoid systems.
BTW In the book “Hands on network programming in C” you find source code that does this.
But perhaps you want to avoid the low-level code for network programming? Then there are several engines. That can be fast and robust, too.
I'd also recommend looking at Beej's guide to network programming.
More precisely this part - https://beej.us/guide/bgnet/html/split-wide/intro.html#windows - which describes differences between Windows and *nix sockets in his implementations. His whole book is quite good tbh.
My current blog on programming, linux and stuff - http://gameprogrammerdiary.blogspot.com
scruthut said:
Something I can grow with.
That point is the kicker. Raw sockets is great if all you need is simple connectivity. Not so great for modern features. And nothing to grow with unless you want to re-invent the wheel for everything.
ENet is probably the closest mix between simplicity and raw code in C++, giving a fair amount of features while still being small and simple enough to easily understand. It doesn't do major features like encrypted communication since people expect TLS/DTLS as standard features these days, it leaves IP addresses as fully exposed as there are no relays, so exposing people to DDoS attacks is a concern, there are no parties or sessions, nothing persistent, or any of the assorted other features people have come to expect in modern network games.
Despite the drawbacks ENet gives a good mix of features. It's C++ that you wanted. It's easy to mix sequencing with reliable ordered, reliable unsequenced, and unreliable (fastest) sequencing, handles details around connection handshaking and peer identification, throttling, a framework for compression and a few other features. Plus it's already written and debugged.
If you don't mind the black box, the Steamworks libraries are straightforward to work with with all the modern features and inconveniences.