Hi,
I'm currently trying TNet on a small prototype project I'm coding, a small multiplayer space shooter game. As the spaceships in my game can have some quite big shooting rates, I was wondering what's the best way to handle many "laser shots" per second.
I first tried the naive approach with TNManager.create from the player's starship control script, creating a laserShot prefab on the correct position/rotation. This TNObject is then moved locally by each player at a constant speed (so I don't need to sync position after initial creation), I check collisions with a raycast and I only apply damage to an enemy ship (via a RFC on the hit ship) if the laserShot "isMine" so the shot's result is always consistent. I only call RFC on this object when a new player is connecting so he can see the shots created before his arrival at the correct position. This seemed quite "elegant" to me but I have a small problem with this:
It seems that when I have a quite important ping (tried on an amazon ec2 server with 250ms ping) on the server that the TNManager.create is a little laggy and I can see that my ship's firing rate is not constant nor as fast as when I'm playing solo.
I tried to implement some pool system, with each player creating a pool of laserShots when connecting via a RCC call that adds the newly created laserShot in a pool, but it takes quite a long time and it "floods" the server with create calls each time a new player is connecting. And I suppose that having a lot of "pre-created" TNObject isn't that good performance-wise as there will be a lot of calls to OnNetworkPlayerJoin callback each time a new player connect with properties synchronisation (activated or not, position, rotation...).
Do any of you have any tips on how to handle this problem ?
Thanks !!!