Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

172 Neutral

About Tosh777

  • Rank

Personal Information

  • Interests
  1. Tosh777

    Code generation

    Thanks for the answers. In the end I wrote the code generation code myself.
  2. Hello, I need a tool which can generate c++ code, more precisely - for each string in some file to generate one header and one cpp file, and to add some functions in several files. What do you guys use in such scenarios? Of course I can write such generator myself in Python, but if you have better advice I would listen.
  3. Hello, in our project we have separated the logic and the loading of the objects it needs. The loading of the objects happens in different thread and after all the objects are loaded we start the execution of the logic. For example, we have gameplay code where we will need certain object (which can be seen only when reading the code, the object is not present in level file), we first load the object and after that we start the code (some function for example). Our goal is to free the current thread, which executes logic, from the loading of objects. Some objects depend on other objects - to load certain object, another object must be loaded first. Also, there is no established hierarchy (so we can traverse it and load child objects of a parent) and we don't know what has to be loaded, unless we read the code. The current problem with this implementation is that it is hard to maintain - we have to read all the logic, see what is going to be needed and add it for loading. Is there elegant solution to solve this problem?
  4. Helllo, I am multithreading large piece of code (gcc 7.4, c++17) and I stumbled upon a lot of race conditions when accessing std::shared_ptr. I tried using boost::atomic_shared_ptr, but there are some critical parts of the code where shared pointers are returned from functions, or shared pointers are used in constructors of other classes, which is not supported from boost::atomic_shared_ptr (copy constructor and assignment operator are private). I had 3 other suggestions: -to wrap every place where shared pointer is accessed with mutex, but this looks like overkill to me. -to create my implementation of atomic_shared_pointer. -to use std::atomic_store/std::atomic_load. What is the best way to make the access to the shared pointers thread-safe? Is there something special to consider when returning shared pointer from function, related to atomicity?
  5. Tosh777

    A star implementation

    Thank you all for the answers!! Definitely cleared a lot of confusion and I will be heading for the navmeshes for the pathfinding. I was looking for the best possible way to handle this problem, not just implement basic A*.
  6. Tosh777

    A star implementation

    First to clarify things, I am writing RTS game. I havent though about being on GPU or multithreaded. Do you have suggestions there? May be using compute shaders and splitting the map on zones? Or running the algorithm in parallel for each unit in the game? As far as I understand there are two representations - incidence matrix (2d array with positions) or linked list implementation (nodes to neighbours). Is using incidence matrix more efficient in this scenario? Again my concern (regardless of the choice of implementation) will be that the path will be very blocky, because the element in the array will be integer coordinates, not floating point. Is this something to worry about? For the pathing criteria - it will be flat terrain with obstacles, similar to Warcraft 3 in terms of trees, buildings and units. It is real-time. If we have tree in front of an unit, the unit has to bypass it, but if the tree is cut, the unit can move over it. Same for units that block your path and you have to bypass them. For the root, I said it in terms of the graph I was thinking to do. If I have to traverse it in order to find my position I have to start from the root node, which for example can be (0,0) position. If I use incidence matrix, though, this problem disappears. As for waypoints - I am not looking at waypoints system or navmesh system at the moment. I want the movement to be freely available everywhere and if obstacle is destroyed to be able to move through it. May be waypoints+navmesh would be the better choice for this scenario, instead of 2048x2048 2D array. What is your opinion?
  7. Hello, I am starting to implement A star in my game and I want to get your advice before doing so. Currently I have 2048x2048 map, which I plan to turn into a graph, where each node is coordinate - for example (512,512) and its children are the nodes around it - (513,513),(512,513),(513,512),etc. For the implementation of the graph I am looking at linked list of nodes, where each node contains array of its children. Each node will have bool whether this coordinate is occupied or not. After I have the graph I will run A* on it to get the shortest path. So I have some questions: - Is this the right way to approach this problem? - Will the movement of units be "blocky"? If an unit has to go in diagonal path to an enemy, will he go directly there in straight line or in some weird way, because my coordinates will not support floating point in the graph? - How is this problem solved in games like Starcraft? How is it solved for very big maps? - How can I access graph node directly, instead of traversing the whole graph? If my unit is at (1024,1024) and the root of the graph is (0,0) I dont want to traverse the whole thing, just to get to my unit position. Thanks for your answers!
  8. Tosh777

    Quick Opaque Pointer Example

    nice article
  • 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!