Simple equations for calculating path weight

In summary, the conversation discusses the need for help in calculating the best path for an entity to take in a 3D space while avoiding collisions with other static objects. The variables needed for this calculation are the minimum and maximum altitudes, object density, ground position, and world and entity coordinates. The goal is to create a formula that returns a higher weight for coordinates that have a low object density, are within the altitude limits, and are closer to the ground. The path does not have to adhere to any physical requirements and there are already methods in place to handle other calculations.
  • #1
vilu
2
0
I'm a mod developer and I would need some help to calculate best path/route to take for an entity. To keep this post more math related than game programming related I'll try to explain this process easily. Basicly the entity (spaceship) tries to fly in 3d-space from point A to point B and it should avoid for collision with any other static objects.

What I'm trying to do is to calculate the best possible path depending these variables:

Variable: Value and definition

MIN_ALTITUDE: Usually 14.5, distance to ground
MAX_ALTITUDE: Usually 60.0, max distance between ground and entity
OBJECT_DENSITY: Value between 0.000000 and 1.0, percentage of objects in specific coordinates and direction from entity, 0 = clear, no anything to collide with 1 = lots of objects or the ground for example (collision happens for sure)
GROUND_POS_Y: Y coordinate which is on the ground and will be below the ground if smaller than this
WORLD_COORDINATES: X Y and Z position of the objects in game world
ENTITY_COORDINATES: X Y and Z position of this entity in game world

When I call method getPathWeightFor(xCoord, yCoord, zCoord) it should return bigger number for better coordinates which are better if OBJECT_DENSITY low (more lower, better), yCoord < GROUND_POS_Y + MAX_ALTITUDE, yCoord > GROUND_POS_Y + MIN_ALTITUDE
And this is the path weight. It could be something between -10.0 and 10.0, if OBJECT_DENSITY equals 1.0 then negative or if yCoord > GROUND_POS_Y + MAX_ALTITUDE then also negative so the AI considers it as bad choice. AI runs getPathWeightFor() method for multiple coordinates at ones and then chooses coordinates that got highest value from that method.

To clarify somethings: Variables I introduced are calculated by separate methods so there is no need to think about how those things could be calculated, and so is the actual path finding too. Actual path finder does ray trace from entity to semi-random coordinates and then collects calculated path weights for different waypoints. After path finder has coordinates and weights for them in its collection, it sorts collection list and returns coordinates which got highest path weight value.

So, what kind of equation I should use to get best coordinates so that entity would usually keep at least MIN_ALTITUDE and only rises towards MAX_ALTITUDE if there is no better path? Sorry if this post is hard to follow, but its hard to explain complicate things :D

Edit: After doing some research I think the formula I'm looking for has something to do with limits, because when testing given coordinates (in this case y-coordinate) formula should return higher number when y <= groundPosY + maxAltitude and y >= groundPosY + minAltitude. After getting that result I could multiply result with objectDensity and that would give me the weight. I know that there is some formula to get value of how far from two limits give y-coordinate is, just can't figure it out...
 
Last edited:
Mathematics news on Phys.org
  • #2
Does the path have to conform to any physical requirements? Like proper orbit mechanics? Or is it just a simple path finding exercise?
 
  • #3
cpscdave said:
Does the path have to conform to any physical requirements? Like proper orbit mechanics? Or is it just a simple path finding exercise?

No it doesn't have to conform any physical requirements. I already have methods to take care of everything else. I just need to get simple weight for different coordinates based on min altitude, max altitude, world ground level, distance to ground from the entity and percentage (float between 0-1.0) of collidable objects along the position vector at those coordinates.

I already have methods to calculate percentage of those collidable objects, determinate the current ground level from the entity's position and changing variables to control min altitude and max altitude based on current task of the entity
 
Last edited:

1. How do you calculate the path weight for a simple equation?

To calculate the path weight for a simple equation, you first need to identify the variables and their corresponding values. Then, you can plug the values into the equation and solve for the answer. The resulting number is the path weight for that equation.

2. What is the purpose of calculating path weight in a simple equation?

The purpose of calculating path weight in a simple equation is to determine the value of the equation, which can be used for further analysis or to make predictions. It can also help show the relationship between the variables and how they affect the overall outcome of the equation.

3. Can you use the same method to calculate path weight for all simple equations?

Yes, the method for calculating path weight can be used for all simple equations as long as you have the necessary variables and values. However, some equations may require additional steps or a different approach to solve for the path weight.

4. How does changing the values of variables affect the path weight in a simple equation?

In a simple equation, changing the values of variables can significantly impact the path weight. If the variables are directly proportional, increasing the values will result in a higher path weight, and decreasing the values will result in a lower path weight. If the variables are inversely proportional, the opposite will occur.

5. Are there any limitations to using simple equations for calculating path weight?

While simple equations can be useful for calculating path weight, they may not be suitable for more complex systems. In these cases, more advanced mathematical models or simulations may be necessary to accurately determine the path weight. Additionally, simple equations may not be able to account for all factors that can influence the outcome of a system or phenomenon.

Similar threads

Replies
9
Views
2K
Replies
5
Views
4K
Replies
2
Views
933
  • Differential Equations
Replies
10
Views
3K
  • Special and General Relativity
2
Replies
51
Views
2K
Replies
0
Views
7K
  • Special and General Relativity
Replies
8
Views
989
  • Advanced Physics Homework Help
Replies
2
Views
1K
  • Linear and Abstract Algebra
Replies
2
Views
2K
Replies
1
Views
1K
Back
Top