Sycronisation in EntHumanPlayer between Server an Client
I want to code a feature that when you hit, you are injured, and you will lost live continuely.
So i add a member variable to EntHumanPlayerT Injured, which is set to true in TakeDamage(), and if in PostDraw(), if true, should display the Text "Injured". But this doesnt work, "Injured" will never be displayed
I think its because, TakeDamage() is called ServerSide, so Injured is just true on ServerSide, and on PostDraw() which is called by ClientSide, its still false
So i add a Injured to EntityStateT, because EntityStateT State of EntHumanPlayer because i think this is send from Server to Client,
and change in TakeDamage State.Injured, and in PostDraw i display "Injured" when State.Injured is true
But Now, "Injured" is displayed when i run, and isnt displayed when I stand. I dont understand this
So i add a member variable to EntHumanPlayerT Injured, which is set to true in TakeDamage(), and if in PostDraw(), if true, should display the Text "Injured". But this doesnt work, "Injured" will never be displayed
I think its because, TakeDamage() is called ServerSide, so Injured is just true on ServerSide, and on PostDraw() which is called by ClientSide, its still false
So i add a Injured to EntityStateT, because EntityStateT State of EntHumanPlayer because i think this is send from Server to Client,
and change in TakeDamage State.Injured, and in PostDraw i display "Injured" when State.Injured is true
But Now, "Injured" is displayed when i run, and isnt displayed when I stand. I dont understand this
Hmm, i think it was because i wrote Injured between to other Var in EntityStateT and not as last Var, so there were some complications with the Constructor and Copy Constructor
I put Injured as last Var in EntityStateT (after Events), but now, Ca3D returns a error.
So, it isnt possible to change EntityStateT, is it ??
So does anybody know a other solution to my problem with Injured ??
I put Injured as last Var in EntityStateT (after Events), but now, Ca3D returns a error.
So, it isnt possible to change EntityStateT, is it ??
So does anybody know a other solution to my problem with Injured ??
Please don't. Here is the quote from GameDLL.hpp:TheMatrix wrote:I tested it again: Ca3D returns a error when you change EntityStateT
Code: Select all
/********************************************************************************/
/*** This is the single interface through which the engine accesses the game. ***/
/*** It must be implemented by the game dll >> AND MUST NOT BE MODIFIED << ! ***/
/********************************************************************************/
Yes, this is actually pretty easy: Simply mis-use one of the existing, but unused vars in EntityState, like for example HaveAmmo[7] (see Constants_AmmoSlots.hpp), or HaveAmmoInWeapons[13] (see Constants_WeaponSlots.hpp).So is there a other way to set vars that are syncronized between Server an Client ??
For improved convenience, you may e.g. define a reference:
Code: Select all
unsigned short& MyState=HaveAmmo[7];
Please do also read the big chuck of comment near the definition of EntHumanPlayerT::Think().
Well, yes, if the dependency statements in the makefiles fail to update something properly, it is always a good idea to refer to an occasionalI had to delete all .obj and recompile the code to get Ca3D starting
wmake -h clean
Hope that helps.
Best regards,
Carsten
Carsten
Who is online
Users browsing this forum: No registered users and 107 guests