Jump to content

Search the Community

Showing results for tags 'c++'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Blogs

  • Development Blog
  • Canardian's Blog
  • Beyond Civilization Blog Ext
  • Tyler's Blog
  • macklebee's Blog
  • B-Byrnes' Blog
  • Marleys Ghost's Blog
  • omid3098's Blog
  • Richardsimpo123456's Blog
  • DJDD's Blog
  • Rick's Blog
  • --
  • xtreampb's Blog
  • Economically Disadvantaged
  • klepto2's Blog
  • Old Blog
  • Chris Paulson's Blog
  • Davaris' Blog
  • nil
  • Rekindled Phoenix's Blog
  • Flexman's Blog
  • Kattemaksu Online
  • Marcousik's Creations Blog
  • EVE LBS Studio
  • Rendering puzzles
  • Screen Size Utility
  • Niosop's Blog
  • 1299 RTS Game Project
  • Blitzbat's Blog
  • gordonramp's Blog
  • Andy Gilbert's Blog
  • Marcus' Blog
  • JornAggror Blog
  • diedir's Blog
  • wayneg's Blog
  • Masterxilo's Blog
  • Dave Lee's Blog
  • peubuy's blog
  • OD Arts -Leadwerks Blog
  • The progression......
  • Ultra Software Company Blog
  • The Progression
  • Pancake's Blog
  • Test Blog
  • BLaBZ Blog
  • Pure³d's Blog
  • dreamhead Blog
  • RVL's Blog
  • DB's Blog
  • Toxin Games Development Blog
  • CombatHelo Blog (RSS Import)
  • Foolish's Blog
  • ZioRed's Corner
  • Toxin Games Twitter
  • Shard - Third Initiative
  • Shard's Blog
  • Soamp's Blog
  • Soamp's Blog
  • Laurens' Blog
  • JT`s warehouse district
  • Kennar's Blog
  • KiteFuchs' Blog
  • KiteFuchs' Blog
  • Rachel's Dev-Blog
  • Eagle's Blog
  • zaphos' Blog
  • please delete this blog
  • Afke's Blog
  • Richard Simpson
  • knowledgegranted's Blog
  • EdzUp(GD)'s Blog
  • aGameLife's Kelasel MMORPG Blog
  • tournamentdan's Blog
  • Beyond Civilization Blog
  • smashthewindow
  • AnniXa's Blog
  • AnniXa's Blog
  • Elemental Development
  • DigitalHax Blog
  • Aria's Blog
  • Strogg76's Blog
  • Clackdor's Blog
  • Leadwerks Project Status
  • simpleprogrammer's Blog
  • Pathfinding in LE.2.x
  • Naughty Alien's Blog
  • smashthewindow's Blog
  • Ali Salehi's Blog
  • Jardar's Blog
  • Chris Vossen's Development Blog
  • Scarlet Thread Studios' Blog
  • Kronos' Blog
  • Benton's Blog
  • ChrisV's Blog
  • tjheldna's Blog
  • shadmar's Blog
  • 3D Masons, LLC
  • Andy Gilbert's Enviro Models
  • ParaToxic's Blog
  • NarkLord's Blog
  • ChrisMAN's Blog
  • ChrisMAN's Blog
  • CGMan's Blog
  • The Game
  • Chris Tutorials
  • Leadwerks 3 Experience
  • An Alien Saga
  • klepto2 & Leadwerks 3
  • Inside the mind of eternal insomniac
  • josk's Blog
  • Shader Development in Leadwerks 3.1
  • 3D Coat : Column game making of
  • Einlander's Blog
  • Ginger George's Blog
  • I have a problem
  • Michael_J's Blog
  • nasamydifol's Blog
  • Digman's Blog
  • noesisGUI
  • SavageDogg38's Blog
  • Built from Ruins
  • Remaining Days
  • test_external_blog
  • The Hunt For Food Blog
  • Crazy Minnow Studio
  • CrazyMinnowStudio
  • Guppy's Blog
  • Playing Online
  • Evayr's Blog
  • DerRidda's Blog
  • Karl's Blog
  • whiterabbit's Blog
  • Tinyboss Games
  • abendkleider's Blog
  • sacguccireplica's Blog
  • Arena
  • Imchasinyou's Blog
  • xtom's Blog
  • Lua is better than you think.
  • mdgunn's Blog
  • Crime Closer
  • lxFirebal69xl's Blog
  • Wedmer's Blog
  • Lockdown, going forward.
  • Pump-Action Captain
  • Igor's Blog
  • Dead Anyway
  • Runenrise and more
  • reepblue's Blog
  • Slippy's Corner
  • LUA Musings
  • severjack's Blog
  • mikeporter's Blog
  • miko93's Blog
  • Megalocerous' Blog
  • lxFirebal69xl's Blog
  • aiaf's Blog
  • Lostghbear's Blog
  • echo $BLOG_NAME > blog_title.tmpl
  • johnadam111's Blog
  • Dwarf Beard
  • burgelkat's Blog
  • Charrua's Blog
  • peterpaul's Blog
  • joshmathews' Blog
  • Martin Kearl's Blog
  • Brutile's blog
  • tipforeveryone's Blog
  • Glushchenko Blog
  • Express Lab Games Blog
  • Blueapples' Blog
  • DooMAGE's Blog
  • Structura devblog
  • UltraEngine - Experiences, add-ons and other Stuff
  • martyj's Blog
  • Dragonfreak's Blog
  • Brutile's Blog
  • assigmenthelp
  • Case Study Assignment Help
  • How to deal with bad grade ?
  • How to deal with bad grade ?
  • GameDev Blog
  • devcjohnson's Blog
  • devcjohnson's Blog
  • THE WHAT? Blog
  • The Demurian Scribe
  • GUI Editor
  • GUI Tutorial
  • noob_shaders
  • The Seventh World
  • Phodex Games Blog
  • Leadwerks VS Source 2
  • Work in Progress - Scifi PBR Media
  • [C++] First Player game start
  • The Blog of Yue
  • Snowboarding Development Blog
  • Ocean: Rendering in Leadwerks 4
  • Game Ready Maps
  • Ultra App Kit (Advanced Custom Widgets)
  • Poking around
  • SALVATIONLAND
  • Blender tutorials
  • Usefull Scripts & Components
  • Thirsty Panther
  • Ultimate Action Game Controller

Forums

  • Software
    • General Discussion
    • Programming
    • Game Artwork
    • Showcase
    • Suggestion Box
    • Bug Reports
  • Addons
    • Extensions & Plugins
    • Components
    • Addon Development
  • Platforms
    • Windows
    • Linux
    • macOS

Categories

  • Streams and Events
  • Tutorials
  • Games
  • Work in Progress

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Location

  1. Hi, I am following the camera control tutorial of LE 2 as shown here - http://www.leadwerks.com/werkspace/page/Documentation/le2/_/tutorials/camera-controls-r385 When I move my mouse sideways I find a slight frosted glass or watery wave along surface of the brick columns and a bit jittery on the edges of the brick columns. What is causing this ? How can I fix it so that it does not happen in my game ? Thanks,
  2. Simple question: how do you check to see if the Leadwerks window is in focus? I ask because I use the example code for mouse look in an FPS, which involves the following code: MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2); If you Alt-Tab away, that line of code remains active and continues to lock the mouse. I'd like to turn that line of code off if the application is not in focus. (I use int main(), if it matters.) Thanks.
  3. Hello, In the first LE 2.5 C++ tutorial where it is taught how to set up a project ( either using LE Builder or manually ) and draw a cube on the screen, how come I can see the cube when there is no code present in that example that creates a light ? ! How is this possible ? Thanks,
  4. Hello, After placing trees using vegetation tool and activating shadows for the trees, the trees begin to disappear leaving the shadows visible over the terrain. Also the shadows start to disappear sometimes when the camera moves towards the trees! Does anybody know how to overcome all those ?
  5. Hello, I am using Leadwerks 2.5 Each time I try to create a new project using LE Builder for Visual C++ 2008, I get the following error message as shown in the attached screen shot. Ironically the message refers to Visual Studio 2010 which I do not have installed. I only have Visual C++ 2008 Express installed. How can I rectify it ? Thanks,
  6. Hey all, I have recently been working with some project things, and I was looking at making projects run independent of the LE install directory, and I experienced a strange visual glitch. When running a simple terrain world I get this sort of over bumpmapping in my grass texture, but not when running the world in the editor. And something which I suspect is to do with this is in the console window, "Warning: Uniform 'screenlightposn' does not exist in shader." Any suggestions on what the problem might be here?
  7. Hello, The user guide in the Leadwerks 2.5 documentation states in this URL - http://www.leadwerks.../c-programming/ http://www.leadwerks...c-tutorials-r25 But unfortunately the above link does not work ! So from where can I download the entire Tutorials package and install it my computer ? Thanks,
  8. ..hi guys..what good library for serial, USB, LPT comunication for C++ you could recommend me, i could use with LE ? Free or commercial, doesnt matter..thank you in advance..
  9. Ok so i'm trying to preform some memory management by deleting pointers to my object that have already been stored in arrays. so like the code below cBlock *_Block=new cBlock(true); _Block->SetPosition(_Pos); SetEntityCallback(_Block->GetFullModel(), (byte*)Coll, ENTITYCALLBACK_COLLISION); CobbleVec.push_back(*_Block); ObjVec.push_back(_Block);//must push back all blocks //delete _Block; i had to remove the delete _Block; line because i believe it is removing all the data completely (based on tests I've been running). I feel as though if I don't delete _Block it will result in a memory leak. As you can see i'm placing this in 2 different vectors. My question is how do I delete this pointer with out removing all references to my object. Is there like a copy command I don't know about? Thanks ~Xtreampb~
  10. so i'm coding doing my thing. squashing bugs as can you probably see when all of a sudden i get this error... Unhandled exception at 0x00a5eb16 in Castle Defense-Debug.exe: 0xC0000005: Access violation reading location 0x061e4e58. what makes this hard is that this breaks in the engine.cpp file at this function void UpdateWorld(float stepsize) { leUpdateWorld(stepsize); } i trace the stack to this function call UpdateWorld(AppSpeed()) ; i have made no changes anywhere near this line of code. So why is it all of a sudden complaining. the stepsize that i have when i break is approx 1.1752819 +/- 0.03 Suggestions greatly appriciated ~Xtreampb~
  11. xtreampb

    the stack

    I'm trying to do some debugging. When my code goes to the "un-handled exception, press break to debug" message box, it takes me to the utility and vector source code. I know that the bug is in my code, not these classes. So i'm asking how do i use the stack to debug my code. I know i can see what function threw the error, but does it give me any more information like args passed to it? I've never had to use the stack before now so i'm in-experienced in using it to debug software. Thanks ~Xtreampb~
  12. Hey everyone. I have some problems with Raknet, specifically the bitstream, and I thought someone might be able to help, as I know some people have a lot of experience with raknet. The problem I am experiencing is that when I spawn a player on the client before the server, the client player movement doesn't update on the server until the server player is spawned. And by then the players are out of sync. These are my Files //============================================================================= /** * \file Client.cpp * * \brief This file contains all the functions required by the Client class defined in Client.h. Most of these functions are public and they assist in ways such as, creating a network interface, settin up, starting up, connecting and sending & receiving packets. * * \author Kenneth Claassen * * \date 2011-08-05: * * \todo * * \bug * * \version 1.0 ******************************************************************************/ #include "Client.h" #include "CustomNetworkEnums.h" #define DEBUG_BUILD Client::Client(int maxPlay) { maxPlayers = maxPlay; serverPort = "6001"; numPlayers = 0; spawned = false; netLoaded = false; } void Client::CreateClientInterface() { client = RakNet::RakPeerInterface::GetInstance(); if(!client) { MessageBoxA(0,"Error N02: Failed to Create Client Interface", "Error N02:",0); } RakNet::SystemAddress clientID = RakNet::UNASSIGNED_SYSTEM_ADDRESS; } void Client::SetIP() { serverIP = "127.0.0.1"; clientPort = "6000"; } void Client::ClientStartup() { socketDescriptor = RakNet::SocketDescriptor(atoi(clientPort.c_str()),0); socketDescriptor.socketFamily = AF_INET; //an IPV4 internet Protocol client->Startup(8, &socketDescriptor, 1); client->SetOccasionalPing(true); RakNet::ConnectionAttemptResult car = client->Connect(serverIP.c_str(), atoi(serverPort.c_str()),"yoyo", (int) strlen("yoyo")); RakAssert(car==RakNet::CONNECTION_ATTEMPT_STARTED); } void Client::UpdateNetworkKeyboard(){ if(netLoaded==true && spawned==true){ //Moving if(KeyDown(KEY_W)){ player[controlPlayer]->move=3; } else if(KeyDown(KEY_S)){ player[controlPlayer]->move = -3; } else { player[controlPlayer]->move = 0; } //Strafing if(KeyDown(KEY_D)){ player[controlPlayer]->strafe = 1; } else if(KeyDown(KEY_A)){ player[controlPlayer]->strafe = -1; } else { player[controlPlayer]->strafe = 0; } if(MouseDown(1)){ //Camera looking mx=Curve(MouseX()-GraphicsWidth()/2,mx,6); my=Curve(MouseY()-GraphicsHeight()/2,my,6); MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2); camrotation.X=camrotation.X+my/10.0; player[controlPlayer]->turn=player[controlPlayer]->turn-mx/10.0; } player[controlPlayer]->jump=0.0; if(KeyHit(KEY_SPACE)){ player[controlPlayer]->jump=4; } if(player[controlPlayer]->move != player[controlPlayer]->moveCheck){ RakNet::BitStream bsOut; typeID = ID_PLAYER_MOVE; bsOut.Write(typeID); bsOut.Write(player[controlPlayer]->move); bsOut.Write(player[controlPlayer]->GetNetworkID()); client->Send(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, RakNet::UNASSIGNED_SYSTEM_ADDRESS, true); } if(player[controlPlayer]->strafe != player[controlPlayer]->strafeCheck){ RakNet::BitStream bsOut; typeID = ID_PLAYER_STRAFE; bsOut.Write(typeID); bsOut.Write(player[controlPlayer]->strafe); bsOut.Write(player[controlPlayer]->GetNetworkID()); client->Send(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, RakNet::UNASSIGNED_SYSTEM_ADDRESS, true); } if(player[controlPlayer]->turn != player[controlPlayer]->turnCheck){ RakNet::BitStream bsOut; typeID = ID_PLAYER_TURN; bsOut.Write(typeID); bsOut.Write(player[controlPlayer]->turn); bsOut.Write(player[controlPlayer]->GetNetworkID()); client->Send(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, RakNet::UNASSIGNED_SYSTEM_ADDRESS, true); } if(player[controlPlayer]->jump != player[controlPlayer]->jumpCheck){ RakNet::BitStream bsOut; typeID = ID_PLAYER_JUMP; bsOut.Write(typeID); bsOut.Write(player[controlPlayer]->jump); bsOut.Write(player[controlPlayer]->GetNetworkID()); client->Send(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, RakNet::UNASSIGNED_SYSTEM_ADDRESS, true); } player[controlPlayer]->moveCheck = player[controlPlayer]->move; player[controlPlayer]->strafeCheck = player[controlPlayer]->strafe; player[controlPlayer]->turnCheck = player[controlPlayer]->turn; player[controlPlayer]->jumpCheck = player[controlPlayer]->jump; } for(int i=0; i<numPlayers; i++){ player[i]->UpdatePlayer(); } } void Client::ReceivePackets() { for(p=client->Receive(); p; client->DeallocatePacket(p), p=client->Receive()) { packetIdentifier = GetPacketIdentifier(p); RakNet::BitStream bsIn(p->data, p->length, false); RakNet::BitStream bsOut; switch (packetIdentifier) { case ID_DISCONNECTION_NOTIFICATION: //connection lost normally printf("ID_DISCONNECTION_NOTIFICATION from %s\n", p->systemAddress.ToString(true));; break; case ID_ALREADY_CONNECTED: printf("ID_ALREADY_CONNECTED\n"); break; case ID_NEW_INCOMING_CONNECTION: //Somebody connected. We have their IP now printf("ID_NEW_INCOMING_CONNECTION from %s with GUID %s\n", p->systemAddress.ToString(true), p->guid.ToString()); break; case ID_INCOMPATIBLE_PROTOCOL_VERSION: printf("ID_INCOMPATIBLE_PROTOCOL_VERSION\n"); break; case ID_REMOTE_DISCONNECTION_NOTIFICATION: printf("ID_REMOTE_DISCONNECTION_NOTIFICATION\n"); break; case ID_REMOTE_NEW_INCOMING_CONNECTION: printf("ID_REMOTE_NEW_INCOMING_CONNECTION\n"); break; case ID_CONNECTION_BANNED: printf("You are banned from this server\n"); break; case ID_CONNECTION_ATTEMPT_FAILED: printf("Connection attempt failed\n"); break; case ID_CONNECTION_LOST: printf("ID_CONNECTION LOST from %s\n", p->systemAddress.ToString(true));; break; case ID_NO_FREE_INCOMING_CONNECTIONS: printf("Sorry, the server is full\n"); break; case ID_INVALID_PASSWORD: printf("Access Denied: Inccorrect client password\n"); break; case ID_CONNECTION_REQUEST_ACCEPTED: printf("Your connection has been accepted to %s with GUID %s\n", p->systemAddress.ToString(true), p->guid.ToString()); break; case ID_LOAD_CURRENT_PLAYERS: TVec3 pos; TVec3 rot; TVec3 vel; TVec3 omg; bsIn.IgnoreBytes(sizeof(RakNet::MessageID)); bsIn.Read(numPlayers); for(int i=0; i<numPlayers; i++){ bsIn.Read(pos.X); bsIn.Read(pos.Y); bsIn.Read(pos.Z); bsIn.Read(rot.X); bsIn.Read(rot.Y); bsIn.Read(rot.Z); bsIn.Read(vel.X); bsIn.Read(vel.Y); bsIn.Read(vel.Z); bsIn.Read(omg.X); bsIn.Read(omg.Y); bsIn.Read(omg.Z); bsIn.Read(playerNetworkID); player[i] = new Player(pos, rot); player[i]->SetNetworkIDManager(&networkIDManager); player[i]->SetNetworkID(playerNetworkID); SetBodyVelocity(player[i]->pBody, vel); SetBodyOmega(player[i]->pBody, omg); } netLoaded = true; break; case ID_SPAWN_PLAYER: if(netLoaded==true){ TVec3 playerPos; TVec3 playerRot; bsIn.IgnoreBytes(sizeof(RakNet::MessageID)); bsIn.Read(playerPos.X); bsIn.Read(playerPos.Y); bsIn.Read(playerPos.Z); bsIn.Read(playerRot.X); bsIn.Read(playerRot.Y); bsIn.Read(playerRot.Z); bsIn.Read(playerNetworkID); player[numPlayers] = new Player(playerPos, playerRot); player[numPlayers]->SetNetworkIDManager(&networkIDManager); player[numPlayers]->SetNetworkID(playerNetworkID); numPlayers++; } break; case ID_PLAYER_MOVE: if(netLoaded==true){ int move; bsIn.IgnoreBytes(sizeof(RakNet::MessageID)); bsIn.Read(move); bsIn.Read(playerNetworkID); networkIDManager.GET_OBJECT_FROM_ID<Player*>(playerNetworkID)->move = move; } break; case ID_PLAYER_STRAFE: if(netLoaded==true){ int strafe; bsIn.IgnoreBytes(sizeof(RakNet::MessageID)); bsIn.Read(strafe); bsIn.Read(playerNetworkID); networkIDManager.GET_OBJECT_FROM_ID<Player*>(playerNetworkID)->strafe = strafe; } break; case ID_PLAYER_TURN: if(netLoaded==true){ int turn; bsIn.IgnoreBytes(sizeof(RakNet::MessageID)); bsIn.Read(turn); bsIn.Read(playerNetworkID); networkIDManager.GET_OBJECT_FROM_ID<Player*>(playerNetworkID)->turn = turn; } break; case ID_PLAYER_JUMP: if(netLoaded==true){ int jump; bsIn.IgnoreBytes(sizeof(RakNet::MessageID)); bsIn.Read(jump); bsIn.Read(playerNetworkID); networkIDManager.GET_OBJECT_FROM_ID<Player*>(playerNetworkID)->jump = jump; } break; default: //For sending chat messages break; } } } unsigned char Client::GetPacketIdentifier(RakNet::Packet *p) { if(p==0) return 255; if((unsigned char)p->data[0] == ID_TIMESTAMP) { RakAssert(p->length > sizeof(RakNet::MessageID) + sizeof(RakNet::Time)); return (unsigned char) p->data[sizeof(RakNet::MessageID) + sizeof(RakNet::Time)]; } else return (unsigned char) p->data[0]; } void Client::ShutDownClient() { client->Shutdown(300); RakNet::RakPeerInterface::DestroyInstance(client); } void Client::SpawnPlayer(){ if(spawned==false){ player[numPlayers] = new Player(Vec3(0,0,0), Vec3(0,0,0)); typeID = ID_SPAWN_PLAYER; player[numPlayers]->SetNetworkIDManager(&networkIDManager); playerNetworkID = player[numPlayers]->GetNetworkID(); assert(networkIDManager.GET_OBJECT_FROM_ID<Player*>(playerNetworkID) == player[numPlayers]); RakNet::BitStream bsOut; bsOut.Write(typeID); bsOut.Write(0); bsOut.Write(0); bsOut.Write(0); bsOut.Write(0); bsOut.Write(0); bsOut.Write(0); bsOut.Write(player[numPlayers]->GetNetworkID()); client->Send(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, RakNet::UNASSIGNED_SYSTEM_ADDRESS, true); controlPlayer = numPlayers; numPlayers++; spawned = true; } } //============================================================================= /** * \file Server.cpp * * \brief This file contains all the functions for the server class which uses RakNet to convey information on a server specified by the user for a game. * * \author Kenneth Claassen * * \date 2011-08-05: * * \todo * * \bug * * \version 1.0 ******************************************************************************/ #include "Server.h" #include "CustomNetworkEnums.h" #define MAX_PLAYERS 10 //========================================================================= /** \brief Initiates an instance of Server object class (Constructor) * * N/A * * \param * * \return void * \return void * * \todo * * \bug * * \version 1.0 **************************************************************************/ Server::Server(int maxPlay) { numSockets = 1; numIPs = 1; numPlayers = 0; maxPlayers = maxPlay; serverPort = "6001"; spawned = false; } //========================================================================= /** \brief Creates a RakNet networking interface * * This function creates a RakNet networking interface for a server. This is the first step of networking with raknet. We need the networking interface to call RakNet functions from. * * \param * * \return void * \return void * * \todo * * \bug * * \version 1.0 **************************************************************************/ void Server::CreateServerInterface() { server = RakNet::RakPeerInterface::GetInstance(); server->SetIncomingPassword("yoyo", (int) strlen("yoyo")); server->SetTimeoutTime(30000, RakNet::UNASSIGNED_SYSTEM_ADDRESS); if(!server) { MessageBoxA(0,"Error N01: Failed to Create Server", "Error N01:",0); } } //========================================================================= /** \brief Starts the server * * This function starts the server by setting a port in the socketDescriptor and starting a single IPV4 protocol socket. It then starts the server with the socket and sets the maximum amount of connections to the server. * * \param * * \return void * \return void * * \todo * * \bug * * \version 1.0 **************************************************************************/ void Server::ServerStartup() { socketDescriptor.port = atoi(serverPort.c_str()); //Set the port for the socket socketDescriptor.socketFamily = AF_INET; //Socket to IPV4 protocol bool b = server->Startup(maxPlayers, &socketDescriptor, 1)==RakNet::RAKNET_STARTED; if(!B) { MessageBoxA(0,"Error N03: Failed to Start Server","Error N03:",0); } server->SetMaximumIncomingConnections(maxPlayers); server->SetOccasionalPing(true); server->SetUnreliableTimeout(1000); DebugServerInfo(); } //========================================================================= /** \brief This function prints server info to the terminal * * The purpose of this function is to obtain information about the server, such as GUID, IP adresses, Ports and then it prints them to the terminal Screen. It is not a vital part of the server class but it is useful for debugging. * * \param * * \return void * \return void * * \todo * * \bug * * \version 1.0 **************************************************************************/ void Server::DebugServerInfo() { DataStructures::List<RakNet::RakNetSmartPtr < RakNet::RakNetSocket> > sockets; server->GetSockets(sockets); printf("Server Started!\n"); printf("Socket addresses used:\n"); for(unsigned int i=0; i < sockets.Size(); i++) { printf("%i. %s\n", i+1, sockets[i]->boundAddress.ToString(true)); numSockets += 1; } printf("My IP addresses:\n"); for(unsigned int i=0; i < server->GetNumberOfAddresses(); i++) { printf("%i. %s\n", i+1, server->GetLocalIP(i)); numIPs +=1; } printf("My GUID is %s\n", server->GetGuidFromSystemAddress( RakNet::UNASSIGNED_SYSTEM_ADDRESS).ToString()); } //========================================================================= /** \brief * * This * * \param * * \return void * \return void * * \todo * * \bug * * \version 1.0 **************************************************************************/ void Server::UpdateNetworkKeyboard(){ if(spawned==true){ //cout << batteryLife << endl; //Moving if(KeyDown(KEY_W)){ player[controlPlayer]->move=3; } else if(KeyDown(KEY_S)){ player[controlPlayer]->move = -3; } else { player[controlPlayer]->move = 0; } //Strafing if(KeyDown(KEY_D)){ player[controlPlayer]->strafe = 1; } else if(KeyDown(KEY_A)){ player[controlPlayer]->strafe = -1; } else { player[controlPlayer]->strafe = 0; } if(MouseDown(1)){ //Camera looking mx=Curve(MouseX()-GraphicsWidth()/2,mx,6); my=Curve(MouseY()-GraphicsHeight()/2,my,6); MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2); camrotation.X=camrotation.X+my/10.0; player[controlPlayer]->turn=player[controlPlayer]->turn-mx/10.0; } player[controlPlayer]->jump=0.0; if(KeyHit(KEY_SPACE)){ player[controlPlayer]->jump=4; } if(player[controlPlayer]->move != player[controlPlayer]->moveCheck){ RakNet::BitStream bsOut; typeID = ID_PLAYER_MOVE; bsOut.Write(typeID); bsOut.Write(player[controlPlayer]->move); bsOut.Write(player[controlPlayer]->GetNetworkID()); server->Send(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, RakNet::UNASSIGNED_SYSTEM_ADDRESS, true); } if(player[controlPlayer]->strafe != player[controlPlayer]->strafeCheck){ RakNet::BitStream bsOut; typeID = ID_PLAYER_STRAFE; bsOut.Write(typeID); bsOut.Write(player[controlPlayer]->strafe); bsOut.Write(player[controlPlayer]->GetNetworkID()); server->Send(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, RakNet::UNASSIGNED_SYSTEM_ADDRESS, true); } if(player[controlPlayer]->turn != player[controlPlayer]->turnCheck){ RakNet::BitStream bsOut; typeID = ID_PLAYER_TURN; bsOut.Write(typeID); bsOut.Write(player[controlPlayer]->turn); bsOut.Write(player[controlPlayer]->GetNetworkID()); server->Send(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, RakNet::UNASSIGNED_SYSTEM_ADDRESS, true); } if(player[controlPlayer]->jump != player[controlPlayer]->jumpCheck){ RakNet::BitStream bsOut; typeID = ID_PLAYER_JUMP; bsOut.Write(typeID); bsOut.Write(player[controlPlayer]->jump); bsOut.Write(player[controlPlayer]->GetNetworkID()); server->Send(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, RakNet::UNASSIGNED_SYSTEM_ADDRESS, true); } player[controlPlayer]->moveCheck = player[controlPlayer]->move; player[controlPlayer]->strafeCheck = player[controlPlayer]->strafe; player[controlPlayer]->turnCheck = player[controlPlayer]->turn; player[controlPlayer]->jumpCheck = player[controlPlayer]->jump; for(int i=0; i<numPlayers; i++){ player[i]->UpdatePlayer(); } } } //========================================================================= /** \brief This function handles receiveing of packets on a server * * This function basically does all the handling and reaction to packets on the server. First it receives a packet, determins what type of information the packet holds and then initiates a reaction to the information. It then cycles through all the packets at that point in time until there are no more packets to read at which point it returns void. Custom user message identifiers are defined in CustomNetworkEnums.h. * * \param * * \return void * \return void * * \todo * * \bug * * \version 1.0 **************************************************************************/ void Server::ReceivePackets() { for(p=server->Receive(); p; server->DeallocatePacket(p), p=server->Receive()) { packetIdentifier = GetPacketIdentifier(p); RakNet::BitStream bsIn(p->data, p->length, false); RakNet::BitStream bsOut; switch (packetIdentifier) { case ID_DISCONNECTION_NOTIFICATION: //connection lost normally printf("ID_DISCONNECTION_NOTIFICATION from %s\n", p->systemAddress.ToString(true)); break; case ID_ALREADY_CONNECTED: printf("ID_ALREADY_CONNECTED\n"); break; case ID_NEW_INCOMING_CONNECTION: //Somebody connected. We have their IP now printf("ID_NEW_INCOMING_CONNECTION"); typeID = ID_LOAD_CURRENT_PLAYERS; bsOut.Write(typeID); bsOut.Write(numPlayers); for(int i=0; i<numPlayers; i++){ bsOut.Write(EntityPosition(player[i]->pBody).X); bsOut.Write(EntityPosition(player[i]->pBody).Y); bsOut.Write(EntityPosition(player[i]->pBody).Z); bsOut.Write(EntityRotation(player[i]->pBody).X); bsOut.Write(EntityRotation(player[i]->pBody).Y); bsOut.Write(EntityRotation(player[i]->pBody).Z); bsOut.Write(GetBodyVelocity(player[i]->pBody).X); bsOut.Write(GetBodyVelocity(player[i]->pBody).Y); bsOut.Write(GetBodyVelocity(player[i]->pBody).Z); bsOut.Write(GetBodyOmega(player[i]->pBody).X); bsOut.Write(GetBodyOmega(player[i]->pBody).Y); bsOut.Write(GetBodyOmega(player[i]->pBody).Z); bsOut.Write(player[i]->GetNetworkID()); } server->Send(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, p->systemAddress, false); break; case ID_INCOMPATIBLE_PROTOCOL_VERSION: printf("ID_INCOMPATIBLE_PROTOCOL_VERSION\n"); break; case ID_REMOTE_DISCONNECTION_NOTIFICATION: printf("ID_REMOTE_DISCONNECTION_NOTIFICATION\n"); break; case ID_REMOTE_NEW_INCOMING_CONNECTION: printf("ID_REMOTE_NEW_INCOMING_CONNECTION\n"); break; case ID_CONNECTION_BANNED: printf("You are banned from this server\n"); break; case ID_CONNECTION_ATTEMPT_FAILED: printf("Connection attempt failed\n"); break; case ID_CONNECTION_LOST: printf("ID_CONNECTION LOST from %s\n", p->systemAddress.ToString(true)); break; case ID_NO_FREE_INCOMING_CONNECTIONS: printf("Sorry, the server is full\n"); break; case ID_INVALID_PASSWORD: printf("Access Denied: Inccorrect client password\n"); break; case ID_CONNECTION_REQUEST_ACCEPTED: printf("Your connection has been accepted to %s with GUID %s\n", p->systemAddress.ToString(true), p->guid.ToString()); break; case ID_SPAWN_PLAYER: TVec3 playerPos; TVec3 playerRot; bsIn.IgnoreBytes(sizeof(RakNet::MessageID)); bsIn.Read(playerPos.X); bsIn.Read(playerPos.Y); bsIn.Read(playerPos.Z); bsIn.Read(playerRot.X); bsIn.Read(playerRot.Y); bsIn.Read(playerRot.Z); bsIn.Read(playerNetworkID); player[numPlayers] = new Player(playerPos, playerRot); player[numPlayers]->SetNetworkIDManager(&networkIDManager); player[numPlayers]->SetNetworkID(playerNetworkID); typeID = ID_SPAWN_PLAYER; bsOut.Write(typeID); bsOut.Write(playerPos.X); bsOut.Write(playerPos.Y); bsOut.Write(playerPos.Z); bsOut.Write(playerRot.X); bsOut.Write(playerRot.Y); bsOut.Write(playerRot.Z); bsOut.Write(playerNetworkID); server->Send(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, p->systemAddress, true); numPlayers++; break; case ID_PLAYER_MOVE: int move; bsIn.IgnoreBytes(sizeof(RakNet::MessageID)); bsIn.Read(move); bsIn.Read(playerNetworkID); networkIDManager.GET_OBJECT_FROM_ID<Player*>(playerNetworkID)->move = move; typeID = ID_PLAYER_MOVE; bsOut.Write(typeID); bsOut.Write(move); bsOut.Write(playerNetworkID); server->Send(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, p->systemAddress, true); break; case ID_PLAYER_STRAFE: int strafe; bsIn.IgnoreBytes(sizeof(RakNet::MessageID)); bsIn.Read(strafe); bsIn.Read(playerNetworkID); networkIDManager.GET_OBJECT_FROM_ID<Player*>(playerNetworkID)->strafe = strafe; typeID = ID_PLAYER_STRAFE; bsOut.Write(typeID); bsOut.Write(strafe); bsOut.Write(playerNetworkID); server->Send(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, p->systemAddress, true); break; case ID_PLAYER_TURN: int turn; bsIn.IgnoreBytes(sizeof(RakNet::MessageID)); bsIn.Read(turn); bsIn.Read(playerNetworkID); networkIDManager.GET_OBJECT_FROM_ID<Player*>(playerNetworkID)->turn = turn; typeID = ID_PLAYER_TURN; bsOut.Write(typeID); bsOut.Write(turn); bsOut.Write(playerNetworkID); server->Send(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, p->systemAddress, true); break; case ID_PLAYER_JUMP: int jump; bsIn.IgnoreBytes(sizeof(RakNet::MessageID)); bsIn.Read(jump); bsIn.Read(playerNetworkID); networkIDManager.GET_OBJECT_FROM_ID<Player*>(playerNetworkID)->jump = jump; typeID = ID_PLAYER_JUMP; bsOut.Write(typeID); bsOut.Write(jump); bsOut.Write(playerNetworkID); server->Send(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, p->systemAddress, true); break; default: break; } } } //========================================================================= /** \brief Removes Timestamp and determines the packet identifier * * This function is used when receiveing packets. It basically strips the packet of its time stamp and returns it to the Receive packeets function for processiing. * * \param * * \return void * \return void * * \todo * * \bug * * \version 1.0 **************************************************************************/ unsigned char Server::GetPacketIdentifier(RakNet::Packet *p) { if(p==0) return 255; if((unsigned char)p->data[0] == ID_TIMESTAMP) { RakAssert(p->length > sizeof(RakNet::MessageID) + sizeof(RakNet::Time)); return (unsigned char) p->data[sizeof(RakNet::MessageID) + sizeof(RakNet::Time)]; } else return (unsigned char) p->data[0]; } //========================================================================= /** \brief Shuts down the netowork interfaces and free's it from memory * * * * \param * * \return void * \return void * * \todo * * \bug * * \version 1.0 **************************************************************************/ void Server::ShutDownServer() { server->Shutdown(300); RakNet::RakPeerInterface::DestroyInstance(server); } //========================================================================= /** \brief * * * * \param * * \return void * \return void * * \todo * * \bug * * \version 1.0 **************************************************************************/ void Server::SpawnPlayer(){ if(spawned==false){ player[numPlayers] = new Player(Vec3(0,0,0), Vec3(0,0,0)); typeID = ID_SPAWN_PLAYER; player[numPlayers]->SetNetworkIDManager(&networkIDManager); playerNetworkID = player[numPlayers]->GetNetworkID(); assert(networkIDManager.GET_OBJECT_FROM_ID<Player*>(playerNetworkID) == player[numPlayers]); RakNet::BitStream bsOut; bsOut.Write(typeID); bsOut.Write(0); bsOut.Write(0); bsOut.Write(0); bsOut.Write(0); bsOut.Write(0); bsOut.Write(0); bsOut.Write(player[numPlayers]->GetNetworkID()); server->Send(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, RakNet::UNASSIGNED_SYSTEM_ADDRESS, true); controlPlayer = numPlayers; numPlayers++; spawned = true; } } Not too much is changed from Ken's original tutorial code, but I am requiring this to work otherwise it will cause some further problems. Thanks in advance to anyone who can help me.
  13. This only works with Visual Studio in debug mode. long GetMemoryUsage() { _CrtMemState memstate; _CrtMemCheckpoint(&memstate); return memstate.lSizes[0]+memstate.lSizes[1]+memstate.lSizes[2]+memstate.lSizes[3]+memstate.lSizes[4]; }
  14. I want to create a lua script but expose the functions of this script to my C++ game. I am making the UI in lua and want to do something like this KeyHit(KEY_P) { //do lua function calls //int result=luaUIBtnPress(); } I would also like to send what button was pressed in my lua UI back to my C++ function, as shown above. Can anyone guide me on how i can do this or a better way to do this. Or should I just use wxWidgets or another UI library? Thanks ~Xtreampb~
  15. Hei ya, I wan't to add a function SetButtonFunction to my MenuSystem to call a given function when the button is pressed. In my button class I have a void pointer -> void (*_func)(void); I just have to call SetButtonFunction(IMenuButton* b, void (*_func)(void)); and add the function. But when I enter a class owned function it doesn't work.For example I have in my class the function Test() --> (IMenuSystem::Test()) and enter that to the function it doesn't work.I become a error....something with a argumentlist.... but when I just create a custom function in the source file void Test() { MessageBoxA(0,"Hey",0,0); } it works fine. Have someone a idea how to manage that ?
  16. Please help me with an example, to replace the function of the class - the user function. There is a class: class TGuiButton { private: int x,y,width,height; string title; int MouseIn(TVec2 start, TVec2 dimensions); bool IsClick; bool buf1,buf2; TEntity buf; void * TempFunction; //To call the user function. public: string SoundEnter; string SoundLeave; string SoundClick; string TextureUp; string TextureHover; string TextureDown; bool Sounds; bool Enabled; bool Visible; void Create(int _x, int _y, int _width, int _height, string _title); void onClick(void *callback); //Function for replace. void Update(); void Delete(); }; .... void TGuiButton::onClick(void *callback) { //????? } .... And call a user function with TempFunction;
  17. Hi, there is a character "name=controller" and the object box "name=box_test". How to determine the collision with box?, and then perform the desired action.
  18. Hi. Do not understand why this code does not work?. This is for the test if (KeyDown(KEY_W)){sequence = 2;} else sequence = 1; if (KeyDown(KEY_S)){sequence = 2;} else sequence = 1; if (KeyDown(KEY_A)){sequence = 2;} else sequence = 1; if (KeyDown(KEY_D)){sequence = 2;} else sequence = 1; switch (sequence) { case 1: framebegin=0.0; frameend=69.0; break; case 2: framebegin=70.0; frameend=130.0; break; case 3: framebegin=131.0; frameend=171.0; break; } frame=AppTime()/15.0; frame=fmodf(frame,frameend-framebegin)+framebegin; Animate(PlayerMesh,frame,0.5,0,true); Animation works only when you press 'D'. Why is this?
  19. Hello. Show you how to rotate the camera around the object? Tried to fix this code: //Camera looking Player.mx=Curve(MouseX()-GraphicsWidth()/2,Player.mx,6); Player.my=Curve(MouseY()-GraphicsHeight()/2,Player.my,6); MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2); Player.camrotation.X=Player.camrotation.X+Player.my/10.0; Player.camrotation.Y=Player.camrotation.Y-Player.mx/10.0; RotateEntity(Camera,Player.camrotation); but nothing
  20. Hello everyone. As you know there are lots of messages that the LE engine prints out such as : "Loading texture "e:/workspace/iss/out/data/ig/leadwerksrenderer/materials/custom/clouds/cloud7.dds"..." etc. Is there any LE or C++ or Visual Studio way to disable these couts of engine.dll ? These messages really make it hard for us to see our own debug print outs. Thanks in advance.
  21. I use OpenGL to render my sprites which work fine with the framework commands except for Godrays and DOF. The process is first initiated by the following code; void Begin(void) { int vPort[4]; glGetIntegerv(GL_VIEWPORT, vPort); // Set the projection glOrtho(0, vPort[2], vPort[3], 0, 1.0, 1000.0);/ // Reset transformation glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glEnableClientState(GL_VERTEX_ARRAY); //glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_CULL_FACE); glCullFace(GL_BACK); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); } void End(void) { glMatrixMode(GL_MODELVIEW); glPopMatrix(); //glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_VERTEX_ARRAY); glDisable(GL_TEXTURE_2D); glDisable(GL_BLEND); glDisable(GL_CULL_FACE); glColor4f(1.0, 1.0, 1.0, 1.0); } I've had this problem for some time time now and I have worked around it by simply not using Godrays or DOF. Can anyone please confirm that the code above is all there? Oh, and I call Begin() right after RenderFramework() too. Thanks
  22. Any suggestion for a good method of detecting if my character walks from land into water?
  23. Hei there I have here a little problem with the design of a componentmanager. My idea is it to make a componentmanager, which loads components and add them to a map.Then the component can be login to the mainthread or to a extern thread, which will be created. Now the problem is, that I use Polymorphism to make a baseclass ( here IComponent ) and inherit this from my first component , the IConsole. When I write ISmartPointer<IComponent> _console(new IConsole); I can add that to the map, because I have always this IComponent as baseclass.So I add it to a map,lets say std::map<std::string,IComponent*> _map; Now I have virtual Functions in the IComponent class like Update,Initialize and Terminate. This virtual functions are defined in the component itself. But now the problem is that I wan't to call functions from the IConsole itself.There is for example a function LoginVar(...), but I can't write _console.get()->LoginVar(), because I have IComponent as the baseclass and this class haven't got a virtual function LoginVar..... This is a big problem.I want that I can add the Components to a map ( I think that the best way is to make it with Polymorphim), but also call the specific functions... I hope you can help me Thanks
  24. I'm working on a game engine and winging it as i go along, now i realize this leaves me open for flack from the more seasoned programmars here, but i figured it best to start somewear and go on the advice that people can offer. And if they can provide test code, it will give me something to go on, an encentive. I've started work on the engine but i've hit a snag. #include<iostream> using namespace std; int main() { /*Initializes the main world, before loading entities, physics, etc...*/ int WORLD_MAIN; /*Initializes the default physics designed for the game*/ int INITIALIZE_PHYSICS; /*Initializes the environment, sounds, lights, wind, water splashing, etc..*/ int INITIALIZE_ENVIRONMENT; /*Initializes the world, after checking to makesure everything is in it's default place*/ int INITIALIZE_WORLD; /*Initializes the shaders in the world*/ int INITIALIZE_SHADERS; /*Initializes the scenery, after first initializing world_main, physics, environment, world, shaders, then scenery.*/ int INITIALIZE_SCENERY; /*Initializes the camera in the game*/ int INITIALIZE_CAMERA; /*Initializes the game sound and audio in the game*/ int INITIALIZE_AUDIO; /*The idea for this part of the code, is to create a checker. Which checks through WORLD_MAIN for any errors It's also the first file to be initialized when executing. So this line of code might be edited to fit it's purpose*/ cout << "This may take a few minutes, please be patient\n"; cin >> WORLD_MAIN; cin.ignore(); cout << "Ready!" << WORLD_MAIN; << "\n"; cin.get(); } This code more specifically. /*The idea for this part of the code, is to create a checker. Which checks through WORLD_MAIN for any errors It's also the first file to be initialized when executing. So this line of code might be edited to fit it's purpose*/ cout << "This may take a few minutes, please be patient\n"; cin >> WORLD_MAIN; cin.ignore(); cout << "Ready!" << WORLD_MAIN; << "\n"; cin.get(); The idea behind that specific line of code, is to create an initializer. That checks to see if all the variables are set to their default setting. I think what I'm doing currently is only setting the code up to paste some text to the command screen, this code will be changed if I'm forgetting some variables or integers.
  25. when I call LoadScene, my .sbx file loads properly, with all scripts running and so on, but all particles and coronas are not visible. Is this a common problem and is there a way to solve this? I'm using LE2.5, and C++ for programming, the particles are the standard LE dust particles and coronas. It works in the editor by the way. thanks in advance.
×
×
  • Create New...