Jump to content
  • Advertisement

Mr_Fhqwhgads

Member
  • Content Count

    230
  • Joined

  • Last visited

Community Reputation

100 Neutral

About Mr_Fhqwhgads

  • Rank
    Member
  1. Mr_Fhqwhgads

    Bitstream packet null?

    Blah...I was wrong. SOC_GLOBAL_CHAT is a enum. :P I'll make it a const.
  2. Mr_Fhqwhgads

    Best Way to manage a list? Problem erasing

    Well...for some very strange reason after I close the client and it says that player disconnected, it says that he connected again. Raknet is making less and less sense every day. Time for a new network library maby? EDIT:: I think what I need to do is not add the player to the list when he connects, but when he tries to login.
  3. Mr_Fhqwhgads

    Best Way to manage a list? Problem erasing

    Quote:Original post by jyk Can you repost the code? It looks like some relevant portions of the example got omitted, and the braces don't appear to be correct. Opps, edited it. Hmmm.....I guess your right. For some reason its not finding the player...lemme stare at the code...:P EDIT: Ok, I got it working, now it says that it found it but it stills prints the playerID. case ID_DISCONNECTION_NOTIFICATION: { // Player Disconnected std::cout << "Player Disconnected"; for(std::list<CPlayer>::iterator itr = playerList.begin(); itr != playerList.end(); ++itr) { // If we found it if( itr->playerID == packet->playerId ) { std::cout << "\nWe Found It!\n"; itr = playerList.erase( itr ); break; } std::cout << "\nDidn't find it\n"; } } [Edited by - Mr_Fhqwhgads on January 26, 2007 12:11:45 AM]
  4. Hello, I have a list of players that when one disconnects, I want to erase it. case ID_NEW_INCOMING_CONNECTION: { // New Connection CPlayer player = CPlayer( packet->playerId ); playerList.push_back( player ); std::cout << "Incoming Connection - "; std::cout << packet->playerId.ToString() << "\n"; } case ID_DISCONNECTION_NOTIFICATION: { // Player Disconnected std::cout << "Player Disconnected"; for(std::list<CPlayer>::iterator itr = playerList.begin(); itr != playerList.end(); itr++) { // If we found it if( itr->getPlayerID() == packet->playerId ) { std::cout << "\nWe Found It!\n"; itr = playerList.erase( itr ); break; } } } But for some reason the object still exists? How do I delete it? [Edited by - Mr_Fhqwhgads on January 26, 2007 12:12:16 AM]
  5. Mr_Fhqwhgads

    Bitstream packet null?

    Quote:Original post by capricorn To mod: sorry for the second reply: proxy's strange, can't edit my posts normally. Mr_Fhqwhgads, Also a question: Does BitStream::Read() have more than one argument? BitStream::Write() can handle most anything because it uses templates, so a string does work. Yes, BitStream::Read() can take a second argument... BitStream::Read(templateType &var) BitStream::Read(char *output, const int numberOfBytes) I switched it to strings like you said and nothing outputted this time. So I assume there is a problem with getting th packetId. This is what SOC_GLOBAL_CHAT is: #define SOC_GLOBAL_CHAT 100
  6. Mr_Fhqwhgads

    Bitstream packet null?

    Hello, I'm trying to send a bitstream packet to the server except when the server receives then tries to std::cout the message it prints nothing but a blank space(which is how I know I received the packet and it is going to the right place in the switch event). Any idea why? Client: void CClientNetworkManager::sendGlobalMessage( const char *message ) { RakNet::BitStream stream; stream.Write( SOC_GLOBAL_CHAT ); stream.Write( message, sizeof(message) ); networkInterface->Send( &stream, HIGH_PRIORITY, RELIABLE_ORDERED, 0 ); } Server: RakNet::BitStream stream( packet->data, packet->length, false ); char packetId2; stream.Read( packetId2 ); switch( packetId2 ) { case SOC_GLOBAL_CHAT: { unsigned char message; stream.Read( message ); std::cout << message; continue; } } Its receiving a message because its entering the switch loop, but it won't print the message.
  7. Mr_Fhqwhgads

    yay linker errors

    Sweet, thanks!
  8. Mr_Fhqwhgads

    yay linker errors

    I'm trying to embed AngelScript into my program, but I'm getting these linker errors. I compiled the debug version using VC++ 05 express. Added the angelscriptd.lib to my project, added angelscript.h to my project and put the #define angelscript_dll_library_import and #include "angelscript.h" in my code. I tried to ignore LIBCMT.lib but I started getting problems with my other code. Sorry for the haste thread. 1>MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: __wassert already defined in LIBCMT.lib(wassert.obj) 1>MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: _free already defined in LIBCMT.lib(free.obj) 1>MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: _malloc already defined in LIBCMT.lib(malloc.obj) 1>MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: _fclose already defined in LIBCMT.lib(fclose.obj) 1>MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: _fprintf already defined in LIBCMT.lib(fprintf.obj) 1>MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: _strtol already defined in LIBCMT.lib(strtol.obj) 1>MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: _strtoul already defined in LIBCMT.lib(strtol.obj) 1>MSVCRTD.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj) 1>MSVCRTD.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj) 1> Creating library c:\Projects\soc\soc\Debug\server\Server.lib and object c:\Projects\soc\soc\Debug\server\Server.exp 1>LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library 1>c:\Projects\soc\soc\Debug\server\Server.exe : fatal error LNK1169: one or more multiply defined symbols found
  9. Mr_Fhqwhgads

    [RakNet]Abnormal Disconnect?

    Ok here is an update(twas late when I posted this). I made it so if I type quit on the client it properly disconnects. I get the following output: Incoming Connection Received static data Abnormally lost connection Received static data Abnormally lost connection Player Disconnected Incoming Connection Received static data Abnormally lost connection Now what my problem is, if a player disconnects I need to remove it from a list. But if the player isn't really disconnected, what do I do? And why does the server receive the static data so many times? If you need more code, let me know.
  10. I run my server, and the server starts up fine. When the client connects I get this output... Incoming Connection Received static data Found Player Abnormally lost connection Received static Data Found Player Abnormally lost connection and right here the client program crashes. Currently the only thing both the client and the server do in the loop is check for packets. server packet handling switch(packetId) { case ID_DISCONNECTION_NOTIFICATION: { // Player Disconnected std::cout << "Player Disconnected"; } case ID_NEW_INCOMING_CONNECTION: { // New Connection CPlayer player = CPlayer( packet->playerId ); playerList.push_back( player ); std::cout << "Incoming Connection - "; std::cout << packet->playerId.ToString() << "\n"; } case ID_RECEIVED_STATIC_DATA: { // Received static user data // Make sure client has current version std::cout << "Received static data\n"; // Search for the correct player for(std::list<CPlayer>::iterator plIter = playerList.begin(); plIter != playerList.end(); plIter++) { // If we found it if( plIter->getPlayerID() == packet->playerId ) { std::cout << "Found Player\n"; // Check version if( ((SClientData*)(networkManager.getNetworkInterface()->GetStaticClientData(packet->playerId))->GetData())->version != networkManager.serverData.version) { // Send him a message then kick him. const char *msg = "Invalid Version"; networkManager.getNetworkInterface()->Send( (char*)msg, strlen(msg)+1, HIGH_PRIORITY, RELIABLE, 0, packet->playerId, false); networkManager.getNetworkInterface()->Kick(packet->playerId); } } } } case ID_MODIFIED_PACKET: { // Its teh hax! } case ID_CONNECTION_LOST: // Abnormally lost connection std::cout << "Abnormally lost connection\n"; break; default: // Other kind of message break; }; Client setup and connection networkInterface = RakNetworkFactory::GetRakClientInterface(); networkInterface->InitializeSecurity( 0, 0 ); networkInterface->SetPassword( PASSWORD ); clientData.version.append( VERSION ); clientData.username.append( "Cirdan" ); networkInterface->SetStaticClientData( UNASSIGNED_PLAYER_ID, (char*)&clientData, sizeof(clientData) ); networkInterface->AllowConnectionResponseIPMigration( false ); if( networkInterface->Connect( SERVER_IP, SERVER_PORT, CLIENT_PORT, 0, 30 ) ) { std::cout << "Client connected"; } else { std::cout << "Connection faild"; } [Edited by - Mr_Fhqwhgads on January 20, 2007 8:11:04 PM]
  11. Mr_Fhqwhgads

    Feeling a bit humiliated

    Pride comes before a fall.
  12. So...it compiles fine, but when I run it I get a run time error at these lines: background = SDL_LoadBMP(formatFilename(theme, "background.bmp")); ball = new CBall(304, 224, screen, loadTransparentSprite(formatFilename(theme, "ball.bmp"))); // This line source of loadTransparentSprite // Bundle loading sprite with making it transparent SDL_Surface* loadTransparentSprite(const char *filename) { SDL_Surface *result = SDL_LoadBMP(filename); SDL_SetColorKey(result, SDL_SRCCOLORKEY, SDL_MapRGB(result->format, 255, 255, 0)); return result; }
  13. Quote: 1>c:\projects\cruciformengine\cruciformengine\CGraphicsManager.h(37) : warning C4003: not enough actual parameters for macro 'CreateWindowW' 1>c:\projects\cruciformengine\cruciformengine\CGraphicsManager.h(37) : error C2059: syntax error : 'constant' GLvoid ResizeWindow( GLsizei width, GLsizei height ); BOOL CreateWindow( char *title, int width, int height, int bits, bool fullscreenflag ); I looked at MSDN and didn't understand any of it. :P
  14. Mr_Fhqwhgads

    Unexpected quotations.

    Quote:Original post by zedzeek 'I'm honored to shake the hand of a brave Iraqi citizen who had his hand cut off by Saddam Hussein' g w bush People generally have to hands you know. Shoulda payed attention in science class mate.
  15. Mr_Fhqwhgads

    Most ridiculous line of code you have seen?

    #define WIN32_FAT_AND_CRAP [grin]
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!