Staredit Network > Forums > SC2 Assistance > Topic: Detecting Terrain/Texture at Point
Detecting Terrain/Texture at Point
Sep 2 2010, 12:04 am
By: Roy  

Sep 2 2010, 12:04 am Roy Post #1

An artist's depiction of an Extended Unit Death

I looked through the trigger editor and couldn't find a way to detect the texture at a specific location (i.e. position of unit).

What I need is to find a way to check when a unit steps onto a specific texture (like dirt). Is this possible without doing a monotonous and painstaking workaround?




Sep 3 2010, 5:36 am Centreri Post #2

Relatively ancient and inactive

If there isn't a straightforward method, it might be difficult. Consider that textures can overlap in various opacities, which opens up... problems with it.



None.

Sep 3 2010, 4:34 pm Roy Post #3

An artist's depiction of an Extended Unit Death

Quote from Centreri
If there isn't a straightforward method, it might be difficult. Consider that textures can overlap in various opacities, which opens up... problems with it.
I'm using max opacity for each texture, so there won't necessarily be an overlap in the map.




Sep 3 2010, 7:06 pm Temp Post #4



He is pointing out that since there could be an overlap having a detection method built in would be pointless since it would not mean anything. Depending on your map this may not be a feasible but you could use something else to differentiate between textures (units, height, regions, points).



None.

Sep 3 2010, 7:47 pm Ahli Post #5

I do stuff and thingies... Try widening and reducing the number of small nooks and crannies to correct the problem.

Regions would be the best option. You can even modify the shape of the region to easily cover larger areas with only 1 region.




Sep 3 2010, 9:35 pm Roy Post #6

An artist's depiction of an Extended Unit Death

Quote from Temp
He is pointing out that since there could be an overlap having a detection method built in would be pointless since it would not mean anything.
Then how exactly does the "fill texture" feature work when editing terrain? The editor uses a detection for textures that in theory should transfer over to in-game detection.
Quote from Ahli
Regions would be the best option. You can even modify the shape of the region to easily cover larger areas with only 1 region.
That's the option I was trying to avoid. The shape of the terrain is... not very close to uniform.
Quote from Temp
Depending on your map this may not be a feasible but you could use something else to differentiate between textures (units, height, regions, points).
I need a subtle way to differentiate between textures. Units/points are out of the question, height would probably not be subtle enough and would be difficult to setup, and regions are not preferable due to the long time it would take to setup.

Is it safe to assume that there is no action to directly detect terrain/textures, and I should start making an alternative method of detection? In other words, this topic has no solution?




Sep 4 2010, 5:02 am shmeeps Post #7



It could technically possible if you could find a way to duplicated ground pathing, you might be able to rig up something with validators. But as said before, there is still the chance that two textures could be layered on top of each other or blended together, resulting in two different effects. It may be easier to resort to regions.

Also, the way the textures are rendered in the editor and the way they are rendered in game are two completely different things. While the map data may remain the same, certain efficiency and performance based operatinos are performed on them for in game performance reasons. This is why the editor is a lot laggier than running the map in game, and why the map takes many numbers of time over to load in game as opposed to the editor, as nothing is optimized for gameplay and must be generated then. At the very best, the ground would be rendered with a layering system or some form of alpha splash, which would take probably a ray trace or a pseudo-clamp detection method to find out which textures you were looking for, assuming the validators didn't work. It could even be possible that the entire ground texture is rendered as a mega-texture, which would make this feat impossible.



None.

Sep 4 2010, 7:41 pm Roy Post #8

An artist's depiction of an Extended Unit Death

Alright, let me revise my question a bit:

What would be the easiest way to detect when a unit steps onto the white sand texture shown below?



Region shaping would be a pain with how it's done in the editor.




Sep 5 2010, 1:57 am Ahli Post #9

I do stuff and thingies... Try widening and reducing the number of small nooks and crannies to correct the problem.

raise the white area by 1 and detect the unit's height change... :S




Sep 5 2010, 2:06 am Roy Post #10

An artist's depiction of an Extended Unit Death

Quote from Ahli
raise the white area by 1 and detect the unit's height change... :S
I tried that, but the calculations of a unit's height are inconsistent and buggy. A moving unit won't notice a subtle height change, and being somewhat near an elevated height (despite plateauing/uniforming) will eventually trigger the height change.

It looks like the easiest option, though not very easy, and rather time consuming, would be to create a region shape on the blue area, and detect when a unit leaves.

Since there doesn't seem to be the option of detecting textures via trigger, and no suitable substitute for it, this topic can be closed.




Sep 5 2010, 5:18 am payne Post #11

:payne:

Have you tried to use the Custom Script?



None.

Sep 5 2010, 2:51 pm Roy Post #12

An artist's depiction of an Extended Unit Death

Quote from payne
Have you tried to use the Custom Script?
No idea how to work with that; I guess I'll do a little research. I'm not sure how to refer to the terrain through Custom Script, but it's worth a shot.

Edit: It doesn't sound like Custom Script can go beyond the scope of the trigger editor. It's just used as a convenience, much like a function. I could be wrong, but that's what I found while browsing.

Post has been edited 2 time(s), last time on Sep 5 2010, 3:10 pm by Roy.




Oct 2 2010, 7:15 am payne Post #13

:payne:

Necro! :awesome:

I've had kind of a flash...
What about using creep?
You probably can change the aspect of creep with some modding tools so it looks like an other texture of your choice.
From there, you could detect the change of terrain texture by detecting the change of units' speed.

This is just the basic idea, and I'm not sure it is feasible, but it looks pretty good. The only problem is that you'd only be able to detect 2 different textures... but that's a start!

To increase the number of textures, you could also use raised terrain along with some height-detection triggers.
You could also use cliffs... I believe there are Validators that allows you to detect the cliffs' level. If you need flat terrain, you simply lower the cliff and modify the Pathing so its walls are walkable.

Did this help? :O



None.

Oct 2 2010, 6:16 pm Roy Post #14

An artist's depiction of an Extended Unit Death

Quote from payne
Necro! :awesome:

I've had kind of a flash...
What about using creep?
You probably can change the aspect of creep with some modding tools so it looks like an other texture of your choice.
From there, you could detect the change of terrain texture by detecting the change of units' speed.

This is just the basic idea, and I'm not sure it is feasible, but it looks pretty good. The only problem is that you'd only be able to detect 2 different textures... but that's a start!
Nope, tried creep. It doesn't shape like I would want it to. I've tried having creep spread on the white terrain and made the other terrain creep immune, but the shape is just blocky, and it can't handle the smaller details.

Quote from payne
To increase the number of textures, you could also use raised terrain along with some height-detection triggers.
You could also use cliffs... I believe there are Validators that allows you to detect the cliffs' level. If you need flat terrain, you simply lower the cliff and modify the Pathing so its walls are walkable.

Did this help? :O
This might actually work. I haven't tried it, and shaping may be a bit tricky, but this sounds like a very feasible idea. I just needed some way to differentiate between two types of terrain, and by using cliff levels, that can be easily managed. I want it to be flat, so hopefully I can make it appear seamless in-game that they are different cliff heights.

Thank you very much, payne. I will jump right on this when I feel like mapping again. I had been using region shaping and it was just a pain.




Oct 4 2010, 2:06 pm Alzarath Post #15

Praetor

Or you could just do it like they did in WarCraft 3 and make individual regions. :awesome:

Of course, making them all regions would be vastly easier than in WarCraft 3, so maybe it'd be a bit more viable.



None.

Oct 4 2010, 5:04 pm Roy Post #16

An artist's depiction of an Extended Unit Death

Quote from name:Artanis186
Or you could just do it like they did in WarCraft 3 and make individual regions. :awesome:

Of course, making them all regions would be vastly easier than in WarCraft 3, so maybe it'd be a bit more viable.
Actually, Warcraft III could detect terrain via triggers. I don't have the game on this computer, so I can't cite the exact trigger condition, but it exists and is easy-as-pie to do. That's why I thought StarCraft II would have some sort of support for it as well.




Oct 9 2010, 2:40 am payne Post #17

:payne:

Quote from Q.">http://us.battle.net/sc2/en/forum/topic/627976600?page=1#8]Q. (Roy) - How can I detect the texture/terrain of a specified point?
A. We'll look into adding this in a future patch.
Good job getting Blizzard to answer your question! :)

EDIT: NO U!

Post has been edited 1 time(s), last time on Oct 9 2010, 5:01 am by payne.



None.

Oct 19 2010, 11:40 pm NicholasBeige Post #18



I found a neat little (albeit: time-consuming)work-around to make complex regional shapes and combine them into one singular region...

Find a pen and paper. Create the general shape of region you would like, by using multiple regions. Try be as accurate as you want (requires lots of regions, particularly small ones...).

Once you have done this: Open up the region properties for one region, grab that pen and paper, and write down
  • (Center X, Center Y)
  • (Size)
  • Positive / Negative
for each region you have created... I did say it was time consuming. As you write these details down, delete the region. When you have 1 region left, open up it's properties and 'add shape' for each region that you deleted, using the information you listed on your paper. The end result is one massive region, with a shape as unique as you can draw...

I'm afraid that's the best I can do for you... until Blizzard decides to give us (fundamental and straightforward) region creation tools in a future patch... :rolleyes:



None.

Nov 4 2010, 1:11 pm NicholasBeige Post #19



Bump... You can create 1 nice big region covering as complex a space as you would like by drawing hundreds of little regions... and then using this trigger:

Event: Map Initialisation

Actions:
Region - Add Region002 to Region 001
Region - Add Region003 to Region 001
Region - Add Region004 to Region 001
Region - Add Region... to Region 001
Region - Add Region... to Region 001
Region - Add Region... to Region 001
Region - Add Region043 to Region 001

Then, you just check if a unit enters region 001 and kill it if it does :)



None.

Nov 4 2010, 1:25 pm payne Post #20

:payne:

OR you read this wiki and understand that you don't need to bother with laggy triggers since the Editor gives you an easy command: http://www.staredit.net/starcraft2/Region#Custom_Shapes



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[03:27 am]
m.0.n.3.y -- Maybe because it's an EUD map?
[03:27 am]
m.0.n.3.y -- Can't upload maps to the DB. Error says "The action you have performed caused an Error". Any word?
[07:46 am]
RIVE -- :wob:
[2024-4-22. : 6:48 pm]
Ultraviolet -- :wob:
[2024-4-21. : 1:32 pm]
Oh_Man -- I will
[2024-4-20. : 11:29 pm]
Zoan -- Oh_Man
Oh_Man shouted: yeah i'm tryin to go through all the greatest hits and get the runs up on youtube so my senile ass can appreciate them more readily
You should do my Delirus map too; it's a little cocky to say but I still think it's actually just a good game lol
[2024-4-20. : 8:20 pm]
Ultraviolet -- Goons were functioning like stalkers, I think a valk was made into a banshee, all sorts of cool shit
[2024-4-20. : 8:20 pm]
Ultraviolet -- Oh wait, no I saw something else. It was more melee style, and guys were doing warpgate shit and morphing lings into banelings (Infested terran graphics)
[2024-4-20. : 8:18 pm]
Ultraviolet -- Oh_Man
Oh_Man shouted: lol SC2 in SC1: https://youtu.be/pChWu_eRQZI
oh ya I saw that when Armo posted it on Discord, pretty crazy
[2024-4-20. : 8:09 pm]
Vrael -- thats less than half of what I thought I'd need, better figure out how to open SCMDraft on windows 11
Please log in to shout.


Members Online: jun3hong