Triggering rules only when on screen
I'm working on a game with everything on a single scene that the camera pans across so I don't have to load multiple scenes. However this means I will have a few hundred actors and their rules all triggering even when the user can't see them, and I suspect that's not ideal for performance.
I have been thinking about ways to trigger these rules so they're only firing when the camera is on them. My simple solution would be to have a non-scrollable actor constrained to the camera position, and every actor have a collision rule with actor.
However that means having hundreds of collision rules in the game. My question is whether that would be worse for performance than just leaving them all running? Or if these is a better solution than my somewhat clunky one.
Comments
You could use an rule (in an actor that is on the scene) that stores a number corresponding to a camera position in an integer attribute and name the integer camPosition. Then in all actors put all the code in a new rule and say when camPosition is [number of the cam position the actor is on]
Lump Apps and My Assets
Single scenes are not a good idea. The reason is ram gets freed up during scene changes. I do not advise doing a big single scene for large games. You're going to have issues in the end.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
@LumpApps thanks, that's a good shout
@Lost_Oasis_Games the problem is, the game doesn't really work across multiple scenes. It's a single level that just happens to be long. I guess I could do a reset of the scene on a fail - would that reset the ram?
Yes it would.
Lump Apps and My Assets
Yep that would flush ram.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS