Drakath Posted February 23, 2015 Share Posted February 23, 2015 I made a really awesome script but it uses processLineOfSight onClientRender and I have just read that processLineOfSight can have a bad impact on user's performance. Is it really that bad and is it worth removing a feature because of this? Link to comment
vx89 Posted February 23, 2015 Share Posted February 23, 2015 Suggested alternative isLineOfSightClear is not enough? Link to comment
Drakath Posted February 23, 2015 Author Share Posted February 23, 2015 Apparently, it's not. I need the exact position where the ray hits. Link to comment
Bonsai Posted February 23, 2015 Share Posted February 23, 2015 I'm not sure if timers are better, but that way you could limit it to X times per second, instead of depending on fps. Timers depend on fps too, but the function won't be called on any frame. Link to comment
Drakath Posted February 23, 2015 Author Share Posted February 23, 2015 I don't think timer would be sufficient in this case. My script uses dxDrawLine3D. Link to comment
arezu Posted February 23, 2015 Share Posted February 23, 2015 It depends on how many times you call it. If you explain what you are using it for and how, then maybe we can suggest alternative solutions or optimization tips. Link to comment
Drakath Posted February 24, 2015 Author Share Posted February 24, 2015 onClientRender, it uses processLineOfSight for each player to calculate where the ray hits. I create a laser dot in that spot. There is no other way around unless removing the laser dot and making dxDrawLine3D very long. So I will ask again, is it worth removing this feature (laser dot) just to remove processLineOfSight from my script? Link to comment
Addlibs Posted February 24, 2015 Share Posted February 24, 2015 I think you should test this with a few people using performancebrowser (a default MTA resource for MTASA HTTP server protocol) or ipb (ingame performance browser) If you conclude with using this feature, remember to make sure that the players you're checking are streamed in - you probably don't need it for players who are far away from the local player. Link to comment
JR10 Posted February 24, 2015 Share Posted February 24, 2015 Its wiki page mentions that it's expensive, you're also calling it on each render which is A LOT. Most of these calls are useless since the player doesn't always change position/rotation each render. You can try different things to get over this. Maybe using getTickCount to limit the call to 3 seconds? Perhaps use the less expensive isLineOfSightClear before using processLineOfSight? Link to comment
arezu Posted February 24, 2015 Share Posted February 24, 2015 Did you try https://wiki.multitheftauto.com/wiki/GetPedTargetCollision? Link to comment
Drakath Posted February 24, 2015 Author Share Posted February 24, 2015 Its wiki page mentions that it's expensive, you're also calling it on each render which is A LOT. Most of these calls are useless since the player doesn't always change position/rotation each render. You can try different things to get over this. Maybe using getTickCount to limit the call to 3 seconds? Perhaps use the less expensive isLineOfSightClear before using processLineOfSight? Nah, it just won't be as smooth and nice as it is with onClientRender. Maybe I shouldn't try to apply it for all players? What if it was for localPlayer only? @arezu I did try it a long time ago, here's what I got: http://i43.tinypic.com/2eo8qhw.jpg Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now