Tag Info

Hot answers tagged

6

Complete vs. incomplete information What you are looking to do is path finding without complete information. The conceptually sound way to do this would require you to keep track of all of your non-playing character's information state (i.e., the parts of the map they already have discovered). Local information A more workable solution in your case might ...


5

If it were me I would give each NPC agency of their own - if each one has a simple goal ( get as far as possible from Zombies/get as close as possible to humans ) that they act on, you can get quite interesting behaviours from relatively simple inputs without too much processing. The downside of this is that if you have a lot of them around you are going ...


4

When you develop your game object-oriented, this might be a good application for the flyweight pattern. In this context, a flyweight would be an object which acts as a copy of the gamestate, but actually references the original gamestate it was created from while also having one or more modifications to it. To create a flyweight, you need a reference to ...


2

One good solution is to send 2 rays from the upper and lower bound of the object rather then in the middle. You can then use the algorithm you were using before but use collisions for both rays rather then one. Don't forget to set the direction to the correct value of only one ray hits something (that is away from that ray). If both rays hit an object just ...


2

You may want to try to optimize it, copying data should be relatively lightweight. Some things you can do: Allocate enough memory for the copy beforehand, instead of allocating for every single object. Each allocation call is expensive and you should be able to reduce it to a single one. This is probably the biggest bottle neck in your case. Reduce the ...


2

First of all, a warning. The problem you're trying to solve is complex enough that most professional games don't even bother unless it's a key part of the gameplay. So my advice would be to cheat as much as possible. For vehicle radius, I would try to use the worst case (the largest dimension) and then treat the vehicle as a cylinder (or a circle, in 2D) ...


2

While there have been several answers focusing on the question you asked I think you're barking up the wrong tree here. If the cost of copying is bogging you down you have a lot of game objects and thus the tree you are describing will grow very fast. I doubt you are going to get enough depth to the tree to be of much value here. Exhaustive trees are only ...


1

You should use raycasting to check for visibility. Each raycast is expensive, so stagger the visibility checks for different enemies (they don't all have to see the player on the same frame)


1

You should write a method that checks the visibility. It follows the definition: http://en.wikipedia.org/wiki/Visibility_%28geometry%29 There are a lot of techniques to do that. Therefore, I reccomend you searching on the web which approach would fit best in your problem.


1

The first decision has to come from what the gameplay requires. There are some behaviors that are going to require coordination, and will be easier and more efficient to implement in a centralized way. To look at it from a purely performance/architecture point of view, let's assume that you want individual behavior. It's unlikely that you can reuse a lot of ...


1

It would be useful to know which language you're using, as memory management changes a lot. Some general ideas: When searching, you don't have to generate the whole search space up front. If you're using something like alpha-beta prune or any heuristic so you early out branches of the tree, then you can copy the nodes only as you need them, and save a lot ...


1

Instead of replicating state in each new node you could just keep state differences between a node and its parent in the tree. By traversing the tree from the root node to a node at depth n you can calculate the new state at n.


1

A high-powered family of algorithms you may need to look into are all "clustering" algorithms. These algorithms find groups of data points which could be Cartesian points or any other property (color, weight, etc.). See K-means Clustering for one such algorithm. It's not a terrible algorithm to run in real-time, depending on how many entities you need to ...


1

The other's have suggested kd tree's but I think that a more appropriate data structure for you would be using an R-Tree which is specifically for retrieving collections of near objects. You can find out more here: http://en.wikipedia.org/wiki/R-tree


1

A kd-tree or AABB tree is a great data structure, if the objects are going to be static, or mostly static, as they are not cheap to update. But it seems like those structures would be more useful to find what's around a certain point, rather than to figure out the largest cluster of objects. For that, I'd use a simple grid. Have each object register itself ...



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