Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Limit to number of unique properties for CUWP?
Limit to number of unique properties for CUWP?
Mar 6 2019, 3:57 am
By: sethmachine  

Mar 6 2019, 3:57 am sethmachine Post #1



Hi,

I have been reading the CHK specification and it seems to imply there can only be 64 unique Create Unit With Property triggers: http://www.starcraftai.com/wiki/CHK_Format#.22UPRP.22_-_CUWP_Slots. By unique, I mean 64 unique combinations of different property flags. E.g. I suppose we could run out just by doing CUWP for each 1% of health.

So in TrigEdit, the Create Unit With Property has a final integer argument representing the property. It's usually a one or 2 digit number. At first I thought this was just the decimal value of all the flags/bits, but I believe it's actually an index to the array of CUWP stored in the .CHK file. I really hope I'm wrong, because this would 1) imply a limit to CUWP and 2) make it difficult to generate CUWP triggers on the fly.

Quote
This section is used whenever the create units with properties trigger is used. Since a slot has to be assigned to the action, this is where each slot is designated
There are 64 of the following structures regardless of how many are used and it cannot exceed 64

This just seems like poor design...but seems be true. It's more obvious because there is no SetUnitProperties but a separate action for each property, e.g. Modify Unit Hit Points.

I guess a way around the limit would be to create units normally and then run multiple Modify commands at a particular location. Maybe that's what I'll do, otherwise I'd have to fill in the CUWP in order to know the mapping from the property index to the actual unit properties without manually writing the triggers and observing this.



None.

Mar 6 2019, 9:49 am Oh_Man Post #2

Find Me On Discord (Brood War UMS Community & Staredit Network)

Yes. Create them normally and then immediately under add the modify triggers.

I only use CUWP when I absolutely have to ie creating hallucinations.




Mar 6 2019, 10:54 am Suicidal Insanity Post #3

I see you !

Trigedit should have a tab which displays the array of 64 CUWP items where you can configure them.




Mar 6 2019, 12:16 pm sethmachine Post #4



Darn that's just awful.

But what happens if you set the CUWP index to something beyond 64 (63 if zero indexed)? Will it try to read the next section of the .CHK file as CUWP data? Presumably you could still get "valid" CUWP blocks.

And why did Blizzard do this with CUWP? I'm confused why it's limited. Why not have the property argument simply be the decimal interpretation of all the CUWP flags/bits?

And I'll probably use Modify Units, but I may end up parsing the CHK file and writing my own CUWP blocks just for the convenience.

Quote
Trigedit should have a tab which displays the array of 64 CUWP items where you can configure them.

Aren't you the author of SCMDraft? This seems trivialish to do.



None.

Mar 6 2019, 12:31 pm NudeRaider Post #5

We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

Quote from sethmachine
Aren't you the author of SCMDraft? This seems trivialish to do.
He is, and he wasn't suggesting it, he was telling you where it is. :P





Mar 6 2019, 3:27 pm Suicidal Insanity Post #6

I see you !

Quote from NudeRaider
Quote from sethmachine
Aren't you the author of SCMDraft? This seems trivialish to do.
He is, and he wasn't suggesting it, he was telling you where it is. :P

Exactly.

Blizzard did it because the size of the CUWP settings is larger than the size of a single trigger action. And remember, SC was written back when every byte counted to get it to run with 8/16MB of RAM, so there were compromises w.r.t. the number of slots, locations, etc.

A more flexible design would have been to have a trigger action that can modify the CUWP slot parameters, and another one that applies it, but hindsight is 20 20 and so on.




Mar 6 2019, 10:12 pm sethmachine Post #7



Awesome, SI. It even can be copy and pasted. I guess I will hold off on my CHK to JSON project for now...

But what happens if I reference a CUWP beyond index 63/64? Will SC read the next data as CUWP, or will my map just not save/crash?



None.

Mar 7 2019, 4:44 pm Suicidal Insanity Post #8

I see you !

I'm not sure - I know that 1.16 added a bunch of sanity checks for buffer accesses, as did SC:R, but they may have missed that location. You will need to experiment, or reverse engineer, or ask somebody with access to the source.




Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[02:58 am]
KrayZee -- You
[12:00 am]
RexyRex -- u
[09:35 pm]
Pr0nogo -- he broke it intentionally so you couldn't take it
[08:55 pm]
Dem0n -- ya, hurry up and fix so I can take Wing's box
[08:40 pm]
Wing Zero -- Magic boxes still not fixed....
[08:10 pm]
UEDCommander -- How depressing
[08:09 pm]
UEDCommander -- Recently someone actually called me "eud" without even knowing what starcraft is
[01:13 pm]
Pr0nogo -- u
[12:42 pm]
UEDCommander -- Who said EUDCommander
[07:56 am]
Pr0nogo -- u(de)
Please log in to shout.


Members Online: Roy, KrayZee, SiKiN, MasterJohnny