RakNet - networking

Started by
18 comments, last by heythere 16 years, 6 months ago
I'm checking into RakNet but it's a pain in the ass to setup. All the docs and tutorials are out of date, and compiling their already existing projects are out of the question. are there any other networking libraries anyone can recommend, or any good tutorials on how to start? All my books are out of date (use DirectPlay) and I want to start programming the server/client before any 3D stuff gets in. My goal is to have a basic chat program working, where I can send data to the server and have numerous clients on at one time. Once I learn how to send data, I can then upgrade to game specific code, and finally to the 3D rendering on the clients. Thanks, -Gardon
Advertisement
Quote:compiling their already existing projects are out of the question


Some helpful meta-advice: If you don't want to put in any effort, you're unlikely to learn anything. If you don't know your tools well enough to deal with slight version changes, then you're unlikely to be ready for network programming.
enum Bool { True, False, FileNotFound };
Knowing how to code and knowing your compiler are two different things. Don't say I can't code because I can't work my compiler.

I've tried compiling their projects that they include in the download. I've checked the linker of those projects, and notice that everything is where it should be. So why do I still get linker errors?

Quote:Original post by heythere
Knowing how to code and knowing your compiler are two different things. Don't say I can't code because I can't work my compiler.

I've tried compiling their projects that they include in the download. I've checked the linker of those projects, and notice that everything is where it should be. So why do I still get linker errors?


If you don't know and you are reading the errors, how on earth are we supposed to know without them?

<hint>post the errors</hint> [smile]
The docs are horribly out of date, but the samples (at least the ones I used) compiled fine.

Really, while up to date docs would be great, the source is fairly well documented, and using the samples (I recommend ServerClientTest) as a reference, it should be trivial to implement the functionality you desire.

Don't give up, post the error; once you have it linking, you're really under an hour away from your goal.
1>LINK : fatal error LNK1104: cannot open file 'ws2_32.lib'

The lib file is included in the linker... so it knows about it. The .dll file is in the current directory. I went to Project->Options->VC++ Directories and told the compiler where it was. Why can't it find it!!?


another problem is dealing with .CRT extentions. It keeps giving me these errors regarding framework and .crt.
I just tried the "ServerClientTest" Sample. I opened up the visual studio.net 2003 version, and hit build. Here's my list:


ServerClientTest fatal error LNK1120: 5 unresolved externalsc:\Documents and Settings\Jason\Desktop\RakNet30Beta\Samples\ServerClientTest\ServerClientTest.cpp(143): warning C4305: '=' : truncation from 'int' to 'unsigned short'c:\Documents and Settings\Jason\Desktop\RakNet30Beta\Samples\ServerClientTest\ServerClientTest.cpp(143): warning C4309: '=' : truncation of constant valuec:\Documents and Settings\Jason\Desktop\RakNet30Beta\Samples\ServerClientTest\ServerClientTest.cpp(189): warning C4101: 'clientIndex' : unreferenced local variableServerClientTest warning LNK4078: multiple '.CRT' sections found with different attributes (40300040)ServerClientTest error LNK2001: unresolved external symbol ___CxxFrameHandler3ServerClientTest error LNK2001: unresolved external symbol ___CxxFrameHandler3ServerClientTest error LNK2001: unresolved external symbol ___CxxFrameHandler3ServerClientTest error LNK2001: unresolved external symbol ___CxxFrameHandler3ServerClientTest error LNK2019: unresolved external symbol ___CxxFrameHandler3 referenced in function "public: __thiscall TCPInterface::TCPInterface(void)" (??0TCPInterface@@QAE@XZ)ServerClientTest error LNK2001: unresolved external symbol ___CxxFrameHandler3ServerClientTest error LNK2001: unresolved external symbol ___CxxFrameHandler3ServerClientTest error LNK2001: unresolved external symbol ___CxxFrameHandler3ServerClientTest error LNK2019: unresolved external symbol ___CxxFrameHandler3 referenced in function __unwindfunclet$?AddReference@StringCompressor@@SAXXZ$0ServerClientTest error LNK2001: unresolved external symbol ___CxxFrameHandler3ServerClientTest error LNK2001: unresolved external symbol ___CxxFrameHandler3ServerClientTest error LNK2001: unresolved external symbol ___CxxFrameHandler3ServerClientTest error LNK2019: unresolved external symbol ___CxxFrameHandler3 referenced in function "public: __thiscall Router::Router(void)" (??0Router@@QAE@XZ)ServerClientTest error LNK2019: unresolved external symbol ___CxxFrameHandler3 referenced in function __ehhandler$?GetRakPeerInterface@RakNetworkFactory@@SAPAVRakPeerInterface@@XZServerClientTest error LNK2001: unresolved external symbol ___CxxFrameHandler3ServerClientTest error LNK2001: unresolved external symbol ___CxxFrameHandler3ServerClientTest error LNK2001: unresolved external symbol ___CxxFrameHandler3ServerClientTest error LNK2001: unresolved external symbol __wassertServerClientTest error LNK2019: unresolved external symbol __wassert referenced in function "public: virtual __thiscall CommandParserInterface::~CommandParserInterface(void)" (??1CommandParserInterface@@UAE@XZ)ServerClientTest error LNK2001: unresolved external symbol __wassertServerClientTest error LNK2001: unresolved external symbol __wassertServerClientTest error LNK2001: unresolved external symbol __wassertServerClientTest error LNK2001: unresolved external symbol __wassertServerClientTest error LNK2019: unresolved external symbol __wassert referenced in function "public: bool __thiscall ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer(char const *,int,struct SystemAddress,class DataStructures::List<class PluginInterface *> &,int)" (?HandleSocketReceiveFromConnectedPlayer@ReliabilityLayer@@QAE_NPBDHUSystemAddress@@AAV?$List@PAVPluginInterface@@@DataStructures@@H@Z)ServerClientTest error LNK2001: unresolved external symbol __wassertServerClientTest error LNK2001: unresolved external symbol __wassertServerClientTest error LNK2001: unresolved external symbol __wassertServerClientTest error LNK2001: unresolved external symbol __wassertServerClientTest error LNK2001: unresolved external symbol __wassertServerClientTest error LNK2019: unresolved external symbol __wassert referenced in function "public: __thiscall DataStructures::Map<int,class HuffmanEncodingTree *,∫ __cdecl DataStructures::defaultMapKeyComparison<int>(int const &,int const &)>::~Map<int,class HuffmanEncodingTree *,∫ __cdecl DataStructures::defaultMapKeyComparison<int>(int const &,int const &)>(void)" (??1?$Map@HPAVHuffmanEncodingTree@@$1??$defaultMapKeyComparison@H@DataStructures@@YAHABH0@Z@DataStructures@@QAE@XZ)ServerClientTest error LNK2001: unresolved external symbol __wassertServerClientTest error LNK2001: unresolved external symbol __wassertServerClientTest error LNK2019: unresolved external symbol __wassert referenced in function "public: bool __thiscall Router::Send(char *,unsigned int,enum PacketPriority,enum PacketReliability,char,class SystemAddressList *)" (?Send@Router@@QAE_NPADIW4PacketPriority@@W4PacketReliability@@DPAVSystemAddressList@@@Z)ServerClientTest error LNK2019: unresolved external symbol __wassert referenced in function "public: virtual enum PluginReceiveResult __thiscall ConnectionGraph::OnReceive(class RakPeerInterface *,struct Packet *)" (?OnReceive@ConnectionGraph@@UAE?AW4PluginReceiveResult@@PAVRakPeerInterface@@PAUPacket@@@Z)ServerClientTest error LNK2019: unresolved external symbol __wassert referenced in function "public: virtual bool __thiscall RakPeer::Startup(unsigned short,int,struct SocketDescriptor *,unsigned int)" (?Startup@RakPeer@@UAE_NGHPAUSocketDescriptor@@I@Z)ServerClientTest error LNK2001: unresolved external symbol __wassertServerClientTest error LNK2019: unresolved external symbol __wassert referenced in function "public: void __thiscall ReplicaManager::Construct(class Replica *,bool,struct SystemAddress,bool)" (?Construct@ReplicaManager@@QAEXPAVReplica@@_NUSystemAddress@@1@Z)ServerClientTest error LNK2019: unresolved external symbol __wassert referenced in function "public: virtual bool __thiscall LogCommandParser::OnCommand(char const *,unsigned int,char * *,class TransportInterface *,struct SystemAddress,char const *)" (?OnCommand@LogCommandParser@@UAE_NPBDIPAPADPAVTransportInterface@@USystemAddress@@0@Z)ServerClientTest error LNK2019: unresolved external symbol @_RTC_CheckStackVars2@12 referenced in function "public: virtual bool __thiscall RakPeer::RPC(char const *,char const *,unsigned int,enum PacketPriority,enum PacketReliability,char,struct SystemAddress,bool,unsigned int *,struct NetworkID,class RakNet::BitStream *)" (?RPC@RakPeer@@UAE_NPBD0IW4PacketPriority@@W4PacketReliability@@DUSystemAddress@@_NPAIUNetworkID@@PAVBitStream@RakNet@@@Z)ServerClientTest error LNK2001: unresolved external symbol @_RTC_CheckStackVars2@12ServerClientTest error LNK2019: unresolved external symbol __alloca_probe_16 referenced in function "public: virtual bool __thiscall RakPeer::RPC(char const *,char const *,unsigned int,enum PacketPriority,enum PacketReliability,char,struct SystemAddress,bool,unsigned int *,struct NetworkID,class RakNet::BitStream *)" (?RPC@RakPeer@@UAE_NPBD0IW4PacketPriority@@W4PacketReliability@@DUSystemAddress@@_NPAIUNetworkID@@PAVBitStream@RakNet@@@Z)ServerClientTest error LNK2001: unresolved external symbol __alloca_probe_16ServerClientTest error LNK2019: unresolved external symbol @_RTC_AllocaHelper@12 referenced in function "public: virtual bool __thiscall RakPeer::RPC(char const *,char const *,unsigned int,enum PacketPriority,enum PacketReliability,char,struct SystemAddress,bool,unsigned int *,struct NetworkID,class RakNet::BitStream *)" (?RPC@RakPeer@@UAE_NPBD0IW4PacketPriority@@W4PacketReliability@@DUSystemAddress@@_NPAIUNetworkID@@PAVBitStream@RakNet@@@Z)ServerClientTest error LNK2001: unresolved external symbol @_RTC_AllocaHelper@12
Here's another example from the book "Multiplayer Game Programming". He includes VC++ projects on his cd that we can use, but it doesn't work. I've linked the DirectX SDK (includes and .lib files), added them to the linker, and check it out:

1>dxutil.cpp1>c:\documents and settings\jason\desktop\game programming folder\multiplayer game programming\html\source\chapter17\rpgquest\dxutil.cpp(10) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory1>Object3DClass.cpp1>c:\documents and settings\jason\desktop\game programming folder\multiplayer game programming\html\source\chapter17\rpgquest\object3dclass.h(1) : fatal error C1083: Cannot open include file: 'd3dx8': No such file or directory1>RPGQuest.cpp1>c:\program files\microsoft directx sdk (april 2007)\include\dplay8.h(13) : fatal error C1083: Cannot open include file: 'ole2.h': No such file or directory1>SoundSystem.cpp1>c:\program files\microsoft directx sdk (april 2007)\include\dmusici.h(13) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory1>Generating Code...1>Build log was saved at "file://c:\Documents and Settings\Jason\Desktop\GAME PROGRAMMING FOLDER\Multiplayer Game Programming\html\Source\Chapter17\RPGQuest\Debug\BuildLog.htm"1>RPGQuest - 4 error(s), 0 warning(s)========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



You mean to tell me window.h doesn't exist? Or DirectX? Come on.
I just started using RakNet also, and I find the DLL version has problems, however, using the source code itself works fine.

While the tutorials are out of date, saying they are 'horribly out of date' is a bit of a exageration. The newest build, the beta 3.x, renamed a few functions and structures, and the tutorials and Doxygen manuals haven't been updated yet, probably because it's still beta and so not everone is using it yet. All you need to do is find the .txt changefile included with the download, and see what has been renamed to what. For instance, the 'PlayerID' struct has been renamed 'SystemAddress'.

I'm sure the tutorials will be updated once it's not longer beta. I do wish I could get the DLL working, though, including 50 or so source files to my projects isn't the neatest solution. [smile]

(Here's a copy and paste of the upgrade in names from version 2.x to version 3.x)
1. Renamed PlayerID SystemAddress2. Replaced RakClient and RakServer with RakPeer (RakPeer is more powerful and does everything the other two did)3. Removed Multiplayer class (Parse your own messages)4. Removed Static Data (Send your own per-system data if you do indeed want per-system data)5. Removed MasterServer / MasterClient (Use lightweight database instead)6. Removed ID_RESERVED9.  Use ID_USER_PACKET_ENUM instead.7. Renamed PacketEnumerations MessageIdentifiers8. Renamed Disconnect Shutdown and OnDisconnect OnShutdown9. Renamed Initialize Startup10. StringCompressor now supports multiple trees, for different encodings such as different languages.11. Added existingReplica to the ReplicaManager::SetReceiveConstructionCB callback.12. Removed SystemIDToDottedIP and IPToSystemID since equivalents of both of those functions are in the SystemAddress structure itself now13. Renamed NetworkTypes.h RakNetTypes.h14. Renamed UNASSIGNED_PLAYER_ID UNASSIGNED_SYSTEM_ADDRESS16. Removed Bitstream_NoTemplate.17. Added more information to RPCParameters and the RPC funtion now takes a pointer to a timestamp, rather than a boolean (for shiftTimestamp).  Pass 0 to not include a timestamp.18. Renamed RakNetStatisticsStruct to RakNetStatistics19. ReplicaManager no longer takes C callbacks.  It instead takes class interfaces.20. Renamed NetworkIDGenerator to NetworkIDObject.
Quote:Original post by heythere
I'm checking into RakNet but it's a pain in the ass to setup. All the docs and tutorials are out of date, and compiling their already existing projects are out of the question.


Ah, the utopian world of software development, where documentation is up to date... Or there even is one.

For list of alternate libraries, look into forum FAQ.

Even boost's library is a bit of mess when it comes to documentation. It fails to explain some crucial design issues, and the boost/non-boost documentation differs in depth.

This is the reality of real world software development.

This topic is closed to new replies.

Advertisement