warisson

Member
  • Content count

    7
  • Joined

  • Last visited

Community Reputation

132 Neutral

About warisson

  • Rank
    Newbie
  1. Hmm, that's a pretty good idea. I was trying to tackle the problem from the approach of using a sweep line method, but couldn't figure out if I could use the BSP tree structure to improve the performance. The rectangle data is indeed static, and never changes, so I guess I'd agree that it wouldn't be too bad if this step takes a bit longer than the next step in the process. I'll try out what you suggested, thanks!
  2. I have a huge rectangular region that I divided up into smaller rectangles. I used a binary space partitioning algorithm to do this task (details can be found at http://doryen.eptalys.net/articles/bsp-dungeon-generation/, up until 'Building the dungeon'). However, after dividing up the space, I want to, for each individual rectangle leaf in the tree, determine all the rectangle leaves that share an edge, or any part of an edge, with it (obviously, this will always include that leaf's sibling, but may also include other nodes that could very well be on the other side of the tree). For example, in the picture http://doryen.eptalys.net/data/articles/dungeon_bsp3-medium.jpg, the rectangle in the upper left corner is neighbored by the rectangles directly east, south, and southeast of it. Assuming that I can use the list of rectangle leaves without considering the structure of the underlying tree or work directly on the tree (possibly as it's being built?), whichever works best, does anyone have any ideas as to an efficient algorithm to perform this task faster than simply checking all pairs of rectangles?
  3. Entity component systems

    I read that, in an ECS, the components an entity has basically define what that entity does and is capable of doing through data. But I'm unsure as to one detail in the implementation. Say, for example, that an entity, in this case, a character like a monster or the player, can float if it has the Floating component. Should I give entities this Floating component only if they ought to float, and remove it when they shouldn't float, ie. when a buff is applied that grants the 'Floating' status effect, the component is added to the entity, and then when the buff runs out, the component is removed? Or should I give all entities that could possibly float (in this case, all the entities that represent characters) the Floating component, and use a bool inside the component to determine whether that character should actually have the floating effect applied to it or not? It seems like both could work. But which one would be more appropriate?
  4. I see. Those two libraries would certainly help a great deal; they're probably optimized well beyond anything I could ever manage. Unfortunately, the game world's density can vary immensely. You might be trapped in a complicated maze and have to pathfind out, or you could be in a wide open area with a few obstacles lying around; it has to perform well on all test cases. I suppose I could also keep a record of places I've gone to and what their navigation mesh is to improve performance as well. In any case, I think those libraries' functionalities should be sufficient to generate a good graph to pathfind on. Thanks!
  5. Hmm, it certainly sounds like I can reduce the running time by calculating connections while pathfinding rather than before, as you guys said. Perhaps I should have mentioned some more details: the player character walks around a 2D area with rectangle obstacles that don't move (or rather, very few obstacles are able to move around, and they're always player-sized or smaller, so if we collide with something, we can just run the pathfinding again). The reason why I said that the rectangles move around a lot is that the player can only see a certain area of the map (which is huge), and because the player is constantly moving whenever it paths around, rectangles move around, get placed in the area of sight, fall out of the area of sight, etc, all the time. However, while pathfinding, they're definitely mostly stationary. The player is the only agent that needs to pathfind. Also, when I pathfind, I'm only looking to go from the starting point to wherever I want to go to, no more. The environment to path in is typically medium-sized (I know that's a poor description but I'm not sure how else to explain it). Also, the rectangle obstacles are allowed to overlap each other, which I hope will not affect the algorithm (at least, it doesn't seem to me like it should affect a great deal). There's also something else I should have added. Sometimes, it's not possible to find a path from A to B (ie, when B is inside an obstacle or enclosed by rectangle obstacles). Would I have to search through all points, then?
  6.     Hmm, this sounds like a fairly easy solution. But it would be ideal to have the path have as few turns or joints as possible, as each time I make a turn, I have to stop for a split second. Making very small moves and then moving in another direction will probably make traversing the path take a very long time; is there a way in which I can smooth out the path after finding it?     Unfortunately, due to certain circumstances, I can't change anything about the problem I've been given, only the way in which I choose to solve it. I'm not sure what you mean by breaking down rectangles into nodes and setting them as non-walkable?
  7. Hi, I'm faced with the following problem: I'd like to pathfind from point A to point B around various axis-aligned rectangle obstacles. However, I can't preprocess the area to improve performance. The only thing I'm given to pathfind on is the list of obstacle rectangles, and the start and end points (because the rectangles change constantly). It seems that all paths from A to B go through either A, B, or a rectangle corner point, so it seems like I can use A* from A to B on a visibility graph determined by those 3 types of points. However, I am uncertain about how to process the rectangles in a quick fashion to get this graph; there can be up to about 200 rectangles on screen at any given time, and calculating whether each point is directly reachable from every other point results in a very noticeable delay for the pathfinding. Is there a fast way to go about pathfinding through this?