TGB Crowd Test pt. 1
by Brian Wilson · 05/10/2008 (10:58 am) · 11 comments
On the advice of Kevin James from this blog discussion, I've decided to start posting the various toys/tools/PoCs that I create when toying with the Torque engines.
I was an early adoptor of TGB(then T2D) and find myself coming back to it regulary with intent of pulling a game together, but I just have too much fun using it as a toy to make silly concepts come true.
So here it is in all of its Youtube FLV artifact-riddled glory:
www.youtube.com/watch?v=MD3_S1CWlgM
What started out as a quite nice 720p capture of a 1400x768 TGB window got utterly pixelated by its business no matter how many knobs I twisted on my various FLV converts. So I gave up and here's what you have. Enough of the video survived to show the concept at work.

Basically, what I've made is a crowd generator. Each runner is a 5-layer chain of mounted objects that are spawned randomly on the Y-axis off-screen in the -100< land then run toward the Happy Kill Box in the >100 Y-axis land. The following matrices are used in each generation:
- 3 different skin tones
- 2 different shirts with 5 colors each
- 2 different pants with 5 colors each
- 1 set of shoes with 5 colors each
- Height baseline with a +/- 20% modifier
- Width baseline with a +/- 20% modifier
- VelocityX with a +/- 20% modifier
- Y-axis picker
- %this.setLayer(getRandom(5,25)
- sexy streaker probability algorithm
The runners are put together with the stick-figure outline as the parent and the rest of the components are mounted to that with a layer offset, inheritting position, velocity, height offset, width offset.
On my system I can run aproximately 6000 objects (~1250 runners) onscreen and hover at around ~45-55 FPS both in fullscreen at 1600x1050 or windowed at 1400x768. Certainly performance would be better with less background stuff running and a built project without all the editing tools enabled.
Current Issues:
The only real issue I have so far is an obvious clash between 5-layer runners and TGB's 30-layer limit. I may look into a solution later
Moving Forward:
I want to work in the RGBtoHSV and rotateHue resource to give my runners unlimited clothing colors as well as a broad spectrum of skin tones. But fear not, the streaker code remains in tact at all costs!
I also still need to put in widgets for benchmarking, currently I have just setDebugOn(0) bound to a key, but I will put gui controls in for adjusting variables real-time as well as to provide performance and statistical feedback.
Once I've beat this horse to death, I'll post the code either in a blog or as a TDN article.
EDIT: Just to add a couple of Images:
Close-up cross-cut of the scene:

And an exploded view of the 2-5 runner objects, depending on how "free" he wants to be ;p

I was an early adoptor of TGB(then T2D) and find myself coming back to it regulary with intent of pulling a game together, but I just have too much fun using it as a toy to make silly concepts come true.
So here it is in all of its Youtube FLV artifact-riddled glory:
www.youtube.com/watch?v=MD3_S1CWlgM
What started out as a quite nice 720p capture of a 1400x768 TGB window got utterly pixelated by its business no matter how many knobs I twisted on my various FLV converts. So I gave up and here's what you have. Enough of the video survived to show the concept at work.

Basically, what I've made is a crowd generator. Each runner is a 5-layer chain of mounted objects that are spawned randomly on the Y-axis off-screen in the -100< land then run toward the Happy Kill Box in the >100 Y-axis land. The following matrices are used in each generation:
- 3 different skin tones
- 2 different shirts with 5 colors each
- 2 different pants with 5 colors each
- 1 set of shoes with 5 colors each
- Height baseline with a +/- 20% modifier
- Width baseline with a +/- 20% modifier
- VelocityX with a +/- 20% modifier
- Y-axis picker
- %this.setLayer(getRandom(5,25)
- sexy streaker probability algorithm
The runners are put together with the stick-figure outline as the parent and the rest of the components are mounted to that with a layer offset, inheritting position, velocity, height offset, width offset.
On my system I can run aproximately 6000 objects (~1250 runners) onscreen and hover at around ~45-55 FPS both in fullscreen at 1600x1050 or windowed at 1400x768. Certainly performance would be better with less background stuff running and a built project without all the editing tools enabled.
Current Issues:
The only real issue I have so far is an obvious clash between 5-layer runners and TGB's 30-layer limit. I may look into a solution later
Moving Forward:
I want to work in the RGBtoHSV and rotateHue resource to give my runners unlimited clothing colors as well as a broad spectrum of skin tones. But fear not, the streaker code remains in tact at all costs!
I also still need to put in widgets for benchmarking, currently I have just setDebugOn(0) bound to a key, but I will put gui controls in for adjusting variables real-time as well as to provide performance and statistical feedback.
Once I've beat this horse to death, I'll post the code either in a blog or as a TDN article.
EDIT: Just to add a couple of Images:
Close-up cross-cut of the scene:

And an exploded view of the 2-5 runner objects, depending on how "free" he wants to be ;p

#2
I would love to play around with that, too bad i dont have TGB
Awsome music choice in the video too
05/10/2008 (12:17 pm)
"sexy streaker probability algorithm" thats awsome, I would love to play around with that, too bad i dont have TGB
Awsome music choice in the video too
#3
Any chance you would be willing to submit your project to GG so we can use it for performance regressing testing? Would love to have such an object intensive project that we can continue to optimize against, as well as have in our repository for future testing!
05/10/2008 (1:07 pm)
That's pretty awesome :)Any chance you would be willing to submit your project to GG so we can use it for performance regressing testing? Would love to have such an object intensive project that we can continue to optimize against, as well as have in our repository for future testing!
#4
05/10/2008 (4:29 pm)
Awesome, Brian! This idea is even better than I imagined! Good write-up too. ;)
#5
05/10/2008 (4:50 pm)
Loved the Chariots of Fire music on the video!
#6
05/10/2008 (10:47 pm)
Very cool stuff and very cool of you to eventually post the code as a TDN article
#7
The current demo that I show uses only 7 art assets (using 3-5 assets per runner) with 5 hue shifted copies of each clothing item and 3 lightness shifted skins for a total of 29 .png's that generate:
(3 skins)*(2 shirt types *(5 colors+naked))*(2 pant types *(5 colors+naked))*(1 shoe type * (5 colors + naked)) = genating 2592 unique runners. That doesn't include height and width variants, which ups the number to over 4 mil.
Now, once I get the HSV/RGB shifting figured out, the we are talking 10 mil variants without height/wieght variant and over 16 bil with.
Granted a full 360 degree shift in Hue with a +/- 30 degree Lightness generates a healthy variation of clothing color, 10800 colors per article. Plus, if I go that route, technically I can reduce my art asset count to 7 from 29. The skin variation obviously would require a smaller spectrum of HSV shifting to remain skin-like. So +/- 20 Hue, and +/- 50 Lightness for 400 skin tones.
I have guests in from the states for the next two weeks so not sure how much time I can dedicate, but hopefully I can get this wrapped up in that time for release.
I think I'll post the system/code to my GG blog, then follow up with just the crowd generator component as a TDN article with a little more generic purpose for those that just want concepts on how to generate layered objects for game variation.
05/11/2008 (12:42 am)
Thanks for the comments guys. Yeah, I'll post the code when I finish it up. I think the 2 main uses for it will be 1) to dynamically generate visual variants of enemies, so that a swarm of enemies looks much sexier 2) to use the layering system for RPGs to build dynamic players, npcs, and monsters for customization as well as reduce the amount of artwork required to generate uniqueness.The current demo that I show uses only 7 art assets (using 3-5 assets per runner) with 5 hue shifted copies of each clothing item and 3 lightness shifted skins for a total of 29 .png's that generate:
(3 skins)*(2 shirt types *(5 colors+naked))*(2 pant types *(5 colors+naked))*(1 shoe type * (5 colors + naked)) = genating 2592 unique runners. That doesn't include height and width variants, which ups the number to over 4 mil.
Now, once I get the HSV/RGB shifting figured out, the we are talking 10 mil variants without height/wieght variant and over 16 bil with.
Granted a full 360 degree shift in Hue with a +/- 30 degree Lightness generates a healthy variation of clothing color, 10800 colors per article. Plus, if I go that route, technically I can reduce my art asset count to 7 from 29. The skin variation obviously would require a smaller spectrum of HSV shifting to remain skin-like. So +/- 20 Hue, and +/- 50 Lightness for 400 skin tones.
I have guests in from the states for the next two weeks so not sure how much time I can dedicate, but hopefully I can get this wrapped up in that time for release.
I think I'll post the system/code to my GG blog, then follow up with just the crowd generator component as a TDN article with a little more generic purpose for those that just want concepts on how to generate layered objects for game variation.
#8
Hehe, yeah, the music of choice was my wife's idea. I had a different piece in mind, but I'm saving it for the demo for the final release.
05/11/2008 (12:43 am)
@SteveHehe, yeah, the music of choice was my wife's idea. I had a different piece in mind, but I'm saving it for the demo for the final release.
#9
05/11/2008 (12:50 am)
Sheer brilliance. Makes me wish I had TGB.
#10
05/13/2008 (11:00 am)
This is oh-so-cool!
#11
12/07/2008 (10:39 am)
I tried to do the same thing using Torque X, and after 79 sprites they started to disappear! Has someone tried that before? This is killing my game... 
Associate Rene Damm