Tag Info

Hot answers tagged

6

The solution is easy implemented but very very computionally heavy - I would not be suprised if this was NP-complete problem, similar to the travelling salesman. The solution has two steps: compute distance between all points (food locations and your location), you can do that with Floyd-Warshall algorithm in n^3 complexity from then, you need to find the ...


4

Since your AI is steering based it's pretty simple. You need to weigh your forces based on how important they are. The closer you get to obstacles the more important they should be, otherwise chasing should be the most important. There are a couple different ways to implement it, but I always found having some "max force" worked best where you iterate over ...


3

There is an approximation for the traveling salesman that will fit your needs very good. It is Cristofides algorithm. Here is how it works: From your current position calculate a minimum spanning tree to the food items. Stop the calculation when the tree will contain 30 food. Calculate a hamiltonian path from the tree by appending non-visited elements when ...


1

This sounds similar to polyomino puzzle solving, which I've played with... With a 10 x 10 grid, you can reasonably do an exhaustive search for each shape. Starting from the top left, and going to the lower right, try to set the shape onto the grid. If it contradicts one of the known misses, discard it. If it overlaps some of the known hits, rank it as more ...


1

"Each food item gives 10 food. How can I find the shortest path that will allow me to collect 30 food", so you need to collect 3 food items. This is small enough that you shouldn't need to give up optimality. Compute shortest paths and distances from the starting location to each food location, between each pair of food locations, and from each food ...


1

I'd do this with some kind of behavior tree solution - you path to the goal, and take note of all the obstacles that has been blocking your A*. If you fail, you check if there are objects that can help overcome those obstacles, in that case, path to that object. Repeat. This means that the agent needs to try to path to the goal and fail before getting the ...



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