does anyone know a smart (and efficient) alogrithm to find the closest point without creep? maybe doesnt have to be closest but one of the closest points.
Have you tried the structure placement search functions? If the specified building cannot be placed on creep (eg terran or protoss buildings) then it should return you a reasonably close point (or null if no such point exists in a reasonable range). These are the functions used internally by the AI to find a building placement location for a base. Obviously these are quite expensive functions to call so you might not want to use them sparingly and avoid calling them a lot within a single frame.
You can check if there is creep on a certain part of the map as Imperial said.
From there you can expand your search outwards testing parts of the map.
If you are concerned with it taking too long you might be able to first search for any creep producing units such as creep tumours and automatically excluding those locations within a certain radius of one of the units. That might help speed it up.
You can check if there is creep on a certain part of the map as Imperial said.
I was emphasizing the AI natives to find building locations from a point and not that you can test a point for creep.
Quote:
From there you can expand your search outwards testing parts of the map.
That would work however would be very slow, especially for a reasonably sized area. In this situation it might be faster to look where is not near a creep source.
i couldn't find this AI- native. problem is i have custom creep sources. i can feed (upgrade) tumors to produce more creep in a greater area. lvl 3-5 are trigger based because the creep behaviour stopps at a certain size of the footprint.
currently i am checking 16 lines emerging from the mid (22,5°) with alternating starting degrees (+3° for each iteration). it produces quite good results (at the end there are some tumors in the same area but thats ok).
building at a certain point is really tricky, you have to round the points to 0.5 values (i.e. 1.5, 1,5) and check if the points around this point are pathable too (check in total 9 points) for 1x1. no rounding for 2x2 but 25 points to check.
It is a function in the Unit GUI category and returns a "Point" type.
Quote:
point = (Find Placement From No Point Point For Unit Type (Unit type of (Triggering unit)) And Player 1 With Range 0.0 And Tests Creep, Power, Fog, Ignore Blockers, Ignore Invisible, Zone, Cliff, Density) <Point>
There are 4 variants available. One centred on a point and one centred on a unit with both having alternative versions with extra test flags. The above shows the point centred one with flags. As you can see there are a vast number of fields to choose from including the central search area, the type of unit to place, the player who will do the placing (important for vision), the range at which placement will go and a huge number of flags to avoid potentially bad placement points.
How well it works I do not know, but hopefully it should be better and faster than any custom implementation.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
hi there,
does anyone know a smart (and efficient) alogrithm to find the closest point without creep? maybe doesnt have to be closest but one of the closest points.
Have you tried the structure placement search functions? If the specified building cannot be placed on creep (eg terran or protoss buildings) then it should return you a reasonably close point (or null if no such point exists in a reasonable range). These are the functions used internally by the AI to find a building placement location for a base. Obviously these are quite expensive functions to call so you might not want to use them sparingly and avoid calling them a lot within a single frame.
not yet but will try now
You can check if there is creep on a certain part of the map as Imperial said.
From there you can expand your search outwards testing parts of the map.
If you are concerned with it taking too long you might be able to first search for any creep producing units such as creep tumours and automatically excluding those locations within a certain radius of one of the units. That might help speed it up.
I was emphasizing the AI natives to find building locations from a point and not that you can test a point for creep.
That would work however would be very slow, especially for a reasonably sized area. In this situation it might be faster to look where is not near a creep source.
i couldn't find this AI- native. problem is i have custom creep sources. i can feed (upgrade) tumors to produce more creep in a greater area. lvl 3-5 are trigger based because the creep behaviour stopps at a certain size of the footprint.
currently i am checking 16 lines emerging from the mid (22,5°) with alternating starting degrees (+3° for each iteration). it produces quite good results (at the end there are some tumors in the same area but thats ok).
building at a certain point is really tricky, you have to round the points to 0.5 values (i.e. 1.5, 1,5) and check if the points around this point are pathable too (check in total 9 points) for 1x1. no rounding for 2x2 but 25 points to check.
It is a function in the Unit GUI category and returns a "Point" type.
There are 4 variants available. One centred on a point and one centred on a unit with both having alternative versions with extra test flags. The above shows the point centred one with flags. As you can see there are a vast number of fields to choose from including the central search area, the type of unit to place, the player who will do the placing (important for vision), the range at which placement will go and a huge number of flags to avoid potentially bad placement points.
How well it works I do not know, but hopefully it should be better and faster than any custom implementation.