• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.


  • Content count

  • Joined

  • Last visited

Community Reputation

240 Neutral

About uzipaz

  • Rank
  1. Thank you for the reference @newtechnology @Mark please correct me if I am wrong but if I am return a pointer variable from the function, its an address to a dynamic memory, why would local scope would cause any problem here?
  2. Hi, I am trying to use assimp library to import 3D models into my c++ program and I am having a memory access violation error with using the library. I am using Visual Studio 2015 on Windows7-64bit. I am trying to read a model and then render(wireframe only) it using OpenGL. In my program, I first read the model using Assimp::ReadFile function, which seems to be successful and then I iterate through the aiScene data structure to retrieve the lists of vertices and construct corresponding vertex buffer objects for opengl. My assimp import function   const aiScene* readModel(const std::string& File) {     Assimp::Importer importer;     const aiScene* scene = importer.ReadFile(File, aiProcess_Triangulate);     if (scene == NULL)         std::cout << "Import error: " << importer.GetErrorString();     else     {         std::cout << "Import successful\n";         return scene;     }     return 0; }   In my program, this function always prints out "Import successful" on the console and returns the scene pointer. Then I run my processing function to generate vertex buffers from the aiScene object,   void genVAOsAndUniformBuffer(const aiScene *sc, GLuint program) {     MyMesh aMesh;     GLuint buffer;     // For each mesh     for (unsigned int n = 0; n < sc->mNumMeshes; ++n)     {         // Program crashes here, in first iteration         const aiMesh* mesh = sc->mMeshes[n];     My program crashes on the last line here(memory access violation) when accessing the mesh object from mMeshes array. It crashes in the first iteration of the loop, accessing the mesh object at index 0. I have tried different 3d models and different extensions such obj and 3ds. I have also tried by setting the flag on ReadFile function to 0. All crash on the same line of code. When debugging the code, I noticed that for no matter the 3d model or extension, the variable sc->mNumMeshes always has the value of 3722304989, which doesn't make sense to me because it can't be the same if I am using the 3d models that don't have the same number of vertices or just completely different. Thats all I have for now, I tried searching on the internet, I couldn't find anything on it. I would really appreciate any help I can get. If this subforum is not the appropriate place to ask about a 3d model importing library for c++, then I ask the moderators to kindly move this post to the appropriate subform. Thank you for reading.
  3. I apologize for being away for about 3 weeks, busy with exams and just finished.   I was able to easily implement 2D BSP trees in python for quick demonstration, randomly generated line segments as obstacles and points to determine LoS between them.   for each two points, I traversed the BSP tree, if the two points lie across the partitioning line segment, then I do an intersection test of LoS and that obstacle at that node, if no intersection, then I move to left and right subtree, if there is intersection, we do not have LoS and we stop. In case, the points lie on one side of the partitioning line segment, I do not have to do intersection test and move to either left or right subtree, depending on the side. If we reached the end of BSP tree, then we will have LoS. Runtime complexity of this would be log(m) <= O(m) <= m, where m are number of obstacles. However, the tests I did with BSP tree, the average number of traversals remain close to log(m), given that our tree is balanced.   Anyways, I have new concern with BSP trees, since constructing BSP trees is a precalculation step, for example, we may construct trees while we load a level and then use this tree to render and answer geometric queries during we play.   what about moving obstacles, like moving doors, or rotating walls, this will change our BSP tree, how do we reconstruct our BSP tree in real-time?   If a wall segment moves along the partitioning line, then our BSP tree remains the same if a wall segment moves away from the partitioning line and/or rotates, then our BSP tree will most likely change, a) either it will partition existing line segments in its subtree  b) it could also now lie on other side of its parent node   Also, like a door opening or closing in a game, our line segments, will move little by little every frame, so in each frame, we will be checking if there is a change in BSP tree and if there is, we reconstruct it, it sounds very computationally expensive.   how do you approach this?
  4.   Thank you for the explanation. But none of this makes sense to me right now, as I don't have any experience with video games mathematics and algorithms.    I understand the first sentence though, at the end BSP generation, you end up with subspaces each containing a wall on the edge (that was used to split spaces). But I am still not sure how exactly I will determine LoS between two points in the plane after I have the BSP. When you say that 'start with a big polygon that covers the entire scene and clip it through the BSP', Do you mean traverse through the BSP?   Even then I can't make sense of the last two senstences there.     I don't understand how exactly we end up with set of polygons that define the visible area? and how do they define the visible area?   In the end, When I have a BSP generated, and I want to determine LoS between two given points, do I just traverse through the BSP doing intersection tests with each line segment I encounter and stop if there is intersection or otherwise I end up traversing the whole tree to find out that we have LoS (in this case, number of intersection tests for two points are equal to number line segments, not so optimal i think).   I'll appreciate a bit more explanation or point me to it.   Thank you very much.
  5. Thank you for the prompt reply.   This problem of determining visibility among N points is just to be used for programming AI.   With the simple grid approach. For one source point, I should raycast from this point to all other points and traverse each of them through the grids and as soon as the ray intersects a line segment occurring in the grid, I stop (no LoS), or, the ray never intersects anything and I reach the grid that contains the point in question, then we have LoS. This approach definitely decreases the amount of intersection tests against obstacle line segments, given that line segments are ideally equally divided among grids. But the issue is, this approach will not give us any other information other than true/false for LoS.    As I know, the raycasting approach as demonstrated here. This will also find the visible areas the AI can see (along with LoS to other points) which we can also use for AI movement for example. But for each point, we cast rays to all line segment obstacles. I am not sure if using any kind of space partitioning will help here with algorithm performance?   I am doing this as a course project, I have to analyse performance of different algorithms to solve this problem. I appreciate all comments/thoughts you guys can give me.
  6. So I am working with a 2D plane with N arbitrarily placed points and M obstacles which are just straight line segments (no two line segments cross each other). The goal is to determine which points are visible to other points in the plane, in the most efficient way possible.   The naive way to do it is compare every point with other points. That is N(N-1)/2 comparisons at least and for each two points, test intersection of its line of sight segment with all obstacles. This is just very computationally expensive.   Other approach i know of, is to determine area of visibility from each point, as it is done to determine which area of the scene are illuminated from a light source, I believe they use ray casting. We can use ray casting from the source to end points of line segments (obstacles) to determine which areas are visible in the scene. This is to be done for every point in the scene. I don't know if this approach is computationally any better or not.   I am not sure if using space partitioning such as BSPs will help with this problem or not.   But, I will appreciate any advice, help regarding this problem. Thank you.  
  7. I did not knew about space partitioning method. Isn't this comes in hierarchical path finding? The game on which I am working on is not that complex or big. There are simple static walls and obstacles to be placed in the level. Maybe, I did exaggerated on algorithmic complexities of the problem but I did so with my understanding of the problem's solution.
  8. I am working on a small 2D game and my goal is to make the AI as the most proficient feature of the game. The space in which in the my characters will move within is continuous just like in 3D or RTS games. I studied some books/surfed the internet and I decided that implementing navigational meshes to represent search spaces seems to be the most appropriate technique.   But, I am new at this and I have few questions for which I have not been able to find satisfactory answers.   (i) Is it necessary for the navmesh polygons to be convex?   (ii) If I have a point(x,y) in my 2D world and I have the navigational meshes specified for the level, how do I know on which mesh polygon I am currently standing on(localization)?   My guess: If I have 'n' number of polygons in my level and each of them are specified with their own set of vertices, then this becomes a O(n) problem in the worst case. I would have to check each polygon for the existence of that point within it.   (iii) How do I generate a graph data structure from the navmesh for the A* pathfinding algorithm to use?   My guess: From my understanding, this becomes a O(n²) problem in the worst case, provided that we have 'n' number of polygons in the level and each polygon has its own set of vertices. For each polygon, I would have to look at every other polygon in the worst case and find if anyone of the pairs shares at least one vertex with each other. If they do, then they become neighboring nodes.   (iv) For heuristic calculations(euclidean distance) and conversion from graph node to game position, which point in a polygon should I use?   My guess: The centroid of a convex navmesh polygon seems to be the most appropriate choice. If we have 'n' number of vertices for a polygon, then from my understanding, calculating the point of centroid seems to become a O(n) problem.   That is all the questions I have right now. Kindly, please also give me some tips on to how should I organize the data of navmesh polygons into a meaningful data structure?   Any help will be greatly appreciated, Thank you.
  9. I am rather a confusing individual... My point was that I would like to do this from scratch (as I did basic A*) so I could learn and understand the algorithm and the techniques... and I searched for Navigation meshes on the internet and several game programming books (including game programming gems, AI game wisdom). They don't give me any guidance about where to get started for this for newbies like me... but they describe a lot of different techniques and algorithms...   What you have described in your post is that I should stick with the rectangular grid... and it automatically does answers a lot of questions for me if I stick with a rectangular grid with each being of fixed equal size...
  10. I have to write a simple 3D game in which I would like to implement an agent that can navigate through a map that has walls and simple static obstacles...   Now, I have studied the A* algorithm and was able to successfully write my own algorithm in c++... The algorithm runs on a rectangular grid with all the grids of being the same size... and can calculate optimal paths using euclidean distance as the heuristic...   Well, I have searched the internet and some game programming books and saw that just writing an A* algorithm is not enough, I need to have search space representation which in my case is a rectangular grid, translation of agents and 3D world knowledge between the algorithm and the game...   I was looking into some search space representation techniques and one of the most popular being navmesh and waypoints... I have read that pathfinding using waypoints in not recommended anymore and navmesh is the most popular among current AI developers...   Now, my issue is that I have never worked or programmed nav meshes before and this is the first time I am writing a game that has an AI component or NPCs...   How should I approach this? should I start by how to automatically generate navigation meshes for a level? or adjusting my algorithm to support navigation meshes?   I would gladly appreciate any advice...
  11. That did it... The only problem here was I was using the wrong bit version of the libraries... I am using a 32 bit compiler with a 32 bit Operating System and I was linking my project with 64 bit libraries and headers...   There are two download folders for SDL 2.0 development files... one is name "x86_64-w64-mingw32" and the other is "i686-w64-mingw32"... I confused the former with 32 bit... however the string had x86 in it so I thought these were the 32 bit files... however I was wrong...I wasted a lot of energy and headache in just discovering this trivial error...   Thank you for the link...
  12. I have used CodeBlocks with MinGW to use opengl with SDL 1.2 and I was able to link libraries that are required for MinGW to work with SDL 1.2, these static libraries are mingw32.lib, SDLmain.lib and SDL.lib. However, I just got SDL 2.0 and I having trouble linking libraries with my SDL 2.0 project.   I did the same procedure, I went to Project->Build Options->Linker Settings and added three libraries that are required for SDL 2.0 (I extracted the library files to the MinGW lib folder and the include files to the MinGW include folder, the static lib files are in .a extension and written as libSDLmain.a instead of SDLmain.lib) and add three files under link libraries with names of "libmingw32" "libSDL2main" "libSDL2". In the search directories tab I added the path to the MinGW lib folder where I placed my SDL static library files...   I wrote the code and checked carefully for deprecated and changed function names that are in SDL 2.0...   When I compiled the code, I am getting these errors   obj\Debug\app.o||In function `ZN3app9onExecuteEv':| D:\Programming\SDL OpenGL\app.cpp|19|undefined reference to `SDL_PollEvent'| obj\Debug\appOnInitialize.o||In function `ZN3app12onInitializeEv':| D:\Programming\SDL OpenGL\appOnInitialize.cpp|5|undefined reference to `SDL_Init'| D:\Programming\SDL OpenGL\appOnInitialize.cpp|24|undefined reference to `SDL_CreateWindow'| D:\Programming\SDL OpenGL\appOnInitialize.cpp|27|undefined reference to `SDL_GL_CreateContext'| obj\Debug\appOnRender.o||In function `ZN3app8onRenderEv':| D:\Programming\SDL OpenGL\appOnRender.cpp|15|undefined reference to `SDL_GL_SwapWindow'| C:\Program Files\CodeBlocks\MinGW\lib\libmingw32.a(main.o):main.c:(.text.startup+0xa7)||undefined reference to `WinMain@16'| ||=== Build finished: 6 errors, 0 warnings (0 minutes, 0 seconds) ===|   I did a lot of google searches but I am not able to configure how to sove this... I am a noob with configuring compilers and linking and building libraries in C++, can someone please guide me how can I solve this in my CodeBlocks IDE?   Thank you  
  13. Hi, I'm writing a program where I have to manipulate the stream pointer in an input file. I wrote a testing program, I wanted to test if I get the right pointer position in a file where I have written few strings in a single line. The contents of the file are "hello world foo(int) a=b". The code is [CODE] #include <iostream> using namespace std; #include <fstream> int main() { ifstream Infile; char c; Infile.open("Input.txt"); if (Infile.is_open()) { Infile.seekg(0, ios::beg); while (!Infile.eof()) { cout << Infile.tellg() << ' '; Infile.get(c); } } return 0; } [/CODE] The output of the program is 0 2 4 6 8 10 12 14 16 18 20 22 24 26 However, should'nt it be 0 1 2 3 4 5 6 7 8 9 10 11 12 13 and so on.... Because I am reading one character at a time and from what I know, the get(char) function also reads whitespaces and endlines... I don't understand why the position pointer is being incremented by two and not one!!? However if manipulate the pointer using seekg() func, it returns the character at that position but If i use tellg() and just read input, then it increments the pointer by two... Any clues?