1

Topic: [Help] Grenade Curvature

Yoo homies.
Got a problem.
I'm working on a mod with classes and one mod should be able to fire off rockets instead of grenades (with the grenade launcher).
The problem is the Curvature.
It explodes at the correct position but.. The grenade flys (even trough collisions).
Now.. When i change the tuning param (grenade_curvature) to 0, everything is fine. But for every player the curvature is 0.
I only want it for THAT player big_smile

Demo shows it:
http://up-the-file.de/?site=getfilektd8fRXT2X

I just changed the projectile.cpp (GetPos Function):
http://pastebin.com/0cSUuaST

Hope you can help me,
thanks

2 (edited by KillaBilla 2012-02-19 20:32:40)

Re: [Help] Grenade Curvature

You can't do this, because of client prediction.

EDIT: Copy the projectile.cpp and projectile.h and change them to something like rocket. Then implement your own function to move the rocket. Change the snap function so that the rocket has no speed and a start tick of servers tick - 1. Then the client will render the grenade at the right position. This does not work if the ping is high, because then the prediction will start again.

3

Re: [Help] Grenade Curvature

Okay.. Im not so far to understand what ya meant with entity class (an own "projectile"? would require an client modification, not?)

4

Re: [Help] Grenade Curvature

powachill4 wrote:

Okay.. Im not so far to understand what ya meant with entity class (an own "projectile"? would require an client modification, not?)

Sorry first post got somehow cut, what I wanted to say was:
Copy the projectile.cpp and projectile.h and change them to something like rocket. Then implement your own function to move the rocket. Change the snap function so that the rocket has no speed and a start tick of servers tick - 1. Then the client will render the grenade at the right position. This does not work if the ping is high, because then the prediction will start again.

5

Re: [Help] Grenade Curvature

ok thanks bro. big_smile
but.. at there:

pProj->m_Type = m_Type;

wouldnt the client think "Its a grenade, let it fly like a grenade".
what should i say as m_Type?
And.. with an own function to move the rockets, you hopefully meant the GetPos() function and not CalcPos().
AND...

pProj->m_X = (int)m_Pos.x;
pProj->m_Y = (int)m_Pos.y;
pProj->m_VelX = (int)(m_Direction.x*100.0f);
pProj->m_VelY = (int)(m_Direction.y*100.0f);
pProj->m_StartTick = m_StartTick;

I guess i should cut it down only to m_X and m_Y because the client dont need m_Direction / start tick, eh? only for the grenade to calc the pos itself. or am i wrong here?

6 (edited by KillaBilla 2012-02-20 20:41:44)

Re: [Help] Grenade Curvature

powachill4 wrote:

ok thanks bro. big_smile
but.. at there:

pProj->m_Type = m_Type;

wouldnt the client think "Its a grenade, let it fly like a grenade".
what should i say as m_Type?
And.. with an own function to move the rockets, you hopefully meant the GetPos() function and not CalcPos().
AND...

pProj->m_X = (int)m_Pos.x;
pProj->m_Y = (int)m_Pos.y;
pProj->m_VelX = (int)(m_Direction.x*100.0f);
pProj->m_VelY = (int)(m_Direction.y*100.0f);
pProj->m_StartTick = m_StartTick;

I guess i should cut it down only to m_X and m_Y because the client dont need m_Direction / start tick, eh? only for the grenade to calc the pos itself. or am i wrong here?

pProj->m_Type should be grenade so that the client knows how to render the projectile.
pProj->m_X = (int)m_Pos.x;
pProj->m_Y = (int)m_Pos.y;
pProj->m_VelX = 0;
pProj->m_VelY = 0;
pProj->m_StartTick should be the current servertick - 1, so that the grenade starts again every tick

In the tick function implement some function to move the projectile, e.g.:
pos.x++;

7

Re: [Help] Grenade Curvature

Ok killabilla, i understood.
Can you tell me where the CalcPos() Function is located at?
I cant find it.

8 (edited by KillaBilla 2012-02-20 21:42:29)

Re: [Help] Grenade Curvature

powachill4 wrote:

Ok killabilla, i understood.
Can you tell me where the CalcPos() Function is located at?
I cant find it.

src/game/gamecore.h
But you should not change anything in gamecore.cpp and gamecore.h, because it would change the netversion.

9

Re: [Help] Grenade Curvature

Yes, it already changed the netversion because i had to extend the name bytes by 32 more bytes. (took me into datasrc lol).
But well, i can just change it aswell and make a verification packet for the client "are you a longer-name-client" XD so far thnx

10

Re: [Help] Grenade Curvature

But they did it somehow on TeeBall servers right? Im very curious how big_smile

C++/Java my life ^^
If you like dislike button click it
NOW!