Hitscan question...

Blitz3D Forums/Blitz3D Programming/Hitscan question...

OrcSlayer(Posted 2006) [#1]
How fast is a linepick for use in say, hitscan weapons? I don't plan on having many in my game, however they would need to check great distances when used. Around 3000 units is likely, since in my game 1 unit = 1 foot and my zones are about a square mile in size.

I would also be using them, over short distances, to get a position and orientation for laser pointers. These concern me more, since they'll need to update every frame.

Am I looking for trouble here, or should Blitz be fast enough to handle it?


D4NM4N(Posted 2006) [#2]
i wouldnt have thought so, my prog ted uses linepicks on large landscape meshes and it seems quite fast.

The way i sped it up was to only set the pickmode if the entity is in the general view direction, this sped it up a fair bit.

Sorry to be so uninformed but wats a hitscan weapon?!? :/


OrcSlayer(Posted 2006) [#3]
Hitscan is the term used to describe instant hit weapons in games. For example, in Unreal Tournament the primary fire of the shock rifle, and all the bullet firing weapons (enforcer, minigun, sniper rifle) were hitscan weapons.


OrcSlayer(Posted 2006) [#4]
So, I'm guessing linepicks only cause a serious performance hit if you have an extreme over-use of them, or if you use long distance ones that have a radius. Would make sense to me...


D4NM4N(Posted 2006) [#5]
right, gotcha.


One question though, if you are using the normal blitz collisions system for rockets etc, can you not move an invisible 'rocket' say 3000 from origin in 1 move? the entitycollided doofer should detect any hit entity with the speed of one logic loop.

However, if you have to turn on pickmode for other reasons, you might as well use linepick.


OrcSlayer(Posted 2006) [#6]
That actually sounds like a good idea...though I'm not sure about that since wouldn't it need at least two updates, since UpdateWorld() wouldn't happen until after that particular code executes? Still, I'll try both methods and see how well they work, since I have pickmodes set anyway (for lens flare culling and vis checks).


D4NM4N(Posted 2006) [#7]
I would have though the time between updates would be so negligable you probably wouldnt notice.

If you already have the pickmodes on i would stick with that.

Dunno which would be quicker though (mabe you can let me know :)


OrcSlayer(Posted 2006) [#8]
I'll test out and see then :)

There will be a little extra to each method (an extra update for the projectile method, an extra pivot rotation for linepick), so I guess I'll just have to try both and see which is more effective as far as processor resources go. I'll let you know what I find out :)


Subirenihil(Posted 2006) [#9]
I have tested the actual speed of linepicks by running 10000 of them and dividing the time that took by 10000 to get the time per linepick. The result didn't vary whether I picked something extremely far away, mircoscopically close, or somewhere in between. Plus, the result was usually less than the value returned by picktime.