My map, WW2 Diplo has finally gotten popular, and I must admit after a year's struggle it feels damned good to finally get up there :)
However there are some issues.
One of them is this:
The map plays like the old Diplomacy Infinity, and I've got a trigger to replace the default units trained from the barracks to a custom unit if the custom unit is selected.
The SU_SendUnitToRally function. The input is the "last replaced unit". Trouble is in WW2 Diplo there could be several or more replaced units replaced with their specials a second. There is only so much I can do to prevent units being built so rapidly, given the nature of any diplomacy game based off something like Diplomacy Infinity.
So what happens is with all these firing, the "last replaced unit" will grab another unit being executed by another of the same trigger.
To provide a better picture: USSR Builds a T-34. Germany Builds a Panzer IV. Germany's SU_SendUnitToRally's "last replaced unit" grabs the T-34, not the Panzer IV like it supposed to.
The end result is something like 15% of the units go wondering off in the wrong direction and you can't control them.
Now in single player, it works just fine. But on Battle.net with the increased number of executions from multiple players, the method I'm using currently can't cope with the load.
Can anyone help me get this trigger working? I after a whole year's worth of work I'm finally on page 3. I'd really like to be able to stay up there if at all possible.
Thank You!
---------------------------
For those of you who read further let me give you a list of stuff I've tried.
-Waits, both anywhere I could think of (I might have missed something) and some places I'm embarrised to admit to have tried :)
-Any combination of Triggers and Action Definitions I could think of (I might have missed something) including ones I'm embarrised to admit to have tried :)
Brain going to sleep can't think of anything else atm.
If you have ANY insight or idea into how to make this work please let me know!
Holy trigger madness. You seem to know, how to use arrays, why dont you actually use them? xD
I am pretty sure, you can cut most of your replace unit action with some intelligent use of arrays or data tables.
Just look at the 2nd line for each if: Its the same for every single line! Why not just add it AFTER the whole if/then/else part, since it is executed for all of them anyway?
Same for the condition in your first trigger: Why check for 7 individual players and not just check, if triggering player is >= 8?
As for your described problem: Triggers in SC2 cannot be executed at the same time, ever. Since the call for the send to rally function comes immediately after replacing the unit, there is no chance another trigger interferes. However, you execute the rallied function in a new thread, which internally translates into starting a new trigger for each function call. Any specific reason, why you do that?
Also, you mixed up the produced unit and the last replaced unit in some lines, for example the line with the RocketArtilleryType, where you replace the Last Replaced Unit and send the ProducedunitId to the rally.
lot of that stuff was the way it was because for some reason it wasn't executing. And, as I said, I was trying everything I could think of. Also I was doing this at 2 AM so I probably missed some stuff. I was only testing the conscript anyways, as it generated the most load (its built in platoons, unlike the others).
The rally wasn't coded with the unit matchups in a single trigger because for some reason the rally part of it wouldn't fire. I suspect the trigger was timing out.
Next the reason why the Unit matchups weren't in arrays was an orginizational decision by me.
With 100 units already in the map and potential for over 200 more... It made it easier to apply if It did it this way.
I'm rapidly comming to a conclusion however. Given my experience in coding a lagless 1st/3rd person movement system, and on top of it a projectile system, all trigger based, I have come to the conclusion that this is better done as a hybrid.
Ill make the unit lineups give a behavior to the producing structures. Then I can just show and hide build buttons at will. Beyond that its just coding the abiliites and the buttons. Data editor stuff doesn't lag nearly as bad as trigger stuff, if my personal tests in the matter have shown anything.
Thanks for the help though!
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hey all,
I've got a Wee bit of a probem.
My map, WW2 Diplo has finally gotten popular, and I must admit after a year's struggle it feels damned good to finally get up there :)
However there are some issues.
One of them is this:
The map plays like the old Diplomacy Infinity, and I've got a trigger to replace the default units trained from the barracks to a custom unit if the custom unit is selected.
My code is as follows:
------------------------------------------------------Now it all works fine, except for one thing:
The SU_SendUnitToRally function. The input is the "last replaced unit". Trouble is in WW2 Diplo there could be several or more replaced units replaced with their specials a second. There is only so much I can do to prevent units being built so rapidly, given the nature of any diplomacy game based off something like Diplomacy Infinity.
So what happens is with all these firing, the "last replaced unit" will grab another unit being executed by another of the same trigger.
To provide a better picture: USSR Builds a T-34. Germany Builds a Panzer IV. Germany's SU_SendUnitToRally's "last replaced unit" grabs the T-34, not the Panzer IV like it supposed to.
The end result is something like 15% of the units go wondering off in the wrong direction and you can't control them.
Now in single player, it works just fine. But on Battle.net with the increased number of executions from multiple players, the method I'm using currently can't cope with the load.
Can anyone help me get this trigger working? I after a whole year's worth of work I'm finally on page 3. I'd really like to be able to stay up there if at all possible.
Thank You!
---------------------------For those of you who read further let me give you a list of stuff I've tried.
-Waits, both anywhere I could think of (I might have missed something) and some places I'm embarrised to admit to have tried :) -Any combination of Triggers and Action Definitions I could think of (I might have missed something) including ones I'm embarrised to admit to have tried :)
Brain going to sleep can't think of anything else atm.
If you have ANY insight or idea into how to make this work please let me know!
Holy trigger madness. You seem to know, how to use arrays, why dont you actually use them? xD
I am pretty sure, you can cut most of your replace unit action with some intelligent use of arrays or data tables.
Just look at the 2nd line for each if: Its the same for every single line! Why not just add it AFTER the whole if/then/else part, since it is executed for all of them anyway?
Same for the condition in your first trigger: Why check for 7 individual players and not just check, if triggering player is >= 8?
As for your described problem: Triggers in SC2 cannot be executed at the same time, ever. Since the call for the send to rally function comes immediately after replacing the unit, there is no chance another trigger interferes. However, you execute the rallied function in a new thread, which internally translates into starting a new trigger for each function call. Any specific reason, why you do that?
Also, you mixed up the produced unit and the last replaced unit in some lines, for example the line with the RocketArtilleryType, where you replace the Last Replaced Unit and send the ProducedunitId to the rally.
@Kueken531: Go
lot of that stuff was the way it was because for some reason it wasn't executing. And, as I said, I was trying everything I could think of. Also I was doing this at 2 AM so I probably missed some stuff. I was only testing the conscript anyways, as it generated the most load (its built in platoons, unlike the others).
The rally wasn't coded with the unit matchups in a single trigger because for some reason the rally part of it wouldn't fire. I suspect the trigger was timing out.
Next the reason why the Unit matchups weren't in arrays was an orginizational decision by me.
With 100 units already in the map and potential for over 200 more... It made it easier to apply if It did it this way.
I'm rapidly comming to a conclusion however. Given my experience in coding a lagless 1st/3rd person movement system, and on top of it a projectile system, all trigger based, I have come to the conclusion that this is better done as a hybrid.
Ill make the unit lineups give a behavior to the producing structures. Then I can just show and hide build buttons at will. Beyond that its just coding the abiliites and the buttons. Data editor stuff doesn't lag nearly as bad as trigger stuff, if my personal tests in the matter have shown anything.
Thanks for the help though!