Staredit Network > Forums > SC1 UMS Theory and Ideas > Topic: Why does no one use for-loops for dynamic spawns?
Why does no one use for-loops for dynamic spawns?
Dec 23 2016, 9:12 pm
By: sethmachine  

Dec 23 2016, 9:12 pm sethmachine Post #1



Many custom maps have a key mechanic called "Spawning." Spawning is where when a player controls a certain building, unit, or location, army units get automatically created for that player based on some interval or other condition (time, resources, etc). Spawning helps to reduce the amount of macro needed by players. In vanilla Starcraft, buildings will not automatically create units unless the player manually constructs them. Spawning does this automatically.

This mechanic is used in many game genres. Notably some are:

- Golems (a static building usually)
- Evolves (a moving unit usually)
- Lotrish games (normally static pre-placed buildings)

Other genres, like Diplomacy (Diplo Infinity and its clones), do not have unit spawning. Instead, they reduce the player focus on macro by having resource spawning (= control a building or location generates resources). The player then must still build production structures and manually construct units as would be in a normal game.

A problem common to all these uses of spawning is that each instance is fixed, pre-defined, and hardcoded. Players cannot create new spawning structures (unit factories, whatever), because the spawning location and requirements are hardcoded.

It is very feasible to allow dynamic spawning. That is, assume a Barracks creates 1 marine every minute via triggers. So, if a player controls 5 barracks, he should get 5 marines every minute. But, each marine should be spawned at each specific Barracks. The old way of doing this makes it impossible, unless the locations of the Barracks are fixed.

Instead, by using a for-loop through taking control of 1 barracks at a time to another player, applying the effect, and then taking control of each subsequent barracks before returning them all, a player can have unlimited unit spawners at any location.

The only maps I believe make use of such a powerful mechanic are Desert Strike and its clones.

I have not seen any other custom map that uses dynamic spawns. I have, however, put together my own map which uses dynamic spawning: http://www.staredit.net/topic/16412/

Why is this technique not used in many maps?



None.

Dec 23 2016, 9:37 pm Swampfox Post #2



I'm almost certain this mechanic is used in many more maps than you give credit for. I've used this mechanic in several maps I've made and learned it from several maps I've looked into the triggers to further my understanding.



None.

Dec 23 2016, 10:15 pm lil-Inferno Post #3

Just here for the pie

Tons of maps do this.




Dec 23 2016, 11:21 pm Dem0n Post #4

ᕕ( ᐛ )ᕗ

Yeah, I don't think you're looking at other maps' triggers properly if you think this isn't done in like everything.




Dec 23 2016, 11:23 pm lil-Inferno Post #5

Just here for the pie

Quote from Dem0n
Yeah, I don't think you're looking at other maps' triggers properly if you think this isn't done in like everything.
You don't even have to look at the triggers, you can just tell by gameplay. Even a map like Temple Siege does this to loop through assimilators.




Dec 23 2016, 11:31 pm Dem0n Post #6

ᕕ( ᐛ )ᕗ

Quote from lil-Inferno
Quote from Dem0n
Yeah, I don't think you're looking at other maps' triggers properly if you think this isn't done in like everything.
You don't even have to look at the triggers, you can just tell by gameplay. Even a map like Temple Siege does this to loop through assimilators.
That is true. If you're ever playing a map and you've selected something, and then it gets deselected but the color appears to remain the same, it's literally this looping thing. Even Legacy of Memes uses it to disable a bunch of buildings in one small area. It's a super common practice.

Post has been edited 1 time(s), last time on Dec 23 2016, 11:41 pm by Dem0n.




Dec 24 2016, 1:54 am sethmachine Post #7



Everyone has only named a single map, Temple Siege.

I guess the more advanced maps aren't played very often on the Abyss / ICCUP.

As a disclaimer, I have been playing UMS since the game came out.

I have never actually seen any units get deselected or change owner for a for-loop counting mechanism in any map. I just know the technique is required for a map like Desert Strike.

Can someone name some other maps which use this technique?



None.

Dec 24 2016, 3:34 am Dem0n Post #8

ᕕ( ᐛ )ᕗ

Quote from sethmachine
Everyone has only named a single map, Temple Siege.
Quote from Dem0n
Even Legacy of Memes uses it to disable a bunch of buildings in one small area. It's a super common practice.
I mean I literally said another map that did it, but keep believing that this is some new thing that you've created.




Dec 24 2016, 7:00 am rockz Post #9

ᴄʜᴇᴇsᴇ ɪᴛ!

Spawning using for loops makes you lose control/lose tracking of the buildings.

For loops will always have a maximum per trigger cycle and can't easily be recreated with binary countoffs.

For loops as you describe aren't simple, and thus aren't used a lot because most content creators weren't particularly competent, and those that were might not be able to create/finish a map that is popular enough to be played over and over again.

Spawning is useless in RPG/hero oriented games, which is what I played a lot of.



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

Dec 24 2016, 8:12 am Lanthanide Post #10



In my later versions of Desert Strike Night I did the spawning in a single trigger cycle, using binary countoffs.

I recall I dabbled with quad countoffs at one point, can't remember if that was an earlier or later version though. That requires more than a single trigger cycle though (64, 16, 4, 1 buildings consumed per cycle). I think the only advantage from that was fewer triggers, which made the map size smaller, but also when you hit the spawn cap, doing it over several cycles would let you spawn a variety of units, instead of spawning all of a couple of types of units and then nothing of others.



None.

Dec 24 2016, 1:50 pm Oh_Man Post #11

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

I use this in my rpg.




Dec 25 2016, 11:48 am Wormer Post #12



Another major problem with this kind of looping is the lag that it produces. Giving many units back and forth during trigger cycle is the straight way to get lag for your map.

The system is sometimes slightly improved through attaching unique locations for factories, but then their total number is quite limited.



Some.

Mar 7 2017, 12:01 pm FlameViper Post #13



Oh wow seriously? I used that method to turn marines into hydras, civillians into chrysalis and kerrigans into infested terrans, among other things. I've seen it everywhere, except maybe not used in the blatant way I used them. It's very useful when coupled with set location A on unit at location B. It's a good thing Blizzard had the decency of adding that second location otherwise a hell lot more map ideas wouldn't have worked out. I remember Siege Dyne and Pirate Dyne doing it. I remember Hero Sanctuary. Diplomacy+Civilization when it needs to convert your old units into new units. When it checks for your farm count. Etc. (I still don't know how Loveless did the weird mutalisk Leviathan thing so effectively)

Damnit. I thought you found a spawning method more reliable and clever. For example how someone found hyper triggers via switches not too long ago.
When I heard dynamic spawns and no more preset spawning I was imagining that you found a way to use all 64 lines of triggers and switch the trigger lines during in-game. Instead of getting a loop from 1,2,3,4,64 we could get 4,24,12,36,16,2,1. Guess I'm stuck to using 64 triggers and a whole lot of death counters, switches and conditions.

Another issue about map making which kills me is that I have to manually set the timer between each spawn and manually start/end it otherwise I accidentally 120 zerglings in 1 second. This makes me waste 2-4 triggers on 1 pathetic basic spawn. Imagine if Blizzard took the time to design an in-built spawn feature which can be customized. Which keeps track of how many units you killed, in what time, custom resources based on kill by location.

We've been stuck with these old crummy designed trigger create functions and kill/resources assigners since 98. I'm still having problems with the kill for resources triggers.
The only thing SC1's editor has it going on is the ability to detect units at locations. Sadly it cannot detect the health and discern between marine A and marine B, but it can detect players at the very least.

I think it's a really overstretching newbie thing to do, it's as head bendingly bad as using 9 air units and forced AI orders to create formations like in We Are Friends. Or getting a science vessel to spawn just 1 inch away from your hero character like in Spellswords. Modifying the editor to include new functions wouldn't be that game breakingly bad. But then again I just wish Blizzard would update the whole engine already and reboot Starcraft 1.



None.

Mar 8 2017, 5:42 am Lanthanide Post #14



Quote from FlameViper
I was imagining that you found a way to use all 64 lines of triggers and switch the trigger lines during in-game. Instead of getting a loop from 1,2,3,4,64 we could get 4,24,12,36,16,2,1. Guess I'm stuck to using 64 triggers and a whole lot of death counters, switches and conditions.
I don't really know what you're trying to say here.

What is the problem you are having, and how have you approached solving it? What does "switch the trigger lines during in-game" mean? Why are you using 64 triggers and a whole lot of death counters, switches and conditions?



None.

Mar 8 2017, 12:20 pm jjf28 Post #15

Cartography Artisan

If you're upset by the number of countoffs and have a few trigger cycles to spare you can use cyclical countoffs or quartic countoffs (I don't have a link but basically you have the triggers owned by the player, a force, and all players so it gets runs 3 times in a row thus you only need triggers for 1, 4, 16, 64, etc). Or if you're crazy like a fox you can combine both :D

Post has been edited 2 time(s), last time on Mar 8 2017, 1:16 pm by jjf28.



TheNitesWhoSay - Clan Aura - github

Reached the top of StarCraft theory crafting 2:12 AM CST, August 2nd, 2014.

Mar 9 2017, 7:29 pm Zoan Post #16

Math + Physics + StarCraft = Zoan

Wont binary or 4-ary countoffs not be useful if you want to move some location to each unit individually, one at a time? It would work for desert strike b/c you only need the number of units you've got and not their location, but if you wanna say transform every marine into jim raynor, you would have to repeat the following:

Move location on marine
Remove 1 marine at location
Create 1 jim raynor at location.

Also what FlameViper is referring to with 64 triggers is the fact that you can only have 64 actions inside one trigger I think.

I have no idea what he means by 1,24,2,36 etc or whatever though.

EDIT nevermind I've thought of it. It would be useful in the following way:

Let Deathcounter == number of marines to be transformed into jim raynor. Then the following triggers would transform exactly Deathcounter amount of marines into jim raynor:

If(
Deathcounter is at least 16,
Command at least 16 marines
)
Then(
Subtract 16 from Deathcounter,

Move location on marine
Remove 1 marine at location
Create 1 jim raynor at location
.
.
.
(Repeat those last 3 lines 15 more times)

Preserve trigger
)

If(
Deathcounter at least 8,
Command at least 8 marines
)
.
.
.
(Same as last trigger but with subtract 8 instead of 16, and copy those same setsof actions only 8 times instead of 16)

.
.
.
Etc.

Post has been edited 3 time(s), last time on Mar 9 2017, 7:51 pm by Zoan.



\:rip\:ooooo\:wob\:ooooo \:angel\: ooooo\:wob\:ooooo\:rip\:

Mar 11 2017, 12:50 am jjf28 Post #17

Cartography Artisan

Even if we are only talking about

Move location on marine
Remove 1 marine at location
Create 1 jim raynor at location.

We can still use the same trick as quartics and have the same trigger run 3 times per involved player per cycle. =)



TheNitesWhoSay - Clan Aura - github

Reached the top of StarCraft theory crafting 2:12 AM CST, August 2nd, 2014.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[03:27 am]
m.0.n.3.y -- Maybe because it's an EUD map?
[03:27 am]
m.0.n.3.y -- Can't upload maps to the DB. Error says "The action you have performed caused an Error". Any word?
[07:46 am]
RIVE -- :wob:
[2024-4-22. : 6:48 pm]
Ultraviolet -- :wob:
[2024-4-21. : 1:32 pm]
Oh_Man -- I will
[2024-4-20. : 11:29 pm]
Zoan -- Oh_Man
Oh_Man shouted: yeah i'm tryin to go through all the greatest hits and get the runs up on youtube so my senile ass can appreciate them more readily
You should do my Delirus map too; it's a little cocky to say but I still think it's actually just a good game lol
[2024-4-20. : 8:20 pm]
Ultraviolet -- Goons were functioning like stalkers, I think a valk was made into a banshee, all sorts of cool shit
[2024-4-20. : 8:20 pm]
Ultraviolet -- Oh wait, no I saw something else. It was more melee style, and guys were doing warpgate shit and morphing lings into banelings (Infested terran graphics)
[2024-4-20. : 8:18 pm]
Ultraviolet -- Oh_Man
Oh_Man shouted: lol SC2 in SC1: https://youtu.be/pChWu_eRQZI
oh ya I saw that when Armo posted it on Discord, pretty crazy
[2024-4-20. : 8:09 pm]
Vrael -- thats less than half of what I thought I'd need, better figure out how to open SCMDraft on windows 11
Please log in to shout.


Members Online: jun3hong