Game Development Community

Projectile render on client

by Howard Dortch · in Torque Game Engine · 11/30/2006 (2:56 pm) · 8 replies

I have a slow moving projectile that gets deleted on the client before impact.
I can set the arming delay and force the projectile to bounce and call an onCollisoin method but thats so ugly.


In Projectile.cc ProcessTick function I see this note:
It is possible that the server
// will have registered a collision while the client prediction has not. If this
// happens the client will be corrected in the next packet update.

Anyone know a trick here to force the visual of the collision on the client side?

#1
12/05/2006 (7:28 am)
Bump, anyone ?
#2
12/05/2006 (7:32 am)
I don't know how to answer your question, but i know there IS allot of PROJECTILE information here on the site. Try the search function in the upper left corner.
#3
12/05/2006 (8:06 am)
@ Howard:

Quote:
It is possible that the server
// will have registered a collision while the client prediction has not. If this
// happens the client will be corrected in the next packet update.

Absolutely.

It means that the server has predicted that a collision will occur with the projectile before the client. In fact I'd wager a guess that this happens quite often. The server stays 1 tick ahead of the client and the client interpolates to that the tick information sent from the server.

Is your projectile rather small?

If you look carefully at the projectile collision code, it checks for collision by doing a ray cast from the position of the object, as in, the middle of your shape and the predicted position by mutiplying the velocity by the tick length.

So if it's small and moving fast enough, the ray cast may "reach" too far ahead away from the center/position of your object and register a collision before you think it should.

Also note that onCollision and onExplode is only called on the server after the server has predicted a collision/explosion occurs.

- Eric
#4
12/05/2006 (8:44 am)
But as i mention if you look around, someone have already solved your arming delay problem. I just can not recall where it was i read about it at this hour. I will get back to it in a few hours time. It rings in my mind it could have been a grenade enhancement for the projectiles... You basically want the thing to stay LIVE until it hits something.
#5
12/05/2006 (9:56 am)
@caylo yeah...

@Eric the projectile is large as in a missile.
I get how the whole thing works, casting ray predictions etc, my question is there any way to force the collision to happen on the client side ? Or at least force the visual of the collision on the client. like scopeAlways or some magic word/setting/chant thing I dont see. I can probably hack the engine to do it but figured that would be something already in there.
#6
12/05/2006 (11:54 am)
@Howard:

No there's no "magic function" call or anything like that. I'd be more interested in trying to understand exactly what was going wrong than trying to write a hack around it - which you most definitely could.

A simple hack would be to wait a single tick before the onCollision and explode methods are called.

But it wouldn't recommend it.

And like Caylo said, as always you might want to search around a bit to see if there's the slightest inkling that someone else has had/solved your problem.

- Eric
#7
12/05/2006 (4:15 pm)
I have searched all over and no mention of this problem that I can find or nothing useful.

Ok, I have a host computer, the player on the host fires a missile at a client player over a LAN. The player on the host computer sees the missile strike a wall behind the client player.
The client player using a different computer on the LAN sees the missile come toward him/her then about 100 meters away the graphic disapears and the explosion happens on the wall.
I know why this happens I dont want it to happen. I want the player on the client computer to see the missile all the way to impact.
Is that more clear and to the point?

So the engine in it's present state is not capable or there is a magic switch or I hack it to make it work properly. It's a client side event and shouldn't affect game play or server it's just ugly visual.
#8
12/27/2006 (7:52 pm)
Bump anyone else want to respond here?