Jump to content

processLineOfSight resource usage


Drakath

Recommended Posts

Posted

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?

Posted

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.

Posted

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.

Posted

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?

Posted

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.

Posted

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?

Posted
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...