• Advertisement

Search the Community

Showing results for tags 'C++'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Categories

  • Audio
    • Music and Sound FX
  • Business
    • Business and Law
    • Career Development
    • Production and Management
  • Game Design
    • Game Design and Theory
    • Writing for Games
    • UX for Games
  • Industry
    • Interviews
    • Event Coverage
  • Programming
    • Artificial Intelligence
    • General and Gameplay Programming
    • Graphics and GPU Programming
    • Engines and Middleware
    • Math and Physics
    • Networking and Multiplayer
  • Visual Arts
  • Archive

Categories

  • News

Categories

  • Audio
  • Visual Arts
  • Programming
  • Writing

Categories

  • GameDev Unboxed

Categories

  • Game Dev Loadout

Categories

  • Game Developers Conference
    • GDC 2017

Forums

  • Audio
    • Music and Sound FX
  • Business
    • Games Career Development
    • Production and Management
    • Games Business and Law
  • Game Design
    • Game Design and Theory
    • Writing for Games
  • Programming
    • Artificial Intelligence
    • Engines and Middleware
    • General and Gameplay Programming
    • Graphics and GPU Programming
    • Math and Physics
    • Networking and Multiplayer
  • Visual Arts
    • 2D and 3D Art
    • Critique and Feedback
  • Topical
    • Virtual and Augmented Reality
    • News
  • Community
    • GameDev Challenges
    • For Beginners
    • GDNet+ Member Forum
    • GDNet Lounge
    • GDNet Comments, Suggestions, and Ideas
    • Coding Horrors
    • Your Announcements
    • Hobby Project Classifieds
    • Indie Showcase
    • Article Writing
  • Affiliates
    • NeHe Productions
    • AngelCode
  • Workshops
    • C# Workshop
    • CPP Workshop
    • Freehand Drawing Workshop
    • Hands-On Interactive Game Development
    • SICP Workshop
    • XNA 4.0 Workshop
  • Archive
    • Topical
    • Affiliates
    • Contests
    • Technical

Calendars

  • Community Calendar
  • Games Industry Events
  • Game Jams

Blogs

There are no results to display.

There are no results to display.

Marker Groups

  • Members

Developers

Developers


Group


About Me


Website


Industry Role


Twitter


Github


Twitch


Steam

Found 437 results

  1. So I wrote a programming language called C-Lesh to program games for my game maker Platformisis. It is a scripting language which tiles into the JavaScript game engine via a memory mapper using memory mapped I/O. Currently, I am porting the language as a standalone interpreter to be able to run on the PC and possibly other devices excluding the phone. The interpreter is being written in C++ so for those of you who are C++ fans you can see the different components implemented. Some background of the language and how to program in C-Lesh can be found here: http://www.codeloader.net/readme.html As I program this thing I will post code from different components and explain.
  2. I'm trying to duplicate vertices using std::map to be used in a vertex buffer. I don't get the correct index buffer(myInds) or vertex buffer(myVerts). I can get the index array from FBX but it differs from what I get in the following std::map code. Any help is much appreciated. struct FBXVTX { XMFLOAT3 Position; XMFLOAT2 TextureCoord; XMFLOAT3 Normal; }; std::map< FBXVTX, int > myVertsMap; std::vector<FBXVTX> myVerts; std::vector<int> myInds; HRESULT FBXLoader::Open(HWND hWnd, char* Filename, bool UsePositionOnly) { HRESULT hr = S_OK; if (FBXM) { FBXIOS = FbxIOSettings::Create(FBXM, IOSROOT); FBXM->SetIOSettings(FBXIOS); FBXI = FbxImporter::Create(FBXM, ""); if (!(FBXI->Initialize(Filename, -1, FBXIOS))) { hr = E_FAIL; MessageBox(hWnd, (wchar_t*)FBXI->GetStatus().GetErrorString(), TEXT("ALM"), MB_OK); } FBXS = FbxScene::Create(FBXM, "REALMS"); if (!FBXS) { hr = E_FAIL; MessageBox(hWnd, TEXT("Failed to create the scene"), TEXT("ALM"), MB_OK); } if (!(FBXI->Import(FBXS))) { hr = E_FAIL; MessageBox(hWnd, TEXT("Failed to import fbx file content into the scene"), TEXT("ALM"), MB_OK); } FbxAxisSystem OurAxisSystem = FbxAxisSystem::DirectX; FbxAxisSystem SceneAxisSystem = FBXS->GetGlobalSettings().GetAxisSystem(); if(SceneAxisSystem != OurAxisSystem) { FbxAxisSystem::DirectX.ConvertScene(FBXS); } FbxSystemUnit SceneSystemUnit = FBXS->GetGlobalSettings().GetSystemUnit(); if( SceneSystemUnit.GetScaleFactor() != 1.0 ) { FbxSystemUnit::cm.ConvertScene( FBXS ); } if (FBXI) FBXI->Destroy(); FbxNode* MainNode = FBXS->GetRootNode(); int NumKids = MainNode->GetChildCount(); FbxNode* ChildNode = NULL; for (int i=0; i<NumKids; i++) { ChildNode = MainNode->GetChild(i); FbxNodeAttribute* NodeAttribute = ChildNode->GetNodeAttribute(); if (NodeAttribute->GetAttributeType() == FbxNodeAttribute::eMesh) { FbxMesh* Mesh = ChildNode->GetMesh(); if (UsePositionOnly) { NumVertices = Mesh->GetControlPointsCount();//number of vertices MyV = new XMFLOAT3[NumVertices]; for (DWORD j = 0; j < NumVertices; j++) { FbxVector4 Vertex = Mesh->GetControlPointAt(j);//Gets the control point at the specified index. MyV[j] = XMFLOAT3((float)Vertex.mData[0], (float)Vertex.mData[1], (float)Vertex.mData[2]); } NumIndices = Mesh->GetPolygonVertexCount();//number of indices MyI = (DWORD*)Mesh->GetPolygonVertices();//index array } else { FbxLayerElementArrayTemplate<FbxVector2>* uvVertices = NULL; Mesh->GetTextureUV(&uvVertices); int idx = 0; for (int i = 0; i < Mesh->GetPolygonCount(); i++)//polygon(=mostly triangle) count { for (int j = 0; j < Mesh->GetPolygonSize(i); j++)//retrieves number of vertices in a polygon { FBXVTX myVert; int p_index = 3*i+j; int t_index = Mesh->GetTextureUVIndex(i, j); FbxVector4 Vertex = Mesh->GetControlPointAt(p_index);//Gets the control point at the specified index. myVert.Position = XMFLOAT3((float)Vertex.mData[0], (float)Vertex.mData[1], (float)Vertex.mData[2]); FbxVector4 Normal; Mesh->GetPolygonVertexNormal(i, j, Normal); myVert.Normal = XMFLOAT3((float)Normal.mData[0], (float)Normal.mData[1], (float)Normal.mData[2]); FbxVector2 uv = uvVertices->GetAt(t_index); myVert.TextureCoord = XMFLOAT2((float)uv.mData[0], (float)uv.mData[1]); if ( myVertsMap.find( myVert ) != myVertsMap.end() ) myInds.push_back( myVertsMap[ myVert ]); else { myVertsMap.insert( std::pair<FBXVTX, int> (myVert, idx ) ); myVerts.push_back(myVert); myInds.push_back(idx); idx++; } } } } } } } else { hr = E_FAIL; MessageBox(hWnd, TEXT("Failed to create the FBX Manager"), TEXT("ALM"), MB_OK); } return hr; } bool operator < ( const FBXVTX &lValue, const FBXVTX &rValue) { if (lValue.Position.x != rValue.Position.x) return(lValue.Position.x < rValue.Position.x); if (lValue.Position.y != rValue.Position.y) return(lValue.Position.y < rValue.Position.y); if (lValue.Position.z != rValue.Position.z) return(lValue.Position.z < rValue.Position.z); if (lValue.TextureCoord.x != rValue.TextureCoord.x) return(lValue.TextureCoord.x < rValue.TextureCoord.x); if (lValue.TextureCoord.y != rValue.TextureCoord.y) return(lValue.TextureCoord.y < rValue.TextureCoord.y); if (lValue.Normal.x != rValue.Normal.x) return(lValue.Normal.x < rValue.Normal.x); if (lValue.Normal.y != rValue.Normal.y) return(lValue.Normal.y < rValue.Normal.y); return(lValue.Normal.z < rValue.Normal.z); }
  3. Hi, I am working on a project where I'm trying to use Forward Plus Rendering on point lights. I have a simple reflective scene with many point lights moving around it. I am using effects file (.fx) to keep my shaders in one place. I am having a problem with Compute Shader code. I cannot get it to work properly and calculate the tiles and lighting properly. Is there anyone that is wishing to help me set up my compute shader? Thank you in advance for any replies and interest!
  4. I'm looking for some references that could help me learn how to program some really basic 2D enemy behaviours. I wasn't sure whether to post this here or in the AI section but I think it might be more suitable to be posted here since it has more to do with basic maths than any AI related algorithms. Could anyone help recommend some resources (books, posts, videos) that could help me understand how to properly implement the basics of enemy movement in 2d games ? So far I've only managed to get them to chase the player character and to stop moving on collision, but the movement is pretty unrealistic and once the collision occurs the enemies all "pile up" on the player character. I'm doing this in C++ so no guides that explain how to script this using an engine api please.
  5. Good Evening, I want to make a 2D game which involves displaying some debug information. Especially for collision, enemy sights and so on ... First of I was thinking about all those shapes which I need will need for debugging purposes: circles, rectangles, lines, polygons. I am really stucked right now because of the fundamental question: Where do I store my vertices positions for each line (object)? Currently I am not using a model matrix because I am using orthographic projection and set the final position within the VBO. That means that if I add a new line I would have to expand the "points" array and re-upload (recall glBufferData) it every time. The other method would be to use a model matrix and a fixed vbo for a line but it would be also messy to exactly create a line from (0,0) to (100,20) calculating the rotation and scale to make it fit. If I proceed with option 1 "updating the array each frame" I was thinking of having 4 draw calls every frame for the lines vao, polygons vao and so on. In addition to that I am planning to use some sort of ECS based architecture. So the other question would be: Should I treat those debug objects as entities/components? For me it would make sense to treat them as entities but that's creates a new issue with the previous array approach because it would have for example a transform and render component. A special render component for debug objects (no texture etc) ... For me the transform component is also just a matrix but how would I then define a line? Treating them as components would'nt be a good idea in my eyes because then I would always need an entity. Well entity is just an id !? So maybe its a component? Regards, LifeArtist
  6. Hi. I'm kind of late to this party but I thought I would ask anyway as I haven't found a concrete answer. When creating a game engine, when should you choose one methodology over another (more specifically OOP and DOD)? Which areas benefit from DOD? Which areas benefit from OOP? Do people typically mix multiple methodologies throughout a project? I.e. certain sub-systems created in one, and others in the another? DOD - Data Oriented Design OOP - Object Oriented Design Pretty simple Thanks
  7. typedef struct FontInfo_t* FontHandle; MichaelNS::FontMgr m; MichaelNS::FontHandle FontGeladen; const char *FontPtr; start: InFileFont.append("Ubuntu-B.ttf"); FontPtr = InFileFont.c_str(); FontGeladen = m.loadFont(FontPtr, NULL, NULL, 14, 0); stop: m.unloadFont(FontGeladen); delete FontPtr; delete causes a crash. How to unload the class correctly? Thanks
  8. I need to use global vars, So say i have main.cpp file where i #include "globalvars.h" In globalvars.h i define extern int ppp; In globalvars.cpp i put #include "globalvars.h" int ppp; Now in main cpp during compilation i get UNDEFINED REFERENCE TO ppp
  9. Mobile SFML in android

    Can I use SFML to create a android app and is it good idea to do so ? I am so confuse right now to choose between SFML and SDL to learn . I liked SFML cause it is more Object oriented but Don't have android support(yet) on the other hand SDL have android support but is C based API.Some post on github tell that it is possible to use SFML in android but my question is that is it good Idea to do so? will app made in SFML C++ perform worse or equal to Java app on android ? I am really noob to Android and Game development.I can Only make some small Android apps using Java on Android and some some Calculator level apps using GTK+ on Linux, So I am pretty noob here. I don't know which to chose SDL or SFML but as My requirement for Android and Linux please also suggest me that should I choose SFML or SDL for learning ? Thanks for help in advance
  10. C++ Gameplay in C++

    Who writes gameplay in C++? I recently wrote an article in codeproject which describes some benefits of this (from a more general purpose perspective), but I'm curious for other thoughts on the subject. If you write engine code in C++ but the gameplay in another language, what made you take this decision? If you do write gameplay in C++, are you happy with your decision? Share some cool stories about it. Bonus points if you write gameplay code in C++ and engine code in another language
  11. I need to implement really simple event forwarding and I want to avoid two things: 1) having the user type out the name of the current class (or any class for that matter) and 2) having to worry about the return value, which may be void The forwarding itself will be wrapped into something like: bool/int/void MyCustomHandler::OnMouseEvent(int e, int, x, int y) { FORWARD_EVENT(OnMouseEvent, e, x, y); // calls some default implementation for this event } I want FORWARD_EVENT everywhere as long as it is given the name of the function and arguments. Of the the two problems listed above I have (2) under control, and I can also deduce the return value for (1) given a function signature. But I can't figure out if there's a way to automatically deduce the signature. Basically I want the compile time equivalent of this: using t2 = decltype((*this).OnMouseEvent); I've butted heads with member functions before so this has bugged me in the past. So far, as best I can tell there's no real way to accomplish this. I hope I'm wrong
  12. i'm trying draw a circule using math: class coordenates { public: coordenates(float x=0, float y=0) { X = x; Y = y; } float X; float Y; }; coordenates RotationPoints(coordenates ActualPosition, double angle) { coordenates NewPosition; NewPosition.X = ActualPosition.X*sin(angle) - ActualPosition.Y*sin(angle); NewPosition.Y = ActualPosition.Y*cos(angle) + ActualPosition.X*cos(angle); return NewPosition; } but now i know that these have 1 problem, because i don't use the orign. even so i'm getting problems on how i can rotate the point. these coordinates works between -1 and 1 floating points. can anyone advice more for i create the circule?
  13. Guess i use select to find whenever one peer fd is ready for some action, as far as i understand sockets whenevrr client sends some packet and read func returns end of file that means that server received a packet from a client, now what about when client send two packrts one after another, does select will return ready for that client to process first packet and after calling select again (and read) will it make the same client filedescriptor ready to receive that second one?
  14. Hi guys, Is there a way to setup a thread as a global, but fire off the execution of the thread elsewhere in the program? If I have something like this it throws an error - "term does not evaluate to a function taking 1 arguments" std::thread t1; t1(someFn); Any help would be greatly appreciated
  15. I am at the first year of diploma and I am planing to make a nice small 2D or 3D First Person Shooter game . As I mentioned I am just at first year in IT ,I Dont know much about game developing but I do know lots of more things that normal 1st and even 3rd year students . I Know Java,C,C++ and little bit of python and GTK+ framework . I am currently trying to learn SDL and Qt with C++. I will also happily learn new technology if required to make games. Now my main Question's are:- How much time will it take to make SMALL 2D game as a single person in SDL while LEARNING SDL ? How much time will it take to make SMALL 3D game as a single person in SDL while LEARNING SDL ? Will learning Qt help me make games faster or with High performance ? My main platform is Linux and Android.I don't care if It runs on windows or Mac but it should run fine on Linux . Thanks in advance
  16. OpenGL Uniforms

    While writing a simple renderer using OpenGL, I faced an issue with the glGetUniformLocation function. For some reason, the location is coming to be -1. Anyone has any idea .. what should I do?
  17. I found this demo a long time ago and I love it. I was wondering if it could be improved/expanded somehow. I plugged it into CodeBlocks to try to get a bigger resolution and x64 but it hollered GLU errors. I do not program but put some years in on a chess GUI dev team. Coder is cool with the use of the code. Best Regards SubAtomic2.zip
  18. Currently, our framework only supports loading binary shader code. The way we do it in Visual Studio is through custom build tool per shader file. Now we also want to support shader recompilation when a user presses some key. This is tricky since now we don't have access to the source files. So I was thinking, if there is some way to export all the commands from the custom build tool to a text file, then we can just load that text file and execute all commands inside and then just do the regular shader loading as we do it right now. Example custom build tool command for a shader which has vertex, pixel, and geometry shader stages: fxc %(Identity) /E VSMain /T vs_5_0 $(HLSLCompileFlags) /Fo %(Identity)\..\Binary\%(Filename).vert.bin fxc %(Identity) /E PSMain /T ps_5_0 $(HLSLCompileFlags) /Fo %(Identity)\..\Binary\%(Filename).frag.bin fxc %(Identity) /E GSMain /T gs_5_0 $(HLSLCompileFlags) /Fo %(Identity)\..\Binary\%(Filename).geom.bin So here is the process- - Run custom build rules for the shader files - In post-build event of the project, collect all these custom build tool commands and dump them to a text file - Now if user wants to recompile, just load this text file and execute all commands inside How would I get access to these custom build tool commands in the post-build event?
  19. Hello All, About 4 months ago I started a community driven Game Development Kit project on gitlab to teach myself OpenGL. It's slowly starting to pick up a bit of attention and i'm looking for more people interested in developing an open source tool which could be use to develop new game engines in the future. The library is written in C++17 and uses OpenGL core profile. Your graphics card must support opengl version 3.3 or higher. If you're interested in this project here is the gitlab: https://gitlab.com/oddly-doddly/salem-gdk There is a wiki page for contributors, but since the project is so new, a lot of the documentation is still in the works. I will be putting up setup instructions for windows, osx, and linux (Debian and arch based) this weekend. If you are interested or have questions, there is a discord link on the project's readme please feel free to contact me through discord or a reply to this thread.
  20. Guess i have a thread and im on main thread of app now i would like to wait until thread finishes to execute. Thread Func void ProcessServerFrame() { server_thread_free = false; while (!server_thread_finished) Do stuff server_thread_free = true; } And then from main thread i would like to check whenever thread finished to work void CreateDWMTCPServer() { if (server != 0) { server_thread_finished = true; while (!server_thread_free) {} delete server; server = 0; } } Now i am not sure if thread is allowed to read data when other is writing to it or maybe theres some kind of queue that prevents that from happening, basically i dont want to check for server_thread_free when thread marks it as true any thoughts?
  21. I am trying to get user input in ascii text only from keyboard using Allegro 5 on ubuntu. I want to store input in buffer or structure and be able to show on screen. Anyone know how this can be done? Thanks
  22. Hi guys, I'm having some trouble understanding what this code is doing, can you give me a hand ?_? Code by Vittorio Romeo, you can find the whole thing here So the part I'm having trouble with is this one: // Another useful method will allow the user to execute arbitrary // code on all entities of a certain type. template <typename T, typename TFunc> void forEach(const TFunc& mFunc) { // Retrieve all entities of type `T`. auto& vector(getAll<T>()); // For each pointer in the entity vector, simply cast the // pointer to its "real" type then call the function with the // casted pointer, dereferenced. for(auto ptr : vector) mFunc(*reinterpret_cast<T*>(ptr)); } and // The game logic is now much more generic: we ask the // manager to give us all instances of a certain game // object type, then we run the collision functions. // This is very flexible as we can have any number // of balls and bricks, and adding new types of game // objects is extremely easy. manager.forEach<Ball>([this](auto& mBall) { manager.forEach<Brick>([this, &mBall](auto& mBrick) { solveBrickBallCollision(mBrick, mBall); }); manager.forEach<Paddle>([this, &mBall](auto& mPaddle) { solvePaddleBallCollision(mPaddle, mBall); }); }); I get that forEach<T>(Tfunc) retrieves a vector<BaseClass*>& ,casts every element in it from the BaseClass pointer to a T* and apply the TFunc passed to them, but I kind of get lost, I mean why the lambda passed to it is capturing [this], and even what is [this] in that context...?! Is it the Game class that owns the manager data member? Or 'this' is becoming something else inside the forEach function (meaning that it acts inside of it since is a template argument, capturing the "this" inside of forEach, which I believe should be the manager itself?). And then, I don't see 'this' used anywhere, so...just very confused. Can you help me understand?
  23. I'm not sure if this is the right place for this question, but I'll give it shot Using Visual Studio Code, I have the task.json set up to launch a batch file that is set up like follow: @echo off call "Z:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x86 set INC_PROJECT_PATH="Z:\Asus\Documenti\VS Code\Projects\Packman Clone 1" set INC_SDL_PATH="Z:\Dependencies\SDL2-2.0.5\SLD2" set SOURCE1_PATH="Z:\Asus\Documenti\VS Code\Projects\Packman Clone 1\source\*.cpp" set SOURCE2_PATH="Z:\Asus\Documenti\VS Code\Projects\Packman Clone 1\Engine\*.cpp" set LIB_SDL_PATH="Z:\Dependencies\SDL2-2.0.5\lib\x86" set OUTPUT_PATH="Z:\Asus\Documenti\VS Code\Projects\Packman Clone 1\Debug\Pacman.exe" cl /std:c++latest /W4 /ZI ^ /I %INC_SDL_PATH% /I %INC_PROJECT_PATH% ^ /EHsc %SOURCE1_PATH% %SOURCE2_PATH% ^ /link /SUBSYSTEM:CONSOLE ^ /LIBPATH:%LIB_SDL_PATH% SDL2main.lib SDL2.lib ^ /out:%OUTPUT_PATH% I'm not totally sure about what it's doing and I'm piecing it togeter as I go (trial and error + google), so if I got it right, the *.cpp at the end of those paths, it means that every time I build it will build all the .cpp that it finds in those 2 paths. And that doesn't sounds good, so I was wondering, there is a way to tell it to re-compile only the files that have changed?
  24. While I am running my directX11 engine in windowed mode, I can use the snipping too to get a screen cap of it. However, if I run it in full screen and hit print screen button, and try to copy paste that into paint or photoshop, it has nothing - print screen isnt capturing the image for some reason, and I cant use snipping tool to get the screen cap while its in full screen? Is there some setting or soemthing thats not allowing windows to detect the game while it's in full screen? Very important to get these captures for my portfolio, and if I capture it in windowed mode, it looks really bad and low res. Heres a link to the D3D class in my engine for reference https://github.com/mister51213/DirectX11Engine/blob/master/DirectX11Engine/D3DClass.cpp Any help would be much appreciated, thanks!
  25. This is from the unreal tutorial battery collector c++. I'm learning unreal and am new to it so i couldn't guess why this is happening. Is it clear to anyone what i have to do to fix this?
  • Advertisement