-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add projectile tracking #534
Conversation
drawLine3D [_prevProjectileData select 0, _currentProjectileData select 0, [_red, _green, 0, 1]]; | ||
|
||
_i = _i + 1; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while
is pretty slow in SQF due to having to execute two code blocks each cycle. Maybe use forEach _projectileData
with _currentProjectileData
== _x
.
}; | ||
|
||
// using 0.1 to improve performance, we don't need that many bullet position to draw a line | ||
[FUNC(projectileTracking_trackProjectile), 0.1, [_projectile, _index]] call EFUNC(common,addPerFrameHandler); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CBA_fnc_addPerFrameHandler
CBA_fnc_hashGet
CBA_fnc_hashRem
I think the slowest part about the BI functions is that it uses a too small resolution / too many lines per traced bullet. |
I'm done. Testing local MP with two instances was working very well. |
FPS VA, no tracked bullets: 99 used: So this is a >100% improvement. Very good. |
|
|
||
for "_index" from 0 to _maxLines do { | ||
|
||
if ( ([GVAR(projectileData), _index] call CBA_fnc_hashHasKey) ) then { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we are going for performance, we are doing an in
and a find
with hashHasKey
and hashGet
. We can probably skip one of them and just do a hashGet
followed by a !isNil
check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not convinced that we need CBA hashes for this in the first place. I mean, this should be possible simply by iterating through an array, shouldn't it be?
I've decided against using an optional parameter:
?
The thing is, you don't only track bullets. Everything that triggers the "Fired" EH. That's why I went with "projectile".
I've started this thing as an exercise for me to get to know PFHs and hashes more. That's why I used hashes in the first place. I'll look into changing it into a standard array. |
@commy2 I've committed some of your requested changes.
|
When merged this pull request will:
hashes andPFHs and should be performing better thanBIS_fnc_traceBullets
Why CBA?:
TODO: