![]() |
What is the difference between the license versions? The freeware license can only be used for non-commercial games. The shareware license can only be sold, resold, or distributed electronically. The commercial license can be distributed normally. All licenses can support any number of players. I get error LNK2001: unresolved external symbol ___security_cookie MSVC .net puts this in libs and dlls by default and it is not supported in MSVC 6. You'll have to rebuild the lib using your own compiler. I get very high pings, even to the local system Use 0 for the sleep timer, and put a Sleep(0) in your main game loop. This will ensure responsive context switches. I hit an assert packetsReleased==0. This is the packet pool reporting that all packets allocated were not released. This will sometimes hit on shutdown if you rely on the destructor to shutdown RakNet and/or don't call RakNetworkFactory::DestroyRak*Interface. It is due to the order of the destructor calls for global objects. You can ignore it or comment it out in that case. If it happens every time, then you really are not returning allocated packets to the pool via DeallocatePacket How should I deal with firewalls? Be sure to specify that your end-users need to open the appropriate ports, or use a port that is probably already open (such as the http port). One way to reduce tech support calls in this regard is to have your application try connecting a local client to a local server. If you can't connect after a couple of tries then the user probably has a firewall blocking this. You can message the user in-game that they probably have a firewall that needs to be turned off on whichever port your game uses. I get linker errors such as: unresolved external symbol "public: static void __cdecl ClientServerFactory::DestroyRakClientInterface(class RakClientInterface *)" You didn't link the library into your project. You must have the .lib and not the .dll in the project. See Compiler Setup I get conflicting lib errors such as follows LIBCMT.lib(dosmap.obj) : error LNK2005: __dosmaperr already defined in LIBCD.lib(dosmap.obj) LIBCMT.lib(mbctype.obj) : error LNK2005: __getmbcp already defined in LIBCD.lib(mbctype.obj) LIBCMT.lib(mbctype.obj) : error LNK2005: __setmbcp already defined in LIBCD.lib(mbctype.obj) LIBCMT.lib(mbctype.obj) : error LNK2005: ___initmbctable already defined in LIBCD.lib(mbctype.obj) LIBCMT.lib(tolower.obj) : error LNK2005: __tolower already defined in LIBCD.lib(tolower.obj) LIBCMT.lib(tolower.obj) : error LNK2005: _tolower already defined in LIBCD.lib(tolower.obj) LIBCMT.lib(isctype.obj) : error LNK2005: __isctype already defined in LIBCD.lib(isctype.obj) LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library You need to select Multithreaded Debug and Multithreaded libraries in the project options. I get linker errors about the bitstream class Sometimes the DLL won't link in the bitstream class. Include Bitstream.h and Bitstream.cpp in your project. I can't connect to the other system or other systems can't connect to me. What are some possible reasons?
i.e. - error C2011: 'WSAData' : 'struct' type redefinition i.e. - warning C4005: 'SO_DONTLINGER' : macro redefinition Add this to your preprocessor definitions _WINSOCKAPI_ In .Net this would be project / configuration properties / C/C++ / Preprocessor / Preprocessor defintions. You will get this or a similar warning: warning C4005: '_WINSOCKAPI_' : macro redefinition unknown(0) : see previous definition of '_WINSOCKAPI_' You can ignore it. When ever I define __USE_IO_COMPLETION_PORTS I get a huge number of errors. All of them are of the type: winsock2.h(2353) : error C2375: 'WSAAsyncSelect' : redefinition; different linkage winsock.h(824) : see declaration of 'WSAAsyncSelect' One for each of the functions exported by winsock2. Windows.h has to be included after the Rak* headers. __USE_IO_COMPLETION_PORTS has to be defined globally, or before the headers. Object are never replicated on remote systems when using the DistributedNetworkObject class. You forgot to call DistributedNetworkObjectManager::Instance()->RegisterRakServerInterface(rakServer); and/or the version for the client. I'm running under high loads with hundreds to thousands of packets a second and after a short time some packets just don't arrive - even with RELIABLE OR very large files never arrive when I transfer them. You are probably overrunning the buffer RakNet uses to keep track of duplicate packets, so all further packets are treated as duplicates. Check the define MAX_AVERAGE_PACKETS_PER_SECOND in ReliabilityLayer.h. If you are sending more packets on average per second than MAX_AVERAGE_PACKETS_PER_SECOND then you should increase that number to match what you are sending (note - this is memory intensive). I can connect but don't get any data from the other system. What are some possible reasons? You aren't calling Receive. The other system didn't send any data, or didn't send any to you. The other system immediately kicked you after you connected, such as due to you being banned or using a wrong password. The network disconnected you because of cheating or because it couldn't deliver a reliable packet. Some kind of networked action happens twice, such as when I press the trigger to fire a bullet two bullets come out. The server is broadcasting to everyone, including the client that just initiated the action. To fix this, pass the playerId parameter of the packet to the playerId field of Server::Send when broadcasting. This will relay the message to all players BUT the sender. When I send some particular kind of packet, I immediately get flooded with hundreds of copies the same packet. This is a feedback loop, caused by the following sort of coding: // Client void DoMyFunctionA(void) { SendPacketToDoFunctionA(); } // Server void HandlePacketToDoFunctionA(void) { // Broadcast to all connected players SendToAllPacketToDoFunctionA(); } // Client void ReceivePacketToDoFunctionA(void) { DoMyFunctionA(); } To fix this, either don't have the function that does the action also send the packet, or use a parameter specifying whether to send a packet or not and set that parameter to false if the function is called from the network code. See Programming Tips for help on how to handle this. How do I create a master game browser? Use the MasterServer and MasterClient classes provided in Sample Applications Which version of the multithreaded library does RakNet use? Multithreaded (/MT) Since RakNet uses threads does my program need to use the multithreaded library? No, the threads are confined to the dll. Can I run more than one instance of the client or server on the same system? Yes, but each instance will have its own thread (except for IO completion ports, which share threads) and require its own memory. You'll need to remember to give different port assigments to each instance as well. If you use high priority threads they can slow down your system significantly. What's the largest packet I can send? About 6 1/2 MB. However, this is easily increased by increasing the size of the variables used for tracking the number of packet splits. If you want to send large files you may wish to use TCP as it is better for that sort of thing. How do I send files? Just send it as a data stream using RELIABLE, subject to the packet size restriction. If I purchase one license, can I use it in more than one game? A site license will allow you to do this. A normal license requires one copy of the license per game. Refer to the License Agreement for full details. My game is too laggy. How can I decrease lag? - Use bandwidth more efficiently (see the optimization section in Programming Tips ) - Design your game so it doesn't require as much bandwidth (see the optimization section in Programming Tips ) - Use high priority threads - Get a faster computer. This will make threads more responsive. - Get a better internet connection. - Decrease the number of clients allowed. Does RakNet use TCP at all? No. Will RakNet work with my game written in C? Not unless you are willing to use C++ interfaces. What OSes does RakNet support? Unix, Linux, and Windows. Theoretically it should also support the newer OS versions on the MAC that are based on Unix. Do you have any more complex examples? Not at this time. The goal of the examples is to present the networking code as cleanly as possible. Examples that are filled with windows code, helper classes, complicated class structures, external global variables, and other dependencies only make the program harder to follow. The sample games won't win any awards but in terms of clean code and design they will serve you far better. Having said that, a more sophisticated networking game is in the works to show off the networking capabilities of RakNet. |
![]() |
Index |