SC2 BETA Editor findings

Post Reply
User avatar
Ricky_Honejasi
Xel'naga Solar Moderator
Xel'naga Solar Moderator
Posts: 2011
Joined: Wed Aug 16, 2006 3:50 pm

Re: SC2 Editor findings

Post by Ricky_Honejasi »

So a minor thing that can be very annoying unless you do notice it.

With a fetched player's supplies (used/made/limit) number-wise, there is a difference between SC2 and WC3.

In WC3, it was "max" for the highest supply while not going over the limit. However, in SC2, "made" returns the value ignoring the limit.

While it can be useful in specific cases, it can be annoying if you try to enforce the lowest between made/limit (which you have to do manually) instead of hoping a single value already doing both for you.

It sounds ridiculous but it does lead to "why the heck it goes over the limit randomly?" situations if you don't pay attention to this detail until you discover why.
User avatar
Ricky_Honejasi
Xel'naga Solar Moderator
Xel'naga Solar Moderator
Posts: 2011
Joined: Wed Aug 16, 2006 3:50 pm

Re: SC2 Editor findings

Post by Ricky_Honejasi »

So a new interesting detail.

While back then, I mentioned about the existence of bank triggers (store data in file, load said data on your next game, ex : RPG heroes' levels, items, etc.)

I can confirm the following so far :
1) It does work on multiplayer
2) You can load multiple banks (not just 1 per player)
3) You can load banks in mid-game (and not just at map initialization)
4) Text, String and Integers works in them
5) Bank's filenames MUST be only letters and numbers (ex : "ABank" is valid but "A_Bank" will end up being "ABank")

The test used 2 banks for each player (4 total), only one value in each bank. The 2nd bank of each player was loaded in a one second delay (although it did seem to lag for a short while) instead of map start. My usual testing partner was BilltheEmu for multiplayer proposes.

What does it mean?

It's nice to know that it does actually work in multiplayer.

The multiple banks are interesting for a specific reason : You are not forced to pack every piece of data to save in a single bank file for any specific player. It also allow for a "master save" system where it contains string references to other files. Ultimately, you can load that master file referring to 100 RPG Banked characters and only load the corresponding banked character save (instead of having to mass load those 100 banked characters just to ensure the player can pick the one they want).

Mid-game loading saves is a big plus since it allows the above (picking a character and load that save in mid-game) on top of ensuring your map initialization won't die due to banks being too long to load if you delay their loading and synchronization instead of doing it on map init.
User avatar
Xenon
Zerg Queen's Nest Slave Trainee
Zerg Queen's Nest Slave Trainee
Posts: 771
Joined: Mon Oct 23, 2006 3:29 pm

Re: SC2 Editor findings

Post by Xenon »

How did you get the dialog to detect shift-click and ctrl-click?
User avatar
Ricky_Honejasi
Xel'naga Solar Moderator
Xel'naga Solar Moderator
Posts: 2011
Joined: Wed Aug 16, 2006 3:50 pm

Re: SC2 Editor findings

Post by Ricky_Honejasi »

Xenon wrote: How did you get the dialog to detect shift-click and ctrl-click?
You cannot detect it 100% directly but you can do the following trick :

Part 1 : A boolean variable (false by default) which is turned true by a trigger with a "Player has pressed (Specific Key)" and turned false by a trigger with a "Player has released (Specific Key)". However, if you need it for multiple players, it's preferable to make this variable as array (basically a size of 16, [0] to [15] for players #0 to #15).

Part 2 : In dialog triggers, when you push the wanted dialog button, you check into the boolean variable(s) above to determine if said player is pressing the key or not.

In both cases above, it should be  "Triggering Player" to detect the player pressing key (part #1) or pressing the dialog button (part #2).

Note : From what I have seen, key detection has some considerable delays for multiplayer (didn't really test how much better/worse compared to WC3). It's instant for singleplayer.

EDIT : As an additional note, in SC2, triggering player is directly usable as an integer. For example, you can do boolHasPressedKey[(Triggering Player)] = true .
Last edited by Ricky_Honejasi on Sat Jun 12, 2010 3:39 pm, edited 1 time in total.
User avatar
Xenon
Zerg Queen's Nest Slave Trainee
Zerg Queen's Nest Slave Trainee
Posts: 771
Joined: Mon Oct 23, 2006 3:29 pm

Re: SC2 Editor findings

Post by Xenon »

I was afraid of that. Did anyone have problems with the shift-click due to multiplayer delays?
User avatar
Ricky_Honejasi
Xel'naga Solar Moderator
Xel'naga Solar Moderator
Posts: 2011
Joined: Wed Aug 16, 2006 3:50 pm

Re: SC2 Editor findings

Post by Ricky_Honejasi »

Xenon wrote: I was afraid of that. Did anyone have problems with the shift-click due to multiplayer delays?
While I more or less already answered, if I base it on my own project that don't rely too heavily on shift-click + dialog button, it did seem reasonable however based on the map "Touhou", it did have a ridiculous delay (although could be due to all the special effects too).

Otherwise, Bill and I tried some other map that heavily relied on keys and it lagged like hell but I can't confirm it was truly because of the keys since it was very early Patch 13 (where b.net 2.0 would easily lag for anything and everything).

From what I heard otherwise, there is a delay for key presses and direct mouse clicks (those directly detected by a trigger as "mouse click" events). So it's fairly sure that you don't get "magical" 0-50 ms delays for them.

One thing you might want to test is to see if "key is pressed" events are repeated multiple times in a row when you either keep the specific key pressed (over time) or per key press (like 3-4 events per key instead 1).
User avatar
Xenon
Zerg Queen's Nest Slave Trainee
Zerg Queen's Nest Slave Trainee
Posts: 771
Joined: Mon Oct 23, 2006 3:29 pm

Re: SC2 Editor findings

Post by Xenon »

Well, I mean that at any point in multiplayer did a shift-click ever register or not register when it wasn't supposed to because of the delay.

There's also that warning that registering key events generates net traffic for all players for any key pressed (doesn't specify whether that applies to specific key or just any key events). When the custom maps were enabled it overloaded Bnet, and all the WASD maps may have been responsible, causing Blizzard to add the delay. I still don't know why they couldn't just handle key presses the way they handle dialogs and orders (unless they actually do, and it's just the volume of key presses that causes the problem).

I'd like to avoid these issues, so it looks like I'll have to add more buttons to an already dialog-heavy project.
Mr.
Zerg Creep Colony Landscaper
Zerg Creep Colony Landscaper
Posts: 408
Joined: Wed Aug 30, 2006 9:48 am
Location: Virginia

Re: SC2 Editor findings

Post by Mr. »

Xenon wrote: Well, I mean that at any point in multiplayer did a shift-click ever register or not register when it wasn't supposed to because of the delay.
I may have had issues with this while testing Ricky's map at some point.  I recall, on more than one instance, I would click a unit to buy it in his dialog, without holding shift or control, and somehow end up buying 5 or 20 of them, instead of one.  I did tell Ricky about it, but I don't remember if he mentioned any cause for it, if it had anything to do with delay, or if it was something in his triggers somewhere.

But it may have been something in the triggers, because I don't recall pressing shift or control any time prior to clicking them.  It's too bad we can't actually test any of this.
Paging Dr. @Lavarinth
User avatar
Ricky_Honejasi
Xel'naga Solar Moderator
Xel'naga Solar Moderator
Posts: 2011
Joined: Wed Aug 16, 2006 3:50 pm

Re: SC2 Editor findings

Post by Ricky_Honejasi »

For that part Bill, it's because it can be easy to either hold SHIFT prior chat or after chat. While during the chat, it ignores any key presses including releases.

Example :

*Map can detect SHIFT keys
You are about to write "Hello" ...

Our habit is likely to be :
1) Hit SHIFT (about to make that "H" caps, registered by trigger since outside of chat)
2) Hit ENTER (to write chat)
3) Type as usual which is "h" and then shift release for "ello" (which the key release DOESN'T register since INSIDE of chat)
4) Exit chat after typing an extra ENTER

So you sent your message and the game still thinks you are holding SHIFT (with my method) even if you released it in mid-chat. Ultimately this forces to repress shift key just to release to make the game think you are not holding it.

Side notes :
A) "Any key" would detect the ENTER at #2 but NOT any key hit for chatting at #3 and NOT the ENTER at #4
B) While there is a "Player is pressing Shift" boolean condition (same for Alt and Ctrl), it doesn't have a player index so I presume it's only useful for singleplayer and possibly plain ignored or misdetected (ex : only player #0 or #1) in multiplayer.
User avatar
Ricky_Honejasi
Xel'naga Solar Moderator
Xel'naga Solar Moderator
Posts: 2011
Joined: Wed Aug 16, 2006 3:50 pm

Re: SC2 Editor findings

Post by Ricky_Honejasi »

Bank extra tests #1 : Big on Map init

So I decided to test how many bank saves you can do in map init without triggering the "trigger too long" error.

With a map with an initialization that haves only a loop along with bank saving, I managed to store 260000 integers into a single player's bank file then saved the bank file which became nearly 20 MB of filesize.

A particular detail for bank saves is when you do save the bank file, the saved data is NOT in the order you did enter save your data. For example if you loop from 1 to 260000 (used as key name + key's data in my test), instead of the key being 1, 2 , 3, etc. it could be 214241 then 4315 then 164234, etc.

While I would obviously not manually check all 260000 keys, key #1 and key #260000 along with random key numbers I inputted while checking the bank file as a text file reveal that all saved data is probably there.

================================

Bank extra tests #2 : Big bank file size

Thus, my next test involves trying to have a clue to how big bank files can be. I modified my test to add more data over time. I managed to have a bank file weighting 170 MB with 2,200,000 integers. Key #2,200,000 along with random integer searches were found.

Note that 170 MB is NOT the maximum and I don't think there is any real maximum.

As expected, the saving delays (when you use the action "Save Bank") did get longer as more data was to be saved but even with a total of 2,200,000 integers, it didn't cause me any "trigger execution too long" errors in singleplayer. In my case, it took my computer a good 6-10 seconds for the 2,200,000 integers case.  However, I wouldn't be surprised if that many would cause drops in multiplayer games.

================================

Bank extra tests #3 : Loading & Bank file sizes

For loading the bank file, I couldn't have a clear indication at first how longer it adds to load times for such big file. If I enforce a Terran-only race to avoid reloading the Terran Interference.

Then something came up as I didn't find it normal that I could near instant-load an empty map back then and then it takes forever. I move away my 170 MB bank file from my bank folder ... and it instant-loads the next time I load the  map.

This ultimately means that EVERY player's banks are ALWAYS loaded LOCALLY on ANY map. Since when I had that 170 MB bank file, it did load up that 170 MB each time I load ANY map until I moved it away.

I believe the reason it is done like this is to minimize multiplayer delays when accessing bank files in mid-game. It does make sense since I tried to access the bank's data very randomly. It did pop the data very quickly regardless of how deep the data it technically is inside their text file. Also odds are nobody would have bank files that big in normal cases.

Attachments
Those test maps have a trigger (by hitting the ESC key) to mass wipe all the bank data created by them. Otherwise the 170 MB bank data will add up to your load times for your next map loads.
You do not have the required permissions to view the files attached to this post.
Last edited by Ricky_Honejasi on Thu Jun 17, 2010 3:42 pm, edited 1 time in total.
Mr.
Zerg Creep Colony Landscaper
Zerg Creep Colony Landscaper
Posts: 408
Joined: Wed Aug 30, 2006 9:48 am
Location: Virginia

Re: SC2 Editor findings

Post by Mr. »

Okay, I have a new inquiry, this time with dialogs and boss bars.

When you make a boss bar, it looks like this:


That's cool, except I would really like to be able to make a boss bar without the icon, and without the title on the top.  Just the green/red bar, and the numbers on top.  So I think I'll just make a dialog, and I see that I can put a "progress bar" in there, and I think that I could set the background to hidden, and it will be good!  But then I get this:


Well that's kinda crappy looking.  I just want a health bar that doesn't waste so much space with the big box and the icon, but actually looks like it fits in with the interface.  I want it to look like this:


Is there any way to pull this off in the editor, currently?  Or would I have to do something like make images one pixel wide of green and red bars, and display those images in a dialog box in a line?  I actually might try doing that now, it might not be THAT bad, but it would be really nice if there was a not retarded way to do it :(

EDIT:  Nevermind, actually getting it to work like that, and it's not THAT bad to do it.  I'm not sure if it's good or bad performance-wise to do it this way, though...

EDIT2:  Succuss!



Here's the code I used, not very difficult, but if anyone could use it:
Spoiler

Code: Select all


Variables:

            UI_HHB_HPNumber = No Dialog Item <Dialog Item>
            UI_HHB_Pixels = No Dialog Item <Dialog Item[100]>
            UI_HHB_PixelsGreen = false <Boolean[100]>
            UI_HHB_Dialog = No Dialog <Dialog>
            UI_HHB_Item = No Dialog Item <Dialog Item>

Initialization Trigger:

        Dialog - Create a Modal dialog of size (600, 120) at (50, 50) relative to Top Left of screen
        Variable - Set UI_HHB_Dialog = (Last created dialog)
        General - Pick each integer from 0 to 99, and do (Actions)
            Actions
                Dialog - Create a Image for Dialog UI_HHB_Dialog
                Variable - Set UI_HHB_Pixels[(Picked integer)] = (Last created dialog item)
                Variable - Set UI_HHB_PixelsGreen[(Picked integer)] = true
                Dialog - Set UI_HHB_Pixels[(Picked integer)] image to Assets\Textures\green.dds for (All players)
                Dialog - Set UI_HHB_Pixels[(Picked integer)] size to (3, 30) for (All players)
                Dialog - Move UI_HHB_Pixels[(Picked integer)] to (((Picked integer) * 3), 0) relative to Left of dialog for (All players)
        Dialog - Create a Label for Dialog UI_HHB_Dialog
        Variable - Set UI_HHB_HPNumber = (Last created dialog item)
        Dialog - Set UI_HHB_HPNumber text to ((Text((Hero Life (Current))) with Any Precision decimal places) + (" / " + (Text((Hero Life (Default))) with 0 decimal places))) for (All players)
        Dialog - Set UI_HHB_HPNumber size to (300, 20) for (All players)
        Dialog - Move UI_HHB_HPNumber to (85, 0) relative to Left of dialog for (All players)
        Dialog - Show UI_HHB_Dialog for (All players)
        Dialog - Hide the background image of UI_HHB_Dialog

Refresh Trigger:

        Dialog - Set UI_HHB_HPNumber text to ((Text((Hero Life (Current))) with Any Precision decimal places) + (" / " + (Text((Hero Life (Default))) with 0 decimal places))) for (All players)
        Variable - Set _HP_Percent = (Integer((((Hero Life (Current)) / (Hero Life (Default))) * 100.0)))
        General - Pick each integer from 0 to 99, and do (Actions)
            Actions
                General - If (Conditions) then do (Actions) else do (Actions)
                    If
                        (Picked integer) <= (HP_Percent - 1)
                    Then
                        General - If (Conditions) then do (Actions) else do (Actions)
                            If
                                UI_HHB_PixelsGreen[(Picked integer)] == false
                            Then
                                Dialog - Set UI_HHB_Pixels[(Picked integer)] image to Assets\Textures\green.dds for (All players)
                                Variable - Set UI_HHB_PixelsGreen[(Picked integer)] = true
                            Else
                    Else
                        General - If (Conditions) then do (Actions) else do (Actions)
                            If
                                UI_HHB_PixelsGreen[(Picked integer)] == true
                            Then
                                Dialog - Set UI_HHB_Pixels[(Picked integer)] image to Assets\Textures\red.dds for (All players)
                                Variable - Set UI_HHB_PixelsGreen[(Picked integer)] = false
                            Else

Last edited by Mr. on Wed Jun 23, 2010 7:27 pm, edited 1 time in total.
Paging Dr. @Lavarinth
User avatar
Xenon
Zerg Queen's Nest Slave Trainee
Zerg Queen's Nest Slave Trainee
Posts: 771
Joined: Mon Oct 23, 2006 3:29 pm

Re: SC2 Editor findings

Post by Xenon »

The boss bar functions aren't natives; they're written in the Liberty library (click on one f the red square buttons to show libraries). You can copy and modify the script as needed. I think it works by changing the size and position of the green bar, which can be done for each player.
Mr.
Zerg Creep Colony Landscaper
Zerg Creep Colony Landscaper
Posts: 408
Joined: Wed Aug 30, 2006 9:48 am
Location: Virginia

Re: SC2 Editor findings

Post by Mr. »

Q, you are a genius.  I was able to copy the functions, and modify them to remove the icon and title, and the border, and background, then change the colors to my liking, and make three of them :P


(There should be in image here, DAMN YOU PHOTOBUCKET)

One for HP, one for Mana, and one for the state of a charge-up weapon.

It worked like you said, it changed the size of the green bar.  Much much more efficient than my "go through a loop 100 times for three bars x times a second" approach.  I was even able to make the health bar flash red when the unit's HP is low.  Excellent.  Except I may want to change the color on the bottom...
Paging Dr. @Lavarinth
Mr.
Zerg Creep Colony Landscaper
Zerg Creep Colony Landscaper
Posts: 408
Joined: Wed Aug 30, 2006 9:48 am
Location: Virginia

Re: SC2 Editor findings

Post by Mr. »

Okay, I have a RANDOM DISCOVERY about the editor!

Apparently, when it comes to directions, and degrees, the game does not go from 0 to 360.  It goes from -180 to 180.  It will recognize numbers higher or lower, and work with them just fine, but when the game returns a direction value, it is going to be in that -180 to 180 range.

So basically it goes like this.

              90
    135            45

180                        0

    -135            -45
              -90

It was causing me loads of problems when I was trying to do math with degrees, until I finally figured it out.

EDIT:  Also, straight west appears to be positive 180, not negative.
Last edited by Mr. on Thu Jun 24, 2010 5:03 pm, edited 1 time in total.
Paging Dr. @Lavarinth
User avatar
IskatuMesk
Xel'naga World Shaper
Xel'naga World Shaper
Posts: 8330
Joined: Sat Feb 07, 2009 1:40 pm
Location: M͈̙̞͍͞ͅE̹H̨͇̰͈͕͇̫Ì̩̳CO̼̩̤͖͘ జ్ఞ‌ా

Re: SC2 Editor findings

Post by IskatuMesk »

I'll have to remember that.
Post Reply