Tag Info

New answers tagged

0

If you've been looking at steering behaviours you've probably seen this page which is by the guy who first came up with steering behaviours. If you want to know about the general background of how steering behaviours work that's the best place to start. The steering behaviours were implemented by the same chap in a library called OpenSteer which was ported ...


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 ...


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 ...


0

There isn't necessarily a reason to have all these action classes you are defining but instead have a component that represents specific state about a certain use case. So your movement component has a series of booleans that indicate forward, backward, left, right, etc. Now each game tick, you have system that inspects all movement components and sees ...


0

Okay, through some trial and error, I've come up with a system that works. The ai chooses a target node, then uses this method: public Point Next() { Point r = new Point(0,0); float weight = float.MaxValue; Point o = new Point(loc.X + 1, loc.Y); float heuristic = Heuristic(targetNode.Position, o); float distance = ...


0

Often times your ai is the result of several components working together, not just one master ai piece of code. The solution you are after can be achieved in this manner. As already mentioned you can give your creatures states so that they know what their current task is, roaming, rushing, standing ground, retreating, etc. Next you can add pathfinding. This ...


0

You should be able to accomplish this with "creature" states. Roaming Attacking Retreating Defending On each "turn" you evaluate what the state of each creature should be and handle their movement accordingly. For example, if the current state is "Roaming" and the engine evaluates that an enemy is now in front, the state is changed to "Attacking" and a ...


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

"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 ...


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 ...


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 ...


0

The approach I have taken in the past was to separate the behavior and the AI aspects into two systems much as you described. On the behavior side, you have a series of predefined aspects that can be chained together into a behavior tree like patrol, attack, threat detection, etc. The behavior tree describes how these behaviors interact, which has ...



Top 50 recent answers are included