RTS visualization and updating

Hello!

I have kinda common problem for a RTS game. Player can usually only see his own base or some part of a map. What would be the best way to implement updating of all entities on a map (their position, rotation, etc…) but only showing those, which are close to a player. First I though about setting cull hint on far away entities to CullHint.Always, but found out that you can still pick those, even if they are invisible. Ok, picking could be filtered, but still, when you have for example network game, how would someone implement such distance filtering?

If you plan it to be networked, consider doing it properly from very beginning and just do not have invisible objects on client at all. Server should not send the information about the stuff client cannot see. This way you avoid basic cheats at least.



Now, you probably want to have some extra logic on the client anyway - server will be doing coarse-grained checks, you may want to be bit more exact (for visual reasons) on client side. Easiest way is probably to just remove the models you don’t want to show from scenegraph completely. It is not really heavy operation (you won’t be flickering in and out hundreds of objects each frame after all). Just store the constructed nodes somewhere, so they can be reattached when needed, without reconstructing all the geometries etc.

Another little question. If I have for example some AppState, that just updates logic of its rootNode, which isn’t visible anywhere. Is it enough to just call updateGeometricState() on it to update entities attached to it?

You should call updateLogicalState and updateGeometricState on every frame for every root node that you did not get from SimpleApplication