Using Game Engine to Demonstrate Exponential Change

Working on a project utilizing the physics engine. I’ve got a large number of spheres (Sphere(s) A) that drop into a box. One sphere (Sphere B) is then dropped into the box. Any sphere A that is touched by sphere B changes to the color of sphere B, i.e. green to red (sphere C). I’ve got that part down. I’m trying to get any sphere C to pass that color on to sphere(s) A that haven’t been touched by Sphere B. Ideally the color change would cascade from 4 or 5 spheres all through the 100 or so I have in the box.

I don’t have a real strong python background and so the first part I’ve managed through logic bricks, but I think I’m going to need python to tell sphere A to not change if touching another sphere A, but to change when touched by Sphere C.

Major problem for me seems to be creating a unique property/identity for sphere C that is only activated by touching Sphere B first. but that can then propogate outward.

Any suggestions? Even just pointing me in the right direction would help.

Stephen

Sounds easy to do, but unfortunately it’s just a little complex for words alone!
Could you rig up a flow chart / other visual concept? It doesn’t have to look good, MS paint is fine
Try out gliffy and print screen it in demo mode

Here’s a quick diagram. Basic idea is to pass a color from Sphere B to Sphere(s) A. Sphere A touching Sphere A won’t set off the color change. Sphere B touching sphere A will cause a color change. Sphere C touching Sphere A will cause a color change. Should be a matter of passing properties around to play the color change IPO I’ve set. I can change A to C, I just can’t figure out how to tell Sphere A to pass on the fact that it’s changed to C and therefore the sphere(s) touching it should then change.

I made a .blend example of the system you describe (attached).

Just press space to drop red sphere.

However, I think a swarm of nanobots, capable of asexual reproduction, would make for a better example.

Attachments

propagation.blend (600 KB)

Thanks Goran. That’s a rather elegant solution. I hadn’t thought of the replace object actuator. I think that will work perfectly with my project.

I tweaked the actuator concept Goran gave me just a bit to better fit my overall needs. Here’s an example of what I’m working on. It’s different than the concept I floated, but it was a test to see if the propogation works.

Green Sphere is Static. Blocks have phyics enabled. Added Spheres have physics enabled.

Press “P” to start. Up arrow moves forward.

Completely different from my project I see some sort of small tag game here. Green sphere is it, purple boxes try to avoid getting tagged. Once tagged the purple boxes join the “it” group. Could be fun with multiplayer. Not sure how to manage that yet.

Thanks,

Stephen

PROPAGATION2.blend (772 KB)