Making a projectile that isn't ghosted
by Andreas Heldt · in Torque Game Engine · 12/02/2005 (9:16 am) · 5 replies
Hi there,
I tried to make a projectile type (derived from the class Projectile), that just flyes straight forward
and therefore doesn't need any updates after it was spawned.
But I can't get the projectile class stop sending updates! I tried setting the
net update priority to zero by the getNetUpdatePrio method but then
it's not showing up anymore...
If you could help it would be very nice, because I'm spawning alot of these projectiles
a second and there might be 100 in parallel, but they don't need to be updated anymore
after their spawn!
I tried to make a projectile type (derived from the class Projectile), that just flyes straight forward
and therefore doesn't need any updates after it was spawned.
But I can't get the projectile class stop sending updates! I tried setting the
net update priority to zero by the getNetUpdatePrio method but then
it's not showing up anymore...
If you could help it would be very nice, because I'm spawning alot of these projectiles
a second and there might be 100 in parallel, but they don't need to be updated anymore
after their spawn!
#2
An position updates aren't needed because the projectile flys in one direction with a defined speed. So the client can really easy predict where the bullet will go.
If I clear the ghostable flag, won't then the object be spawned on the client?
I want to use these "bullets" for fast-firing, high-speed weapons like lasers and machine guns for a space sim.
Take a look at the game "Yager", then you will get an impression of what I am intended to do.
12/02/2005 (12:00 pm)
I think its totally unreliable whether they collide or not on the client. If they collide on the client, a nice effect is spawned and not more. But the server will do damage to the hit object.An position updates aren't needed because the projectile flys in one direction with a defined speed. So the client can really easy predict where the bullet will go.
If I clear the ghostable flag, won't then the object be spawned on the client?
I want to use these "bullets" for fast-firing, high-speed weapons like lasers and machine guns for a space sim.
Take a look at the game "Yager", then you will get an impression of what I am intended to do.
#3
12/02/2005 (12:29 pm)
You can't not update positions if you actually want some movement on the object. The projectiles aren't doing much more than raycasting between previous and current points, which is still what youl'd have to do no matter what as far as I can think. Giving them a very high speed and a very short lifespan should keep them from cloggin up the server too much, I even did code to make the particle trails render at _any_ speed. If you don't mind instantaneous checks though, youl'd be better off just using raycasts for your weapons, I use that with a scaled .dts for lasers. I'm also considering using them for my game which will have a lot of bullets in relatively short distances, so youl'd never notice.
#4
I even thought about making a second object which is just an effect, like the explosion object, and let it being created by an netEvent.
But I don't know how much bandwidth this would take up per shot..
12/02/2005 (12:42 pm)
Uhm.. at a fireing rate at 50 rounds/sec and a lifetime at least of 4 seconds it will have at full-fire 200 projectiles active in one moment...I even thought about making a second object which is just an effect, like the explosion object, and let it being created by an netEvent.
But I don't know how much bandwidth this would take up per shot..
#5
12/02/2005 (12:49 pm)
I'd always assumed torque implemented dead-reckoning for velocity and position of some objects. like bullets.
Torque 3D Owner Stephen Zepp
mNetFlags.clear(Ghostable | ScopeAlways);
Unfortunately however, they actually do need to be sending updates--every time the position changes, you need to send a position update, or the client(s) won't ever know that the projectile has moved. Either that, or have client side interpolation of the movement, but then if they collide with something, or deconstruct, the client(s) won't know about it.