Cross-Platform Networking

Started by
12 comments, last by CMelissinos 15 years, 5 months ago
Hello, For a few years, I have been learning programming in C++ in hopes of making a cross-platform, networkable game. Now that I've gotten to the networking stage, I don't know where to go. Are there any libraries / networking tools that I can use to network games, on both Mac OS X and Windows? Help is appreciated and thanks in advance! adam_o
_______________________My computer stats:Xcode 3.1.2Mac OS 10.5.8---Visual C++ 2008 Express EditionWindows XP---NetBeansUbuntu 9.04---Help needed here!
Advertisement
Forum FAQ probably lists all of them.
I looked over that list and was confused by whether they were cross-platform or not, because they talked about WinSockets, which (correct me if I'm wrong) don't sound very Mac friendly.

A short list of some cross-platform networking tools would be helpful.

All help is appreciated and thanks in advance!

adam_o
_______________________My computer stats:Xcode 3.1.2Mac OS 10.5.8---Visual C++ 2008 Express EditionWindows XP---NetBeansUbuntu 9.04---Help needed here!
Quote:Original post by adam_o
I looked over that list and was confused by whether they were cross-platform or not, because they talked about WinSockets, which (correct me if I'm wrong) don't sound very Mac friendly.


Next step after looking at the list is to click on the links, and look on front page of the project, where things like this are listed:

HawkNL:
Quote:NL has been tested on Windows® 9x/ME/NT/2000/XP/CE, Linux®, Solaris™, IRIX®, AIX®, BSDs, Mac OS®


Pegasus:
Quote:This includes Win32, Linux, and a majority of Unix implementations.


SDL_Net:
Quote:MacOS X
SDL_net-1.2.7.dmg


Boost::ASIO
Quote: Boost's primary test compilers are:

* GCC 4.01 on Mac OS X 10.4.10 with both Intel and Power PC


ClanLib:
Quote:Feature Highlights

* BSD style license
* Supports Windows, Linux and Mac OS X


Massiv:
Quote:Operating System: MacOS, Windows, Linux


And so on...


Generally, SDL_net or RakNet seem to be popular with beginners. They also seem to contain a support forums for various library issues, as well as plenty tutorials.

For future reference:
Mac OSX is considered Unix-like OS
Sockets usually imply Berkeley sockets and are generally supported on all OSes (with minor differences)
WinSock is Windows implementation of Berkeley sockets (at core, it now does a lot more too)
The C++ compiler for Xcode is GCC (typical compiler for most unix/linux).
Wow, that was very helpful, thank you. Antheus++.

I'll probably go with SDL_Net, since I'm using SDL in my project to begin with.
_______________________My computer stats:Xcode 3.1.2Mac OS 10.5.8---Visual C++ 2008 Express EditionWindows XP---NetBeansUbuntu 9.04---Help needed here!
Quote:Original post by adam_o
I'll probably go with SDL_Net, since I'm using SDL in my project to begin with,
Note that SDL_net is very low-level, basically a cross-platform wrapper of TCP and UDP sockets. RakNet and enet are both worth a look if you want something higher-level.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Quote:Original post by swiftcoder
Note that SDL_net is very low-level, basically a cross-platform wrapper of TCP and UDP sockets. RakNet and enet are both worth a look if you want something higher-level.

I'll check those out if I should need to, but for now, all I need is a simple "wrapper". What would be the advantages of the "high level" things that you mention?
_______________________My computer stats:Xcode 3.1.2Mac OS 10.5.8---Visual C++ 2008 Express EditionWindows XP---NetBeansUbuntu 9.04---Help needed here!
Quote:Original post by adam_o
Quote:Original post by swiftcoder
Note that SDL_net is very low-level, basically a cross-platform wrapper of TCP and UDP sockets. RakNet and enet are both worth a look if you want something higher-level.

I'll check those out if I should need to, but for now, all I need is a simple "wrapper". What would be the advantages of the "high level" things that you mention?


What you need for:
Quote:cross-platform, networkable game

- Socket abstraction (macro/typedef of OS Berkeley socket API)
- Some way to serialize data
- Some form of connection management (bandwidth, error handling, reliable/unreliable)
- A network-aware game loop (mechanism to synchronize state between peers or clients/server)

Higher level libraries typically provide all of those and a bit more.

Again, forum FAQ contains tutorials (see Q1) which are very on topic and come with source code. Later articles discuss above issues, as well as several examples on how the elementary aspects work. Q28 and Q29 however show perhaps the simplest real-world capable architecture.
Let me briefly rephrase and better define what I'm working on. I'm porting an old (9 years old) game from Mac OS 9 to OS X. The game currently uses GameRanger, which is a Mac-only networker. Now, this will work just fine if I only wanted to port to OS X, but another goal is to possibly port to Windows. If I were to do that, I would need something that worked with Windows as well.

Because this game is very old, it doesn't need much data to be transmitted, and if I used something simple, I think I might be able to get the job done. That being said, would you still recommend those networking things at the higher level?
_______________________My computer stats:Xcode 3.1.2Mac OS 10.5.8---Visual C++ 2008 Express EditionWindows XP---NetBeansUbuntu 9.04---Help needed here!
I suggest you read through the questions in the Forum FAQ, and make up your own mind. The best way to learn is to try it, and see what happens.
enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement