elidupree/Lasercake — Issue #5: Optimize mobile objects by making them go 'inactive'
Author: elidupree
Created: 2011-12-31 12:49:14+00:00
State: open

Figuring out when an object is okay to be inactive is not *entirely* simple. "Zero velocity" is a good start, but an object can also have zero velocity while at the top of an arc through the air, for instance. "Unchanging velocity" is silly because velocity always changes due to gravity

Something like "has zero velocity at the end of the frame because its gravity movement was blocked by something" would be good. Then it needs to get reactivated whenever the something stops blocking it.

Two approaches to reactivation:

1) reactivate everything nearby whenever something changes
----- pros: it's a catchall; I wouldn't have to code a separate system for each type of deactivation.
----- cons: that pro is only there if I'm really thorough about what counts as "something changes", and could waste processing if lots of minor changes happen. And it relies on a lot of assumptions about what "nearby" is, too.

2) have the blocking tile remember that it was blocking this object (unordered_multimap supporting_relationships, in world?)
----- pros: only recompute exactly when you have to; and when something starts moving, you don't have to look around to *find* things it should reactivate, just look it up in the map
----- cons: possibly confusing complication, and this would be in addition to every other nearby-tiles-reactivation system

I think I favor (2).