Get SendProp instance

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
InvisibleSoldiers
Senior Member
Posts: 114
Joined: Fri Mar 15, 2019 6:08 am

Get SendProp instance

Postby InvisibleSoldiers » Tue Jan 14, 2020 9:11 pm

How to get SendProp instance of specific property of entity.
For example, I want to retrieve m_vecBaseVelocity property to stop the data table warnings:

Syntax: Select all

DataTable warning: player: Out-of-range value (2000.000000/1000.000000) in SendPropFloat 'm_vecBaseVelocity', clamping.
DataTable warning: player: Out-of-range value (2000.000000/1000.000000) in SendPropFloat 'm_vecBaseVelocity', clamping.
DataTable warning: player: Out-of-range value (2000.000000/1000.000000) in SendPropFloat 'm_vecBaseVelocity', clamping.
DataTable warning: player: Out-of-range value (2000.000000/1000.000000) in SendPropFloat 'm_vecBaseVelocity', clamping.
DataTable warning: player: Out-of-range value (2000.000000/1000.000000) in SendPropFloat 'm_vecBaseVelocity', clamping.
DataTable warning: player: Out-of-range value (2000.000000/1000.000000) in SendPropFloat 'm_vecBaseVelocity', clamping

I hope I can achieve this by changing property flag bit or by changing the max available value:

Syntax: Select all

if(!(pProp->GetFlags() & SPROP_ROUNDUP))
{
DataTable_Warning("(class %s): Out-of-range value (%f) in SendPropFloat '%s', clamping.\n", GetObjectClassName( objectID ), fVal, pProp->m_pVarName );
}
User avatar
L'In20Cible
Project Leader
Posts: 1335
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Get SendProp instance

Postby L'In20Cible » Tue Jan 14, 2020 10:14 pm

User avatar
InvisibleSoldiers
Senior Member
Posts: 114
Joined: Fri Mar 15, 2019 6:08 am

Re: Get SendProp instance

Postby InvisibleSoldiers » Tue Jan 14, 2020 10:28 pm


No, I really want to change the max available value, because the output is secondary, I don't want to cap velocity to 1000 in 1 tick.
In CS:GO there are sv_clamp_unsafe_velocities, but other source engine games dont' have it.
User avatar
Ayuto
Project Leader
Posts: 2094
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Get SendProp instance

Postby Ayuto » Tue Jan 14, 2020 11:27 pm

That's a little bit contrary to what you wanted to achieve in your initial post. It says you want to stop data table warnings and your code example shows only the part that sends the warning :confused:
I sometimes feel you are changing your mind just because L'In20Cible answered your post. It's just a feeling, but I hope this isn't the case and I'm sorry if I'm wrong.

Regarding to your new question:
The properties you want to change are m_fLowValue and m_fHighValue. However, we only exposed them as read-only, so you aren't able able to change them, even if you retrieved the SendProp instance:
https://github.com/Source-Python-Dev-Te ... p.cpp#L127

I bet this has a reason, but if you still want to try your luck, you can use memory.get_object_pointer(<send_prop>).set_float(<new value>, <offset to m_fHighValue>).
To find the correct SendProp instance our dump code might help you to find the answer on your own:
https://github.com/Source-Python-Dev-Te ... ps.py#L219
User avatar
InvisibleSoldiers
Senior Member
Posts: 114
Joined: Fri Mar 15, 2019 6:08 am

Re: Get SendProp instance

Postby InvisibleSoldiers » Tue Jan 14, 2020 11:36 pm

Ayuto wrote:That's a little bit contrary to what you wanted to achieve in your initial post. It says you want to stop data table warnings and your code example shows only the part that sends the warning :confused:
I sometimes feel you are changing your mind just because L'In20Cible answered your post. It's just a feeling, but I hope this isn't the case and I'm sorry if I'm wrong.

I realized after 30 minutes that not only this output is important. More important to remove the limit. Even if so, anyway it makes no sense to filter the output every time when I can just remove it in native way.
Maybe I can just set the flag to 0

Syntax: Select all

#define SPROP_ROUNDDOWN			(1<<3)	// For floating point, limit high value to range minus one bit unit

#define SPROP_ROUNDUP (1<<4) // For floating point, limit low value to range minus one bit unit

But I don't know how to get the SendProp instance.
User avatar
L'In20Cible
Project Leader
Posts: 1335
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Get SendProp instance

Postby L'In20Cible » Wed Jan 15, 2020 6:27 am

Ayuto wrote:That's a little bit contrary to what you wanted to achieve in your initial post. It says you want to stop data table warnings and your code example shows only the part that sends the warning :confused:
I sometimes feel you are changing your mind just because L'In20Cible answered your post. It's just a feeling, but I hope this isn't the case and I'm sorry if I'm wrong.

Either that, or we are witnessing a XY Problem thread here. :tongue:

Ayuto wrote:Regarding to your new question:
The properties you want to change are m_fLowValue and m_fHighValue. However, we only exposed them as read-only, so you aren't able able to change them, even if you retrieved the SendProp instance:
https://github.com/Source-Python-Dev-Te ... p.cpp#L127

I bet this has a reason, but if you still want to try your luck, you can use memory.get_object_pointer(<send_prop>).set_float(<new value>, <offset to m_fHighValue>).
To find the correct SendProp instance our dump code might help you to find the answer on your own:
https://github.com/Source-Python-Dev-Te ... ps.py#L219


The main reason why they were exported as read-only is because they really should not be messed with. I mean, since we can't control the way they are decoded by the receiving end, the only thing that will happens if they are modified server-side is de-sync the clients by under/overflowing them with an invalid buffer.

InvisibleSoldiers wrote:
Ayuto wrote:That's a little bit contrary to what you wanted to achieve in your initial post. It says you want to stop data table warnings and your code example shows only the part that sends the warning :confused:
I sometimes feel you are changing your mind just because L'In20Cible answered your post. It's just a feeling, but I hope this isn't the case and I'm sorry if I'm wrong.

I realized after 30 minutes that not only this output is important. More important to remove the limit. Even if so, anyway it makes no sense to filter the output every time when I can just remove it in native way.
Maybe I can just set the flag to 0

Syntax: Select all

#define SPROP_ROUNDDOWN			(1<<3)	// For floating point, limit high value to range minus one bit unit

#define SPROP_ROUNDUP (1<<4) // For floating point, limit low value to range minus one bit unit

But I don't know how to get the SendProp instance.

While I'm not entirely sure what problem you are trying to solve, what you think would fix it would not achieve what you think it would. Changing the SendProp will only change the way the properties are encoded while being networked to the clients. The values themselves remains unchanged server-side, and the variable you mentioned above is only available on CS:GO because it controls aspects of the physics engine that are specific to that game. Removing the warning is the only thing you can do something about from the server, because as stated above, you can't control how the clients will decode the data you sent them and in best case they will clamp it themselves and complain about, and in worst this is undefined.
User avatar
InvisibleSoldiers
Senior Member
Posts: 114
Joined: Fri Mar 15, 2019 6:08 am

Re: Get SendProp instance

Postby InvisibleSoldiers » Wed Jan 15, 2020 11:43 pm

If mapper planned to give >1000 velocity from trigger_push or any entity in 1 tick, that's where it comes, It clamping to 1000. So no good. And what's the difference to the client? Yes, maybe he will get some kind of densynchronization, in principle, so with every booster, trigger_push isn't predicted on a client. Need to see for yourself. Just tell me how to get this object, please.
User avatar
L'In20Cible
Project Leader
Posts: 1335
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Get SendProp instance

Postby L'In20Cible » Thu Jan 16, 2020 12:14 am

InvisibleSoldiers wrote:If mapper planned to give >1000 velocity from trigger_push or any entity in 1 tick, that's where it comes, It clamping to 1000. So no good. And what's the difference to the client? Yes, maybe he will get some kind of densynchronization, in principle, so with every booster, trigger_push isn't predicted on a client. Need to see for yourself.

No, it is not clamped to 1000. The only clamps that happens server-side are if the impulse emission time is too high to handle by the physics engine, or if an axis exceed the value of sv_maxvelocity. Changing the way properties are networked won't change anything except de-syncing the clients and breaks the networking serialization.

InvisibleSoldiers wrote:Just tell me how to get this object, please.


Ayuto already linked you an example:
Ayuto wrote:To find the correct SendProp instance our dump code might help you to find the answer on your own:
https://github.com/Source-Python-Dev-Te ... ps.py#L219

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 3 guests