Staredit Network > Forums > SC1 UMS Theory and Ideas > Topic: Odd sized units and inverted locations
Odd sized units and inverted locations
Jun 26 2009, 11:34 pm
By: scwizard  

Jun 26 2009, 11:34 pm scwizard Post #1



The information in this topic is not accurate. More accurate topic coming soon.

The terran siege tanks, like many units, has an odd size. According to DatEdit:
"Left: 16"
"Right: 15"

Contrast this with the terran ghost, which is:
"Left: 7"
"Right: 7"

This means that the siege tank is 31 pixels wide. However if you create a 31 pixel wide location that's inverted along the x axis, then say:
Code
Trigger("Player 1"){
Conditions:
    Always();

Actions:
    Move Location("Current Player", "Men", "Anywhere", "30 pixel inverted");
}

//-----------------------------------------------------------------//

Trigger("Player 1"){
Conditions:
    Bring("Current Player", "Men", "30 pixel inverted", At least, 1);

Actions:
    Display Text Message(Always Display, "Unit exists.");
    Preserve Trigger();
}

The "Unit exists" message will not display.

It's tempting to think from that that the siege tank can not fit inside the location for some reason. However that is not the case.

If you were to divide the siege tank in half, the extra pixel of its width would be on the left of the halfway point. Here's a little picture, the line is the half way point, the periods are pixels:
Code
................|...............


When you center the inverted location on the siege tank, the extra pixel of the locations falls to the right of the halfway point.
Code
...............|................


If you center the location on the siege tank, you have something that looks like this:
Code
................|...............
 ...............|................


As you can see, the there's parts of the location outside of the siege tank, therefore the tank is not at that location.

However if you create a 0x0 pixel location 1 pixel to the left of the siege tank, and then you center the 31 pixel x inverted location around that location, then the condition "brings at least 1 tank to 31 pixel x inverted" would trip.

Here's the map that I used to figure this out. There's probably some people out there who've known this for a while. I really wish that they had shared it with the rest of us.

Attachments:
invertedlocs.scx
Hits: 5 Size: 35.35kb

Post has been edited 1 time(s), last time on Jul 8 2009, 10:45 pm by scwizard.



None.

Jun 27 2009, 12:00 am ClansAreForGays Post #2



This was very well written. I'd actually like to see this in the zine over the other thing you submitted because this is very well spaced and illustrated. you also repeated yourself where you needed to which is a rarity in online posting. I'm not even interested in ever using inverted locations and this still kept my attention.




Jun 27 2009, 12:04 am scwizard Post #3



As for the zine, I don't choose what goes in, I just write stuff. Sure you can use this if you want.

For stuff like this where it's information that isn't available yet, it's important for it to get a topic here and not be confined to the zine though.



None.

Jun 27 2009, 1:36 am rockz Post #4

ᴄʜᴇᴇsᴇ ɪᴛ!

Tanks are 32x32.

The center of the tank is in red, with 16 pixels on top and left, 15 pixels on bottom and right. The non inverted location is 31 horizontally, and the horizontal center is 15 left, and 15 right (15+15+1=31). This is what you have in your map. When this is inverted, the center stays in the same place due to the symmetry of it.

First, we assume that L and R are the theoretical lines generated by editing the property box in SCMDraft. We have a location which has the left margin at 0, and the right margin at 31. That means this is a normal location, with insignificant height. The boxes (or "C" which is the center) represent the pixels. The space inbetween them represents an infinitely small line drawn by SCMDraft or Starcraft.

The tank is in this location if:
L <= X pos <=R+1

L=0
R=31
Code
Tank's horizontal pixels
 0 1 2                           16                            31
 □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ C □ □ □ □ □ □ □ □ □ □ □ □ □ □ □
Location's range
L□ □ □ □ □ □ □ □ □ □ □ □ □ □ □ C □ □ □ □ □ □ □ □ □ □ □ □ □ □ □R□
The tank is in this location if:
X pos >=0 (true)
X pos <=32 (true)

Now, let's take the same tank and invert the location.
L=31
R=0
Code
Tank's horizontal pixels
 0 1 2                           16                            31
 □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ C □ □ □ □ □ □ □ □ □ □ □ □ □ □ □
Location's range
R□ □ □ □ □ □ □ □ □ □ □ □ □ □ □ C □ □ □ □ □ □ □ □ □ □ □ □ □ □ □L□
X pos >=31 (true)
X pos <=1 (true)

If we then center the location, you'll notice it will be moved to the right one, and will now push the left end outside of the tank.
X pos >=32 (false)
X pos <=2 (true)

Post has been edited 3 time(s), last time on Jun 27 2009, 9:52 am by rockz. Reason: wrong info



"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

Jun 27 2009, 2:42 am Kaias Post #5



This is particularly annoying and evident with units like the Dragoon and Dark Templar. I guess details like these I never thought would be something people cared about.

Come to think of it, there are a lot of little mechanics like these that I could write about for something like the SEN Magazine.



None.

Jun 27 2009, 7:12 am scwizard Post #6



rockz is confusing me.

wtf are you talking about. Tanks are not 32x32 according to dat edit. Also they're not 32x32 because they don't trigger a 32 wide inverted x location.

Also:
Quote
□R□ □ □ □ □ □ □ □ □ □ □ □ □ □ C □ □ □ □ □ □ □ □ □ □ □ □ □ □ □L
Why do you put the right boundary for the inverted location there, instead of to the left of the leftmost pixel...



None.

Jun 27 2009, 9:46 am rockz Post #7

ᴄʜᴇᴇsᴇ ɪᴛ!


It says that? My datedit says it's 32x32. The pixels show it's 32x32 too.

And indeed, I was mistaken. SCMDraft draws locations different than SC interprets them. Everything is based on the pixel number. What one may consider to be a 0x0 location is actually 1 pixel. A 1x1 is 4 pixels total. The top left is correct, but the bottom and right are also included. To get a 32x32 square location, you can't just snap to grid, you have to make 0,0 and 31,31 be the corners. I edited my previous post, and I think this should be more correct. Based on my description of locations, a 32x32 inverted location WILL trigger a tank.

I could be wrong about the center of locations, especially since the right and bottom also detect the pixel they occupy.



"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

Jun 27 2009, 4:16 pm Morphling Post #8



The description says you only use that if it's a building. Go one tab to the left. That shows it's it's real dimensions.



None.

Jun 27 2009, 6:21 pm rockz Post #9

ᴄʜᴇᴇsᴇ ɪᴛ!

Why are all the placement boxes one larger than the previous tab when used on a unit?
Quote
Width of the green placement rectangle in StarEdit, in pixels. Used instead of "Unit Dimensions" in StarEdit, but only if the unit is a "Building".
Nowhere in here does it say you can't use this for units. It just says that if it's a building, the placement box uses this value instead of the previous tab.

Now, make a 64x64 map, and line the top with tanks. If it were 31 pixels wide, you'd be able to fit 64*32/31=66 tanks across the top with some room for them to wiggle around. Instead you only have 64, and none of them can move.



"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

Jun 29 2009, 4:34 am scwizard Post #10



Nonono rockz, the actual number is is under units->graphics, the staredit value is meaningless for starcraft.

Quote from rockz
Based on my description of locations, a 32x32 inverted location WILL trigger a tank.
The problem with this is that it's false. Test it and see.



None.

Jun 29 2009, 5:26 am Pyro682 Post #11



---Edited Out---

Post has been edited 1 time(s), last time on Jul 4 2009, 3:03 am by Pyro682. Reason: Fixed.



None.

Jul 3 2009, 7:07 pm rockz Post #12

ᴄʜᴇᴇsᴇ ɪᴛ!

Quote from scwizard
Nonono rockz, the actual number is is under units->graphics, the staredit value is meaningless for starcraft.

Quote from rockz
Based on my description of locations, a 32x32 inverted location WILL trigger a tank.
The problem with this is that it's false. Test it and see.
I give you incontrovertible proof, and yet you still don't believe it.

this is a 32x32 pixel location. It will detect anything from 0-31. SCMDraft draws it to look like it goes from 0-30. The actual location goes from 0-31.

The actual number IS under units->graphics, the staredit value is NOT meaningless for starcraft. Tanks are 1024 pixels. 16+1+15=32. You seem to be convinced that units don't have a center pixel.

I DID test it, and I DID see that it works. See attached map.



"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

Jul 8 2009, 8:22 pm scwizard Post #13



Quote from rockz
Quote from scwizard
Nonono rockz, the actual number is is under units->graphics, the staredit value is meaningless for starcraft.

Quote from rockz
Based on my description of locations, a 32x32 inverted location WILL trigger a tank.
The problem with this is that it's false. Test it and see.
I give you incontrovertible proof, and yet you still don't believe it.

this is a 32x32 pixel location. It will detect anything from 0-31. SCMDraft draws it to look like it goes from 0-30. The actual location goes from 0-31.
You're right. I can't believe I failed at math like that.

Where does that +1 come from though?

EDIT: Oh, it's the center pixel of course. Which is why you can't stack units in xtra edit.

Post has been edited 1 time(s), last time on Jul 8 2009, 10:43 pm by scwizard.



None.

Jul 9 2009, 12:52 am poison_us Post #14

Back* from the grave

So we go into Datedit and subtract 1 from right and bottom coordinate to get the scmdraft size?

That's weird--I always just put 400% zoom on and made it by hand with the collision size...




Jul 9 2009, 2:38 am rockz Post #15

ᴄʜᴇᴇsᴇ ɪᴛ!


This is what a 32x32 location should look like on top of a tank with its collision box on. You'll notice that while you drag the location it gets slightly bigger to the bottom and right: That's the real location size. As a sidenote, staredit places them poorly too, exactly how SCMDraft places them. Starforge probably does too.

Another way to verify this is to place two tanks right next to each other, with one location centered on one of the tanks, then detect when there are exactly 2 tanks in the location. Even though there should only ever be 1 tank, it still detects that second tank.



"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[01:53 am]
Ultraviolet -- :lol:
[06:51 pm]
Vrael -- It is, and I could definitely use a company with a commitment to flexibility, quality, and customer satisfaction to provide effective solutions to dampness and humidity in my urban environment.
[06:50 pm]
NudeRaider -- Vrael
Vrael shouted: Idk, I was looking more for a dehumidifer company which maybe stands out as a beacon of relief amidst damp and unpredictable climates of bustling metropolises. Not sure Amazon qualifies
sounds like moisture control is often a pressing concern in your city
[06:50 pm]
Vrael -- Maybe here on the StarEdit Network I could look through the Forums for some Introductions to people who care about the Topics of Dehumidifiers and Carpet Cleaning?
[06:49 pm]
Vrael -- Perhaps even here I on the StarEdit Network I could look for some Introductions.
[06:48 pm]
Vrael -- On this Topic, I could definitely use some Introductions.
[06:48 pm]
Vrael -- Perhaps that utilizes cutting-edge technology and eco-friendly cleaning products?
[06:47 pm]
Vrael -- Do you know anyone with a deep understanding of the unique characteristics of your carpets, ensuring they receive the specialized care they deserve?
[06:45 pm]
NudeRaider -- Vrael
Vrael shouted: I've also recently becoming interested in Carpet Cleaning, but I'd like to find someone with a reputation for unparalleled quality and attention to detail.
beats me, but I'd make sure to pick the epitome of excellence and nothing less.
[06:41 pm]
Vrael -- It seems like I may need Introductions to multiple companies for the Topics that I care deeply about, even as early as Today, 6:03 am.
Please log in to shout.


Members Online: Excalibur