1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.
    Dismiss Notice
  4. Dismiss Notice
  5. The Highway to Hell has been laid open. Come along and participate in the 5th Special Effect Contest.
    Dismiss Notice
  6. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

SC2's Engine worse than WC3's?

Discussion in 'StarCraft II Modding' started by splashy5, Jun 19, 2010.

  1. splashy5

    splashy5

    Joined:
    Jul 22, 2007
    Messages:
    259
    Resources:
    0
    Resources:
    0
    Im making a map where it has a lot of on hit checks. In SC2 i get a Too Many Threads error and all the triggers stop working, in WC3 i made the same functions and i got no problems. does Sc2 have a worse engine than WC3's lol

    also if anyone knows a way to fix that Too Many scripts error feel free to post.
     
  2. Deolrin

    Deolrin

    Joined:
    Apr 18, 2008
    Messages:
    7,229
    Resources:
    57
    Models:
    48
    Icons:
    6
    Packs:
    2
    Tutorials:
    1
    Resources:
    57
    Umm. Use less scripts? Optimize your code? Use libraries?
     
  3. Statharas

    Statharas

    Joined:
    Jul 9, 2008
    Messages:
    2,332
    Resources:
    14
    Tools:
    1
    StarCraft II Resources:
    5
    Tutorials:
    8
    Resources:
    14
    Libraries = Win. Use them.
     
  4. splashy5

    splashy5

    Joined:
    Jul 22, 2007
    Messages:
    259
    Resources:
    0
    Resources:
    0
    aren't libraries used to transfer data between people? or is their another use for them in this editor?
     
  5. Statharas

    Statharas

    Joined:
    Jul 9, 2008
    Messages:
    2,332
    Resources:
    14
    Tools:
    1
    StarCraft II Resources:
    5
    Tutorials:
    8
    Resources:
    14
    I am wondering if nobody actually understands how the editor works.
     
  6. splashy5

    splashy5

    Joined:
    Jul 22, 2007
    Messages:
    259
    Resources:
    0
    Resources:
    0
    is that an insult or a way of saying that u don't know?
     
  7. Arhowk

    Arhowk

    Joined:
    Aug 8, 2007
    Messages:
    2,752
    Resources:
    0
    Resources:
    0
    Lol. what he is saying is, the sc2 engine is better than the wc3, its just different. You cant do the same things, but u can do more advanced things if u know how to do them correctly with the sc2 engine. The trigger error thing is because ur treating it like a WC3 map, not sc2.
     
  8. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,801
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    It serves you right for abusing events like you did in WC3.

    In SC2, you simply use a couple of events to run all the code you want. For example if you have a lot of on attack triggers (for some reason as you can use any effect for an attack) you just have a couple of triggers run all the effects. For example all upgrade related on attack effects from one while the actual game play effects on another.

    In WC3 people had the bad habbit of making 100s of triggers with on attack events meaning there are 100s of event handles, 100s of triggers to evaluate ETC which is kind of dumb from a programming point of view. SC2 actually tells you its dumb cause their smarter code system can not handle 100s of threads at once to prevent thread abuse (you could lock up WC3 by creating 10000s of threads with an infinite wait loop).

    I just advise programming better and trying to bundle code together. it is far more efficent to have the same code run consecutivly in 1 thread than making 2 threads to run the code in parrallel (still its in series physically but can be considered in parallel in the way it can behave).
     
  9. splashy5

    splashy5

    Joined:
    Jul 22, 2007
    Messages:
    259
    Resources:
    0
    Resources:
    0
    did that still gave error

    • On Hit AI
      • Events
        • Unit - Any Unit is attacked
      • Local Variables
      • Conditions
        • Or
          • Conditions
            • (Controller of player (Owner of (Triggering unit))) == Computer
            • (Controller of player (Owner of (Triggering unit))) == None
      • Actions
        • General - If (Conditions) then do (Actions) else do (Actions)
          • If
            • Or
              • Conditions
                • ((Triggering unit) Energy (Percent) (Current)) >= 30.0
                • ((Triggering unit) Life (Percent) (Current)) <= 40.0
          • Then
            • General - If (Conditions) then do (Actions) else do (Actions)
              • If
                • (Unit type of (Triggering unit)) == Banshee
              • Then
                • Unit - Order (Triggering unit) to (Banshee - Cloak (Banshee)) (Replace Existing Orders)
              • Else
                • General - If (Conditions) then do (Actions) else do (Actions)
                  • If
                    • (Unit type of (Triggering unit)) == Ghost
                  • Then
                    • Unit - Order (Triggering unit) to (Ghost - Cloak (Ghost)) (Replace Existing Orders)
                  • Else
          • Else
        • General - If (Conditions) then do (Actions) else do (Actions)
          • If
            • ((Triggering unit) can attack (Attacking Unit)) == false
          • Then
            • General - If (Conditions) then do (Actions) else do (Actions)
              • If
                • (Unit type of (Triggering unit)) == Viking (Assault Mode)
              • Then
                • Unit - Order (Triggering unit) to (Viking - Fighter Mode) (Replace Existing Orders)
              • Else
                • General - If (Conditions) then do (Actions) else do (Actions)
                  • If
                    • (Unit type of (Triggering unit)) == Viking (Fighter Mode)
                  • Then
                    • Unit - Order (Triggering unit) to (Viking - Assault Mode) (Replace Existing Orders)
                  • Else
          • Else
        • General - If (Conditions) then do (Actions) else do (Actions)
          • If
            • (Unit type of (Triggering unit)) == Stalker
            • Or
              • Conditions
                • ((Triggering unit) Shields (Percent) (Current)) == 0.0
                • ((Triggering unit) Life (Percent) (Current)) <= 40.0
          • Then
            • Unit - Order (Triggering unit) to (Stalker - Blink targeting ((Position of (Triggering unit)) offset by 7.9 towards (Facing of (Attacking Unit)) degrees)) (Replace Existing Orders)
          • Else
        • General - If (Conditions) then do (Actions) else do (Actions)
          • If
            • ((Triggering unit) Life (Percent) (Current)) <= 40.0
          • Then
            • General - If (Conditions) then do (Actions) else do (Actions)
              • If
                • (Unit type of (Triggering unit)) == Baneling
              • Then
                • Unit - Order (Triggering unit) to (Baneling - Burrow) (Replace Existing Orders)
                • General - Wait for (Conditions), checking every 5.0 Game Time seconds
                  • Conditions
                    • ((Triggering unit) Life (Percent) (Current)) >= 75.0
                • Unit - Order (Triggering unit) to (Baneling - Unburrow) (Replace Existing Orders)
                • Unit - Order (Triggering unit) to ( Attack targeting (Position of Player Base[(Owner of (Triggering unit))])) (After Existing Orders)
              • Else
                • General - If (Conditions) then do (Actions) else do (Actions)
                  • If
                    • (Unit type of (Triggering unit)) == Hydralisk
                  • Then
                    • Unit - Order (Triggering unit) to (Hydralisk - Burrow) (Replace Existing Orders)
                    • General - Wait for (Conditions), checking every 5.0 Game Time seconds
                      • Conditions
                        • ((Triggering unit) Life (Percent) (Current)) >= 75.0
                    • Unit - Order (Triggering unit) to (Hydralisk - Unburrow) (Replace Existing Orders)
                    • Unit - Order (Triggering unit) to ( Attack targeting (Position of Player Base[(Owner of (Triggering unit))])) (After Existing Orders)
                  • Else
                    • General - If (Conditions) then do (Actions) else do (Actions)
                      • If
                        • (Unit type of (Triggering unit)) == Infestor (Spellcaster)
                      • Then
                        • Unit - Order (Triggering unit) to (Infestor - Burrow) (Replace Existing Orders)
                        • General - Wait for (Conditions), checking every 5.0 Game Time seconds
                          • Conditions
                            • ((Triggering unit) Life (Percent) (Current)) >= 75.0
                        • Unit - Order (Triggering unit) to (Infestor - Unburrow) (Replace Existing Orders)
                        • Unit - Order (Triggering unit) to ( Attack targeting (Position of Player Base[(Owner of (Triggering unit))])) (After Existing Orders)
                      • Else
                        • General - If (Conditions) then do (Actions) else do (Actions)
                          • If
                            • (Unit type of (Triggering unit)) == Roach
                          • Then
                            • Unit - Order (Triggering unit) to (Roach - Burrow) (Replace Existing Orders)
                            • General - Wait for (Conditions), checking every 5.0 Game Time seconds
                              • Conditions
                                • ((Triggering unit) Life (Percent) (Current)) >= 75.0
                            • Unit - Order (Triggering unit) to (Roach - Unburrow) (Replace Existing Orders)
                            • Unit - Order (Triggering unit) to ( Attack targeting (Position of Player Base[(Owner of (Triggering unit))])) (After Existing Orders)
                          • Else
                            • General - If (Conditions) then do (Actions) else do (Actions)
                              • If
                                • (Unit type of (Triggering unit)) == Ultralisk
                              • Then
                                • Unit - Order (Triggering unit) to (Ultralisk - Burrow) (Replace Existing Orders)
                                • General - Wait for (Conditions), checking every 5.0 Game Time seconds
                                  • Conditions
                                    • ((Triggering unit) Life (Percent) (Current)) >= 75.0
                                • Unit - Order (Triggering unit) to (Ultralisk - Unburrow) (Replace Existing Orders)
                                • Unit - Order (Triggering unit) to ( Attack targeting (Position of Player Base[(Owner of (Triggering unit))])) (After Existing Orders)
                              • Else
                                • General - If (Conditions) then do (Actions) else do (Actions)
                                  • If
                                    • (Unit type of (Triggering unit)) == Zergling
                                  • Then
                                    • Unit - Order (Triggering unit) to (Zergling - Burrow) (Replace Existing Orders)
                                    • General - Wait for (Conditions), checking every 5.0 Game Time seconds
                                      • Conditions
                                        • ((Triggering unit) Life (Percent) (Current)) >= 75.0
                                    • Unit - Order (Triggering unit) to (Zergling - Unburrow) (Replace Existing Orders)
                                    • Unit - Order (Triggering unit) to ( Attack targeting (Position of Player Base[(Owner of (Triggering unit))])) (After Existing Orders)
                                  • Else
          • Else
     
  10. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,801
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    I advise disabling stuff in the triggers until you find the cause of the too many thread errors. For example start by disabling all the actions but a debug message one and seeing if the error occurs. Then slowly turn them on 1 by 1 until the thread error appears.

    There are 2 possible causes, an infinite loop or a bug as far as I can see at a glance.
     
  11. redmarine

    redmarine

    Joined:
    Sep 4, 2007
    Messages:
    2,781
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Yeah, there is an infinite loop bug. Turn off the trigger just before you execute the order and turn it back on after it is executed. That way you'll avoid the infinite loop.

    PS: This was pretty common in wc3 too.
     
  12. splashy5

    splashy5

    Joined:
    Jul 22, 2007
    Messages:
    259
    Resources:
    0
    Resources:
    0
    so put an off and on between each order?
     
  13. redmarine

    redmarine

    Joined:
    Sep 4, 2007
    Messages:
    2,781
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Yeah. Example:

    "Turn off this trigger
    Order blablabla
    Turn on this trigger"

    That way, the same trigger won't register that particular order that was executed.
     
  14. maskedpoptart

    maskedpoptart

    Joined:
    Aug 4, 2006
    Messages:
    351
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Lol, infinite loops... The reason this would appear to work without problems in wc3 is that the threads currently running would crash without reporting any error. sc2 is better in that it actually tells when the threads crash...