Building huge crowds: a new tool for demo editors.
This post used to contain the scripts, but I made a new thread with a video tutorial, so go here for the new and improved script, now a lot more user friendly:
http://boards.cityofheroes.com/showthread.php?t=297268
If you use this thing to populate your demo, some attribution in the credits would be nice. "Freaking huge mobs generated by some crazy scripts by Leandro" would work.
www.SaveCOH.com: Calls to Action and Events Calendar
This is what 3700 heroes in a single zone looks like.
Thanks to @EnsonsDeath for the GVE code that made me VIP again!
Very cool stuff. Thank you for sharing. Resources like this may be very important to those of us who wish to keep CoH alive visually in the long term.
Blue
American Steele: 50 BS/Inv
Nightfall: 50 DDD
Sable Slayer: 50 DM/Rgn
Fortune's Shadow: 50 Dark/Psi
WinterStrike: 47 Ice/Dev
Quantum Well: 43 Inv/EM
Twilit Destiny: 43 MA/DA
Red
Shadowslip: 50 DDC
Final Rest: 50 MA/Rgn
Abyssal Frost: 50 Ice/Dark
Golden Ember: 50 SM/FA
Fatal error: Uncaught mysqli_sql_exception: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 's Assassin'' at line 1 in /var/www/vhosts/cityofheroes.dev/forumarchive.cityofheroes.dev/topic.php:262 Stack trace: #0 /var/www/vhosts/cityofheroes.dev/forumarchive.cityofheroes.dev/topic.php(262): mysqli->query() #1 {main} thrown in /var/www/vhosts/cityofheroes.dev/forumarchive.cityofheroes.dev/topic.php on line 262
After I posted that last video with the 3000 heroes, two things became apparent to me. One, placing characters in a straight line looks unnatural and cruddy. Two, it's freaking hard and I never want to do it again.











Thus, I made tools to make it easier and better looking.
My first script takes a demo, locates the player ID, and creates an image out of everywhere he moves. This means I can take my hero to the top of City Hall, start a demo recording, walk around the perimeter, and then I start my script and it draws this:
That's the roof of City Hall. After cleaning up for a few seconds in a graphics editor, I have this:
My second script takes an image like that one, and spawns random entities wherever red is above 64. The density (how close characters will be together) is customizable. After running it, it creates the demo and also this log image:
Each black dot is a spawned player, and the white space around them is the buffer. Here's what the demo looks like, straight out of this second script:
Placing a crowd in such an irregularly-shaped place would be a pain in the neck to do via math-based placement, and it would be horrifically tedious to do manually. But this script did it in seconds. Also, notice the way the characters are facing: each shade of red corresponds to a different facing. This allows you to "paint" areas to spawn characters in, and they'll face towards a place that makes sense.
Now, what happens if you want to spawn them in a place that is not flat, like stairs? This is what my first script generated after walking all over Atlas Park:
The different shades of green are elevation. The brighter the green, the higher the place is. To add the spawning information, just add red to the existing green. So if green = 160, and you want to add red = 111, the final color is r=111,g=160,b=0. Easy! Even easier if you have a graphics program that supports layers: create a new layer, and just paint the red parts in it. Then set the blend mode to Screen.
This is what it looks like after I painted the stairs heading up to City Wall:
The central area I filled in, but since there's no red, nothing will spawn there. After the second script:
And the demo output:
That looks a lot more natural than the crowd I animated on Saturday! But still, it looks off. People usually gather in groups, with some buffer space between them. They are facing all over the place. Some of them are flying. What to do?
Well, noise is the answer:
I added two layers. In one, I added pockets of red noise, and that's the only place where characters will spawn. The noise went from r=64 to r=255, so people would spawn facing different directions.
In the second layer, I added a flat high level of blue=138. The blue channel can be used to make the script do something special to the mobs tagged with it; in this case, they'll be playing the Flight animation. All the pixels that have this level of blue ALSO have a higher level of green; this will make them float slightly higher than the grounded characters.
After the script runs:
And the demo output:
Now that's a nice and natural-looking crowd!
www.SaveCOH.com: Calls to Action and Events Calendar
This is what 3700 heroes in a single zone looks like.
Thanks to @EnsonsDeath for the GVE code that made me VIP again!