Page 1 of 1

Copy of player object

Posted: Sat Dec 26, 2015 8:51 pm
by roflmuffin
Hi again,

I need to be able to access the player object as at a previous frame in the engine. I assume something like this is not possible as the python bindings simply communicate with the server (which I cannot 'cache' so to speak).

Would my best bet just be to create another class that has a constructor which I pass a player object to, it runs the methods that will return the data I will eventually need and use that sort of like a cached last-frame version of the player?

Posted: Sat Dec 26, 2015 9:36 pm
by L'In20Cible
Well, almost all of the values are retrieved dynamically which means that even if you cache an object, all the values will remains the same as the engine. To be honnest, I'm not sure why you would ever need to access an object representing a player that... doesn't exist... What are you trying to do?

Posted: Sat Dec 26, 2015 9:42 pm
by roflmuffin
I would like to know their eye angles/location, velocity & buttons to get information like turning direction. Basically to see if players just changed pressing buttons. But it looks like I will have to go with the approach I mentioned.

Posted: Sat Dec 26, 2015 9:44 pm
by satoon101
Did you already forget this thread?
http://forums.sourcepython.com/showthread.php?1026

Posted: Sat Dec 26, 2015 9:52 pm
by L'In20Cible
Then yes, you will have to cache the values of the data you need yourself.

Posted: Sat Dec 26, 2015 9:54 pm
by satoon101
Just use a simple dictionary to do so. Check against the stored angle/location with the current values on the next frame, then update the stored values with the new ones before moving on.

Posted: Sat Dec 26, 2015 9:59 pm
by roflmuffin
satoon101 wrote:Did you already forget this thread?
http://forums.sourcepython.com/showthread.php?1026


I think its technically a different issue?

satoon101 wrote:Just use a simple dictionary to do so. Check against the stored angle/location with the current values on the next frame, then update the stored values with the new ones before moving on.


Yes, that is what I was planning, just wanted to check if there was a more encompassing solution before going ahead with it. Thanks for the info.