Rak ’em Up…

I’m at the point in my engine development where I need to start integrating some net code before I go any further. Like the physics support, networkable objects and net code in general are components I’d like to have as part of the engine’s core functionality rather than tacked on later. I’ve worked with a few network solutions in the past (OpenTNL and RedDwarf), but I decided to use RakNet this time. It’s free to use up to a certain revenue cap, and it’s cross-platform. Perfect!

RakNet only comes with projects for Visual Studio, not Xcode, so I started by loading it onto my desktop machine first. Everything worked out of the box and I was able to run some of the sample use cases without any problems. Setting up Xcode projects for Mac and iPhone were equally straightforward, and I was able to run a chat server on the PC and have my Mac and iPhone connect to it:

I haven’t started to integrate anything into my engine code base yet, but I’m going to start work tomorrow. I did take a look at RakNet’s ReplicaManager though, which sounds extremely useful and will definitely be something I use. It’s essentially a set of classes that will handle replicating objects from the server to the client, or between peers. It’ll be a good foundation for the networked objects in my engine.

All in all, I’m very impressed with RakNet so far.



4 responses to “Rak ’em Up…

  • Paul Solt

    Hi Taylor,

    Do you have any pointers or tips for creating the Xcode project? I’m looking to use RakNet in my iPhone/iPad apps.

    Here’s my current work: http://www.ArtworkEvolution.com/

    Paul Solt

  • Taylor Petrick

    Hey Paul,

    Thanks for stopping in and commenting. I’m actually in the process of setting up an Xcode version of all the RakNet samples for Mac and iPhone. I hope to have this completed in a few days, at which point I plan to post it on the RakNet forum for download.

    If you’d like to take a look at it yourself, it’s not too difficult to set up. If you’ve been able to compile RakNet on Mac before, the process is virtually identical.

    I simply copied the contents of the RakNet source folder directly into my Xcode project and just compiled the entire codebase into my app. Somewhere in the app, AppDelegate in my case, I initialized the components of RakNet that were needed, such as RakPeer. I then set an NSTimer to update 60 times per second, which called the RakNet update methods.

    I would like to be able to compile a Framework for iOS instead of including the source manually, but I haven’t been able to figure out how to do this for the iOS platform. It only seems to work for OS X.

    I’m happy to send you an email once I have the Xcode projects complete.


  • Paul Solt

    Hi Taylor,

    Sounds good. Kevin from RakNet got me started with how he builds on Linux.

    (From within the /Source directory)
    g++ -lpthread -I./ ../Samples/BigPacketTest/BigPacketTest.cpp *.cpp

    You can’t create a Framework for iOS, you’ll have to create a static library. I’ve done that before for Boost, and I may do it for RakNet.

    I used lipo to create i386/Arm fat binaries on my boost iPhone post: http://paulsolt.com/2010/04/c-logging-and-building-boost-for-iphoneipad-3-2-and-macosx/

    Also, you’ll want to look at static libraries for iPhone here: http://www.clintharris.net/2009/iphone-app-shared-libraries/

    -Paul Solt

  • Taylor Petrick


    Thank’s for the links, compiling RakNet as a static library seems to do the trick. I’m going to take a look at lipo tonight as well as it sounds useful. I’m still relatively new to Xcode, having worked with it for only 3 months to my 3 years with MSVC++. There are plenty of differences in the IDE/platform to get used to, though I’m getting there. 😛


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: