Before you begin

Use the source, static lib ,or a DLL? RakNet includes the source and a pre-made DLL and static lib, along with the projects to make the DLL and static lib, and samples. You may use either in your game. During development, you will probably want to use the source so you can trace into the code for better control. During release, you will probably want to use a DLL so you don't have to make your game multithreaded, and for easier patching. Projects to build the DLL/Static Lib, and the samples, are provided for Microsoft Visual Studio .Net 2003 and 2005. Users of other compilers will have to make their own projects.

DLL Users

Creating a DLL Create a DLL project. I'll assume you know how to do this. In MSVC 7 you would create an empty project, then under Application Settings you check DLL and empty project. Add the source files under the /Source directory to the project. If you don't plan to use voice capabilities, leave out everything with "RakVoice" in the filename If you want to use voice capabilities, add the source files under the DependentExtensions\speex-x.x.xx\libspeex Add to "Additional Include Directories" your directory with the source files. Import ws2_32.lib, or wsock32.lib if you don't have Winsock 2 installed. In MSVC 7 you can right click on the project, select configuration properties / linker / input / additional dependencies and type "ws2_32.lib" in there. Set your project to use multi-threaded runtime libraries. In MSVC 7 you can right click on the project, select configuration properties / C/C++ / Code Generation / Runtime Library and change it to Multi-threaded (/MT). Optionally set your preprocessor directives. Then hit F7 or the equivalent to build your DLL and Lib.
Creating an empty DLL project in .net 2003
Setting Multithreaded debug in .net 2003
Including ws2_32.lib in .net 2003
Game Setup Copy the DLL you just created to your game in the same directory as the exe. The lib can be in any directory you want. Add the .lib to your project Add the required source files to your project: RakNetDefines.h Export.h RakPeerInterface.h RakNetworkFactory.h (Creates instances of the peer) RakNetTypes.h (Defines SystemAddress and Packet) PacketPriority.h. (Defines the PacketPriority and PacketReliability enumerations) BitStream.h If you want to jump right in, refer to the Basic code tutorial For more detail, refer to Detailed Implementation

Source users

Game Setup Add the source files under the /Source directory to the project. While not all of these are strictly necessary, the ones you don't use won't hurt you. However, if you don't plan to use RakVoice, you should not include anything with RakVoice in the filename or otherwise you will have to include all the speex files. If you plan to use RakVoice, add the source files under the DependentExtensions\speex-x.x.xx\libspeex directory. If you plan to use RakVoice, add to "Additional Include Directories" the ..\..\..\Source;..\..\..\speex-1.1.4\libspeex Import ws2_32.lib, or wsock32.lib if you don't have Winsock 2 installed. In MSVC 7 you can right click on the project, select configuration properties / linker / input / additional dependencies and type "ws2_32.lib" in there. Set your project to use multi-threaded runtime libraries. In MSVC 7 you can right click on the project, select configuration properties / C/C++ / Code Generation / Runtime Library and change it to Multi-threaded (/MT). Set an additional include path to include the RakNet source (if you copied the source files to a different directory). Optionally set your preprocessor directives.
Setting Multithreaded debug in .net 2003
Including ws2_32.lib in .net 2003

See Also

Index Introduction System Overview Detailed Implementation Tutorial Preprocessor directives