• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Get a random point in rect that is "reachable"

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,338
Hi,

Suppose I have some rect and inside it are various obstructions: trees, doodads, tiny unreachable crevices or shallow water (some of which are walkable). Thus some portion of the square rect is "unreachable."

The "reachable" area is the complement of the unreachable area and I would like to generate a random point which is inside this reachable area.

In this thread I was shown how to avoid choosing a point near a tree/destructable for some range X: http://www.hiveworkshop.com/forums/...8/pick-point-no-destructables-range-x-252803/

But that does not cover the general case of any "obstructables."

So how would I generalize this to the general case?

In this example, suppose I have correctly implemented this inviolable constraint when generating a random point.

i. NO-TREE: There can be no trees with range X of the random point.

Now I will add another, inviolable constraint that always must be satisfied.

ii. NO-DOODAD: There can be no doodads with range X of the random point.

As far as I can tell, while for trees we have EnumDestructablesInCircleBJ, there is no equivalent for doodads.

So how would this be done? Or would it be more prudent to simply make all doodads into destructables?
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
afaik Nestharus's pathfinding didnt really work because it most likely crashed the thread before finding the path.

This is essentially impossible, because of the reachability thing. You could fake one using PnF's Movespeed above 522 and set it to around 900 on dummy unit and order it to go there, and after a while check if the dummy is there, if it isnt, it either didnt have enough time or the point is unreachable, that really depends on the complexity of paths on your map
 
Status
Not open for further replies.
Top