playMaker

Author Topic: Does it cost perfomance to have tons of objects waiting for a trigger event?  (Read 984 times)

Snowbird

  • Playmaker Newbie
  • *
  • Posts: 25
Lets say I allow many of the assets in my game to be able to be set on fire.

This would mean that all of them are sitting around waiting for a trigger event 2d. Does it cost perfomance for them to sit there and wait?

I'm not talking about the actual collision—just the sitting and waiting part.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Hi,

 yes, that's fine. usually you also couple that with a check if the object is in view of the camera or based on a distance ( square distance, it's better for perfs) from the player.

so if you have a mile long level, it doesn't make sense to have all your coins active, they should be active only when visible to the camera for example. you can do that in chunck by splitting your level in smaller parts and load the coins for the current parts. and disable all the others.

but that kind of optimization can be done later, make sure your system works, profile it and if you find some culltrip, then optimize, don't try to optimize first, though your question is perfectly valid and you should keep an eye on it.

Bye,

 Jean

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Hi.
you might be able to do it the other way around. instead of the assets have trigger events.

have the 'flame' handle it.

a quick sample :

Flame hits object.
Store the object, then send a event to the object to do what it should do.