Simple equations for calculating path weight

  • Context: Undergrad 
  • Thread starter Thread starter vilu
  • Start date Start date
  • Tags Tags
    Path Weight
Click For Summary
SUMMARY

The discussion focuses on calculating the optimal path for a spaceship in 3D space, avoiding collisions with static objects. Key variables include MIN_ALTITUDE (14.5), MAX_ALTITUDE (60.0), OBJECT_DENSITY (0.0 to 1.0), GROUND_POS_Y, WORLD_COORDINATES, and ENTITY_COORDINATES. The method getPathWeightFor(xCoord, yCoord, zCoord) is designed to return higher values for coordinates with low OBJECT_DENSITY and within altitude limits. The pathfinding algorithm utilizes ray tracing to evaluate multiple coordinates and selects the one with the highest path weight.

PREREQUISITES
  • Understanding of 3D coordinate systems and spatial navigation
  • Familiarity with pathfinding algorithms and ray tracing techniques
  • Knowledge of mathematical concepts related to limits and weights
  • Experience with programming concepts for AI decision-making
NEXT STEPS
  • Research mathematical equations for calculating weights based on limits
  • Explore advanced pathfinding algorithms in 3D environments
  • Learn about collision detection techniques in game development
  • Investigate AI methods for optimizing navigation in dynamic environments
USEFUL FOR

Game developers, AI programmers, and mod developers focused on creating efficient navigation systems for entities in 3D environments.

vilu
Messages
2
Reaction score
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. basically 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:
Physics news on Phys.org
Does the path have to conform to any physical requirements? Like proper orbit mechanics? Or is it just a simple path finding exercise?
 
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:

Similar threads

  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 39 ·
2
Replies
39
Views
5K
  • · Replies 10 ·
Replies
10
Views
4K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 51 ·
2
Replies
51
Views
5K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 0 ·
Replies
0
Views
3K