• 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.

How can i detect the min and max non fogged coordinates?

Status
Not open for further replies.
Level 17
Joined
Nov 13, 2006
Messages
1,814
how can i do that without damn huge useless rows, with something logic ?

check the picture, i illustrated the buildings with x and white area is the sight range (in my case its same night and day time but different in few building case).

i want create units only in white area and every unit if possible must have same distance from the another unit (so like a grid/table) exclude if there have something obstacle (tree/building/rock/cliff/water etc)
 

Attachments

  • untitled.JPG
    untitled.JPG
    29.6 KB · Views: 140
Level 20
Joined
Jul 14, 2011
Messages
3,213
Get Region MinX and MinY and región MaxX and MaxY. That will give you the square.

Divide MaxX-MinX and MaxY-MinY between the total amount of squares you want (grid). That will give you the distance between the units you'll create. I'll call it DBU (Distance Between Units)

Now For each Integer A from 1 to (The number of Units you want in the grid) and create units from Region MinX and MinY to region MinX to MaxY, checking if player has visibility of this point. This will create the left column. Basically you take X (= MinX) and Y (= MinY) and then increase Y by DBU offset towards 0 degrees (I think 0 degrees is from top to bot)

Now increase X by the distance should be between units (we got that above) and repeat the process until X is greater than MaxX.
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
i know how to use region minx,miny but the problem the visible area could be any form, so not just around 1-2 unit, something good idea needed for how to calculate it easier without looping on every unit and check/compare their coordinate with each other.

notice: i want make something like undead blight thing, so few building give blighted area but here instead blight i want visiblity (=no fogged area), anout grind and units with same distance, they just dummy units, maybe u know the old settlers 2

settlers-2-screenshot.jpg


here the yellow house and flags appear if u press the spacebar and show where u can build a house, i want do exactly same, in visible area i want create alot dummy building unit (why dummy unit? because i can make it semitransparent) then player can select with ability (unit target channel based ability) a dummy semi transparent house and build there, in my case the tower increase the buildable (visible area)
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
But you can check if the player has visibility of an specific point. Create a region in the place you want, or do the math with Polar Projection
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
But you can check if the player has visibility of an specific point. Create a region in the place you want, or do the math with Polar Projection

pls understand it, the problem not in checking if point visible or not, the problem if i create everywhere a region where have a building then have alot region and i must compare every region.

something like if ur undead townhall have blight area but towers also give blight are and u can build alot tower then u need check the region around every tower for cover the whole blight area and make grid from unit there
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
I would rather use a pre-made grid and place all the dummy buildings in all the map as invisible buildings; and give those "Towers" the ability to reveal invisible units to reveal the Dummy Buildings.

Would that work in some way?
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
JNPG overrides those limits and why would you want to create more than 1000 preplaced units in the map? That's too much
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Offst between buildings should be of about 400 or 500 AoE. Unless you're map is 480x480 you shouldn't need that much buildings, anyway, you can try.
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
because i want make similiar like the screenshot in 3rd post or similiar like in settlers 3

//another problem later the border of player area, example another player turret closer to ur turret, both got a place where visible to both player but i dont want the players build to each other area, example player 1 in his place and player 2 in his place


(here different because show only 1 type of building in every buildable place - i talk about that black fortress building what there just a dummy thing, if u click on it then there will be the constructed)

45925_full.jpg
 
Status
Not open for further replies.
Top