Projectiles and prediction

MOOtantMOOtant Join Date: 2010-06-25 Member: 72158Members
edited February 2012 in NS2 General Discussion
Are projectiles predicted at all in NS2? From what I've seen in Projectile, Projectile_Client and Projectile_Server it seems that only server moves objects around. Is that true? That seems very unlikely because that'd be incredibly stupid way to structure things - that many networked ents going through the wire practically kill any server there is.

I can't see any place that'd update ent on client though I didn't read much.

My mod had networked missiles stolen from HL2 rocket launcher and 20 slots server practically died after firing just a few rockets per per person each seconds. After moving to predicted missiles that send starting conditions and nothing else we were able to host 60 slot servers with lots of tanks and rockets and have tickrate around 33. My dumb missiles aren't inheriting CBaseEntity (in NS2 case I think it's ScriptActor), that'd be retarded.


  • playerplayer Join Date: 2010-09-12 Member: 73982Members
    edited February 2012
    Aren't rockets\missiles rather straightforward deterministic (given that they don't curve), hardly an issue to move it into prediction. Projectiles (grenades\physics-objects in general) on the other hand, can differentiate a lot per unit of time, so at least some kind of server-client synchronization would have to occur intermittently. For something like the gorge-spit though (which is essentially a rocket), it would of course be silly to constantly network.
  • matsomatso Master of Patches Join Date: 2002-11-05 Member: 7000Members, Forum Moderators, NS2 Developer, Constellation, NS2 Playtester, Squad Five Blue, Squad Five Silver, Squad Five Gold, Reinforced - Shadow, NS2 Community Developer
    Projectiles are predicted; you create physics body, set the speed, direction and gravity, and register for a callback on hit. No network traffic. See Projectile.lua
  • MOOtantMOOtant Join Date: 2010-06-25 Member: 72158Members
    Then tell me how do you know what net vars are sent or at least checked on server. I don't see any SendPropExclude equivalent.
  • playerplayer Join Date: 2010-09-12 Member: 73982Members
    I do believe most of the physics is hidden inside the engine, therefor the actual math\code involving those physics is not present in the Lua-script, nor are the networked-variables that are communicated between server and client. So strictly looking at the script it may appear it is predicted nor networked, while in fact the engine probably does both, so the question remains how much networking the engine does for these physics-objects. Same story with sounds and effects, they are not exposed to the Lua-script (at a low level anyway, besides invocation and settings), so we haven't a lot of information about what goes on there, and how much network-data they constitute.
  • YuukiYuuki Join Date: 2010-11-20 Member: 75079Members
    I don't know for projectiles but for players almost everything is done in lua, in ControllerMixin:PerformMovement or GroundMoveMixin:UpdateMove. It's just the collision detection part you can't get.
Sign In or Register to comment.