Sign in to follow this  
adam_o

Cross-Platform Networking

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
Quote:
Original post by hplus0603
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.


I'd like to know if something won't work out ahead of time, instead of dumping hours of work into it, and then learning that it won't suit my needs.

Share this post


Link to post
Share on other sites
Quote:
Original post by adam_o
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.


OpenPlay appears to be open source, and it claims to be cross-platform on project page.

Given that GameRanger appears to be somewhat comprehensive library, I'd say trying to migrate to OpenPlay would be your best bet.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this