• Create Account

We need 7 developers from Canada and 18 more from Australia to help us complete a research survey.

Support our site by taking a quick sponsored survey and win a chance at a \$50 Amazon gift card. Click here to get started!

# warisson

Member Since 05 May 2013
Offline Last Active Sep 17 2014 02:24 AM

### Algorithm to find neighboring rectangles?

15 September 2014 - 03:28 AM

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?

### Entity component systems

06 August 2014 - 04:27 PM

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?

### A* pathfinding around axis-aligned rectangle obstacles

05 May 2013 - 04:09 AM

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?

PARTNERS