RakNet Take Two

I made my first pass at integrating RakNet into my engine today. I ended up going with the following class inheritance structure for bringing it into the mix:

Red is RakNet and Purple are components of my own engine. So far the only class that actually makes use of the functionality in NetObject is my PhysicsCube that I’ve been using in the last few posts, but it’s very easy to extend any SceneObject derived class to be networkable.

To test out the integration I decided to try running my physics simulation entirely on the server. For ease of use I temporarily forked my codebase into two separate Xcode projects: one for the server and one for the client. All of the rendering code was stripped out of the server build, and physics disabled on the client build. The server handled all the physics simulation and would send updated positions/rotations to the client. In addition to testing RakNet’s basic networking features, the setup also allowed me to use RakNet::Replica’s syncing feature that keeps new clients up to date with the scene as they join. Here are a few shots of the system in action on the iPad simulator:

And one from my iPhone, just as new cubes were added to the scene on the server:

Overall I’m very happy with how RakNet is functioning. In the next few days I’m going to try to get some more interesting things in the scene, as I’m getting a bit tired of the cubes. 😛 I’m hoping to have some basic player-like functionality in place by the end of the week and hopefully a functional Mac and Windows client to go with the iPhone one.



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: