GameTorpedo.com
Home » Articles » Using RakNet - Part 1, InstallingWelcome, Guest | Register

What is Game Torpedo?

Game Torpedo is a site where indie game developers can easily promote and test their games and projects. Game Torpedo aims to take indie game development to a new level and best of all - It's completely free! Click to join »

Using RakNet - Part 1, Installing

Article written by: Zuka
Bookmark and Share


Hi there. Chances are you came to this article because you want to get started with multiplayer game programming. If you're not just getting started, then... don't go, you might still find this helpful.

Installing RakNet
Download the .zip from the RakNet website. Unzip it somewhere. Anywhere is fine, but I'm going to put mine in a common library folder (on my machine, F:\Exoterra\Engine\Libs\Raknet).

Now, in Visual C++, go to Tools. Click on "Options...". Go to "Projects and Solutions" on the tree-view. Under it, click VC++ Directories.

Now, there's a drop-down labeled "Show directories for:". Click the drop-down and go to "Include files". Click the new button (a folder with an asterisk) to make a new entry. Double-click it, and find where you unzipped RakNet. Now, there's a folder called "Source" in the RakNet directory. That's the one you want.

Now, go to "Library files" in "Show directories for:". Do the same, except, replace "Source" with "Lib".

Congratulations, you can now access RakNet in your projects.

Now, how do we set up a project? That depends. Do you want to use the DLL? Or would you rather make your executable larger?

Right. Make a new project, or open an existing one. Go to the Project menu, then open "(Project name) Properties" or press Alt+F7.

In the tree-view, expand Configuration Properties. Then go to Linker > Input. In Additional Dependencies, enter the following depending on the method you want to use.

Static Library (bigger .EXE)
RakNetLibStatic.lib

DLL
RakNetDLL.lib

Now, if you used the DLL, go to the Lib directory and copy RakNet.dll over to your project base directory. Now you can go on to the next part of this article series. Find "Using Raknet - Part 2, Client" if you want to make the client, or "Using RakNet - Part 2, Server".


Comments

The same libraries will usually work for both Debug and Release. If you want to compile in Release mode, repeat that last step where you're setting "Additional Dependencies" once you've switched to Release mode.

Oh, and I almost forgot. When you're setting the Additional Dependencies, don't forget to add "ws2_32.lib"! They should be separated with a space.
Like where this is going, even i prefer ENet :P
Well, I'll get around to the next part (client implementation) soon. Been a bit busy on my own game.


Leave a comment

Please log in or register to comment/vote.