Tag Info

8

What you're describing is the Segmentation Problem. I'm sorry to say that it's actually an unsolved problem. But one method I would recommend for this is a Graph-Cut based algorithm. Graph-Cut represents the image as a graph of locally connected nodes. It subdivides connected components of the graph recursively such that the border between the two ...

4

Sounds like you're after something like a flood fill algorithm. Basically, something like the following algorithm (you can see other examples on the wikipedia page): 1. Add your castle to the Checklist 2. Get the first item from the Checklist 3. For each surrounding position 4. If not on Complete list 5. If `0` add to Checklist 6. If `1` ...

4

Here's a complete algorithm that I think should produce good results. Perform morphological erosion on the water area — that is, make a copy of the map on which each tile is considered water only if it and all of of its neighbors (or a larger area, if you have rivers wider than one tile) are water. This will result in all rivers disappearing entirely. ...

4

A quick and dirty way to identify a separate but connected body of water would be to shrink all water bodies and see if gaps appear. In the example above I think that removing all water tiles which have 2 or less water tiles connected to them (marked red) would provide you with the desirable result plus some edge noise. After you have labeled the bodies, ...

4

What shapes are you using? If your shapes are convex (like circles, squares, rounded rectangles), you can just draw versions of different size and clip them to a triangle whose diagonal goes from upper right to lower left. I.e., zoomed in, light-to-dark: and dark-to-light: Then clip that: And then combine the two bezels: and finally draw the ...

3

You could look at Theta* - it's invented for exactly that purpose. Pretty much like A*, except when adding a node it tests if the new node can be reached directly from the active node's parent, and if so from that node's parent, and so on. It produces very-nearly-perfect paths in most conditions. Image is the output of my very, vey buggy C++ ...

3

Always start with a triangle list... it's most general and easiest to think about. You'll end up with four categories of faces: cube faces (quad = 2 triangles each) edge bevels (quads = 2 triangles each) corner bevels (quads = 2 triangles each) corner tips (last triangle) There's different numbers of each of these, so they'll probably be handled ...

3

This is a known hard problem, determining what rectangles can be tiled with certain pieces. However, if you're building puzzles and can control the pieces, it's the opposite, constructive problem, and easier... Build a solution constructively. Take a few pieces you like, and fill the puzzle however you want. Then throw in enough single-squares to fill it ...

1

First of all, I think the grid is pseudo-3d: 2D movement area, but create vertical lines when the height changes. Given that, check this answer, as the same principle applies.

1

Create your points so they form a solid line on a 2D plane. Walk the line starting with a point that's on ground level, for each point: If the ground is above or below the current position, add a new point, and shift the existing point and all remaining points up or down to meet the height of the ground. -Continue until all points have been touched. You ...

1

First, find the average, minimum and maximum distance all vertices in the shirt mesh. Let those be Da, Di and Dx, respectively. Also let Dai = Di/Da and Dax = Dx/Da. Then, you test each point of your shirt mesh Ms to know if it's inside the body mesh Mb, possibly using the Jordan Curve Theorem, which is based on raycasting. Store all vertices which are ...

1

Here's a technique we've used in the past to cheat a bit on more confined hardware. It's not as pure as the more complex solutions, but has the distinct advantage of being much easier to implement and works every time. Rather than focusing on the entire puzzle, break it into smaller, uniform units. Each of these units is composed of a set number of pieces ...

1

Create an octree and in each leaf cells put the list of all triangles from B that intersect the cell, mark at each levels whether or not the cell is empty. If one cell at any level has only 1 poly note the poly so you can stop the search early (large floor/wall triangles). You can keep sub-dividing cells until you have a reasonable number of triangles in ...

1

Are you on track, yes no maybe. Figuring collision sets (moving vs. stationary) is helpful, but will not bring you far. If you implement a general NxM solution that is efficient you may actually get more bang for your buck. For starters you should separate your collision detection from your collision response. This makes sense since you may want to collide ...

1

I recently went through this exercise and evaluated both on a couple of platforms. I found that my engine had many moving objects clustering on top of each other. As they moved around the Sweep and Prune (SAP) implementation caused too much sorting and overlap callbacks every frame. It was crippling my platform, which is not too powerful. I did all the ...

1

I have implemented A* pathfinding on a hexagonal grid in C# that nicely smooths paths like so (in an opensource project under the MIT License): Key portions of the code are reproduced here. void ExpandNeighbour(IDirectedPath path, NeighbourHex neighbour) { if ( ! OpenSet.Contains(neighbour.Hex.Coords)) { var cost = StepCost(neighbour.Hex, ...

1

Computing an exact convex decomposition of a surface S is an NP-hard problem and usually produces a high number of clusters. To overcome these limitations, the exact convexity constraint may be relaxed and an approximate convex decomposition of S is instead computed. Here, the goal is to determine a partition of the mesh triangles with a minimal number of ...

1

I don't think you've got your answer since you're asking about dodging bullets (and not general avoidance ai behaviour). There are many simple ways to deal with that, each one is appropriate for a different scenario. 1- trace a ray from all bullets towards their respective progrades and with the ray magnitude (distance) relative to their velocity PLUS (or ...

Only top voted, non community-wiki answers of a minimum length are eligible