• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Get a random point in rect that is "reachable"

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,337
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