Jump to content
Hypnomatic

Quick and fun projectile path tracing!

Recommended Posts

@aeroson:

That's actually really neat, and something I was considering looking into, but didn't know how to implement well. I've had a few new ideas for how I want to handle this so I'm rewriting it again late-ish tomorrow or Friday (Bit busy), but to give you an idea of the changes I'm thinking right now:

- The laptop for changing options is a very hacked together solution that I'm in general not happy with. It basically iterates through every unit and redeclares the optional parameters to the new values. It works, but as this script has gone on I've reevaluated what needs to be stored on a per unit basis, and how it's stored. Right now every unit stores its own set of params, but these are all changed at the same time to the same values, so they are all redundant. The change I'm thinking is that each unit would simply have a "tracers_var_params" value that points to an array with the interval, max distance, and such as elements. That way I can have multiple units all point to the same array, and any manipulations to that array are automatically reflected in all of the units. It would even allow me to have separate categories of units with different parameters stored in different arrays if so desired. It's also just storing a lot less duplicate data, which is nice.

- Right now, the format of data being stored is basically [[[x,y,z],velocity], ...]. I'm thinking of changing this to [[[x,y,z],[r,g,b,a]], ...], or in other words, calculate the color of a line when it's recorded, and storing it with the position instead of the velocity. There are 2 major benefits to this: First the script only needs to divide the current velocity by the muzzle velocity once instead of every frame, which should help performance a tiny bit. Second, it allows aeroson's interpolation idea to theoretically be implemented without performance hits. Instead of executing his code every frame for each position, it would be executed once per position, which shouldn't hurt performance nearly as much.

- Making respawning and the initializing the script cleaner. When I first wrote this, I was assuming I would just use a boolean stored in the object that would exist if the unit was initialized this life, and not exist at all if not. The quirk I completely forgot is that variables in a object's namespace persist through respawn, so I couldn't use the boolean. I tossed in a simple workaround, however, that I just need to integrate better. It's basically:

_unit setVariable ["tracer_var_object", _unit];  //Store a reference to the current unit/object

//And then the following would return true only if the unit has been initialized this life:
_unit == _unit getVariable ["tracer_var_object", objNull]

And a ton of other little things. Including maybe changing the naming convention of variables. I'm a big fan of descriptive prefixes and suffixes, and I've slowly been leaning against using hyp_ at all for the sake of being concise. I'll toss a few things around and see what sticks. But as all of these changes and ideas have popped up, I'm looking to continually maintain and improve the code.

Share this post


Link to post
Share on other sites

Amazing script, i used it to effectively show the Guys in my Unit why to NOT take cover behind a Vehicle while in Combat.

Anyhow, is there any chance to get the Script to work with Shotgun pellets? Using the Benelli M4 Mod, the Script works perfectly with the Slug Ammunition, tracing a single Bullets Path. It doesn't work out with Shotgun pellets, however. Also the MEA Underwater-Ammo for the SDAR is not traceable, while the 5.56mm, also shot by the SDAR is traced by your script. (No, i did not try to shot them Underwater, i tried it on dry Land.)

Any possible fix avaliable, or is this not possible with this kind of function?

Share this post


Link to post
Share on other sites

What would the correct thing be to use if I wanted all units to have their bullets traced?

(Both players and AI)

I looked through the thread but I can't recall seeing something like it.

I'm not looking to change to specific colors depending on their faction.

Everything traced, like this below, but for all units in the mission?

[player, nil, nil, nil, nil, nil, true] call hyp_fnc_traceFire;

Edited by AlexVestin

Share this post


Link to post
Share on other sites

Take a look at my Bullet Tracking toolbox script, it utilizes HSV (hue-saturation-value) curves to get perfect color representation, not gradual steps. Plus it adds a lot more functionality, like adding action to turn bullet tracking on/off, pausing bullet tracking, etc.

You can pull of some of the code from my GitHub to implement in your script (as it's very popular already and I don't want to release an almost identical script which would rip yours off) and make it better, as long as you credit Naught were need be. I'll check :P

https://github.com/dylanplecki/ArmaScripts/tree/master/Arma%203/Bullet%20Tracking

Share this post


Link to post
Share on other sites
What would the correct thing be to use if I wanted all units to have their bullets traced?

(Both players and AI)

I looked through the thread but I can't recall seeing something like it.

I'm not looking to change to specific colors depending on their faction.

Everything traced, like this below, but for all units in the mission?

[player, nil, nil, nil, nil, nil, true] call hyp_fnc_traceFire;

Do something like this:

{
[_x, nil, nil, nil, nil, nil, true] call hyp_fnc_traceFire;
} forEach allUnits;

Untested - you may need to add vehicles (can't remember if allUnits encompasses vehicles).

Share this post


Link to post
Share on other sites

Very cool script Naught, thanks for posting it! I've been pretty swamped with real-life things for the past week and a half, so a lot of the functionality I have planned or wanted to implement is only partially done. Heck the mission in the Steam Workshop is a very shallow representation of what I have in mind, but I wanted to get something out the door. Despite this, I've just finished rewriting everything important to be faster, much cleaner, and hopefully more modular, and hopefully I'll publish it some point later tomorrow. I definitely will take a look at implementing some manner of your HSV calculations, as it does look very handy! And of course anything of yours I use will be duly credited.

Share this post


Link to post
Share on other sites

Great Job Hyp!!

May I add this function to my mission??

I could give special thanks for you when the function is on.

Share this post


Link to post
Share on other sites

Hi hypnomatic i was trying to use te script but without success i did everything as you wrote but the script doesn't works in the action menu say "clean the traces" but the line don't show i tried to download your mission with the script buut the link is crashed my game version it's 1.04 without the developer version

Share this post


Link to post
Share on other sites

Is it possible to make something similar to this, except indicating hits on a surface and measuring the distance from the two furthest hits on the same surface? Some kind of precision shooting scoring aid, for testing weapons configs?

Share this post


Link to post
Share on other sites

I want to thank you for that script. It's great and very useful. Proved invaluable, eg in some testing work:

Share this post


Link to post
Share on other sites

I am currently trying to get it working in multiplayer.

it seems like the visiual tracing starts a bit delayed, also sometimes some colours are missing like red and green.

could it be that the lines are to thin to see ?

in multiplayer is the unit you are playing adressed as player or as your nick?

would it be possible to let every player only see their tracers?

[player, nil, nil, nil, 1000, nil, true] call hyp_fnc_traceFire;  
[skavier470, nil, nil, nil, 1000, nil, true] call hyp_fnc_traceFire;

distance is in meters right?

it also seems as if multiplayer gets hit on peromance very hard.

for now i could only try with one player...

Share this post


Link to post
Share on other sites

Would it be possible to not just show but also create an external table (/copy to clipboard) for the flightpath of the projectile? So it could be looked up on in an excel sheet?

Basically Distance from Muzzle, Heigth and Speed. It would be really helpfull for creating new Ammunition. Unfortunately i have not the slightest clue about scripting.

- The laptop for changing options is a very hacked together solution that I'm in general not happy with.

Maybe the Proving Ground Mission could give you some ideas? A combination of your tracing script and the Proving Ground Features would be superb for Testing new Weapons, Vehicles, Buildings, Protective Gear, etc. I find Virtual Ammo Box not very comfortable for quick testing, as you have to look for every magazine seperately.

And one last question: What is the best distance between 2 objects if you use the most detailed tracing?

I'm creating a bunch of RHA target plates to shoot at and i also want to create packs (multiple plates behind each other) for easy deployment. I just don't know how far i should space them apart for the script to work best.

Share this post


Link to post
Share on other sites

Phew, sorry for the long streak of inactivity, been a bit preoccupied for the past month or two.

@Fennek:

As far as exporting data goes, it's not 100% intuitive at the moment, especially considering there's a bit of a divide between the workshop branch and the github branch. I need to look at the rewrite I was working on a month ago however, as I believe that one may lend itself to this better. Will report back after I check.

Now regarding optimal spacing:It really doesn't matter how far the objects are: it matters how long it takes to travel between them. Positions are calculated every time the game renders a frame, so the more frames that are rendered while the bullet is flying the more accurate the line. You can use the command setAccTime (http://community.bistudio.com/wiki/setAccTime) to slow down time so more frames are rendered per in game second. That will give you a better idea than any spacing should.

Once again, sorry for being so out of the loop with ARMA for the last two months, will be trying to get fully caught back up in the next week!

Share this post


Link to post
Share on other sites

I've created some RHA plates for testing with your script (1mm, 5mm, 20mm, 50mm, 100mm)

I spaced them 1.5m apart, should be sufficient for normal-time testing

Share this post


Link to post
Share on other sites

Hey does anyone know why the bullet lines don't appear when looking through the helicopter glass?

I jumped in a pawnee, if you look outside the aircraft the heli you can see the lines but when you look through the glass they disappear from view? Any Fixes for this.

Also i've found once the glass moves over tot he broken glass texture you can see the lines. Some filter issues or something?

Share this post


Link to post
Share on other sites

How do I go about making the projectile tracings visible for every player and added back once they respawn?

When people respawn tracing is gone and for some reason players that join later can not see players that joined earlier's tracing.

Share this post


Link to post
Share on other sites
I see a few probable causes for your issue, but I think the easiest way to help you is to just post a working mission, so you can see what's needed. So here's what's in my mission:

https://github.com/hypnomatic/ARMA_Examples/tree/master/TracerExample_v0-0-1.Altis

There you'll see the init.sqf and mission.sqm files, as well as a zip of the entire mission. So either copy the contents of those files into yours, or drop the folder that's inside the zip file in the same directory as all of your other editor missions.

The link is broken! Can you re upload please :)

Share this post


Link to post
Share on other sites

Hello!

I really want this to be able to have on my dedicated server for testing and training. Can anyone please provide me a download link to a mission, if it's already made or tell me if it's possible and how?

Share this post


Link to post
Share on other sites

Is there a way to give players the ability to turn this on and off while in game like through an addAction on something?

Share this post


Link to post
Share on other sites

For those interested you can turn the tracers on and off per unit with the following addAction.

this addAction["<t color='#ff1111'>Trace ON</t>", {[_this select 1, [1,0,0,1], 3, 2, nil, 3] call hyp_fnc_traceFire}]; 

this addAction["<t color='#ff1111'>Trace OFF</t>", {[_this select 1] call hyp_fnc_traceFireRemove}];

I haven't fully tested this in multiplayer yet but works in editor preview.

Share this post


Link to post
Share on other sites

This is a very useful script that I'm implementing into a training map for my unit so that new members can view the properties of the weapons they'll be using.

I like that the lines are client side so that performance degradation is only as bad as the number of shots you leave up at one time.

I've turned it off by default and can be turned on/off via scroll menu thanks to a post #71.

I've got a couple issues though that I hope someone here could help with.

Issue 3- This only works with personal weapons. I'd like to have it work with vehicles (tanks/offroads/etc), aircraft (Fixed/Rotary Wing) and static emplacements (Mortars/Howitzers/MGs/Grenade Launchers/etc).

Hoping someone can help with these issues.

Edit: Fixed my first two issues.

Edited by J_ONeill

Share this post


Link to post
Share on other sites

I'm getting follwing error:

[color="#FF8040"][color="#191970"][b]waitUntil[/b][/color] [color="#8B3E2F"][b]{[/b][/color]


[color="#191970"][b]if[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_interval[/color] [color="#8B3E2F"][b]![/b][/color][color="#8B3E2F"][b]=[/b][/color] [color="#FF0000"]0[/color] [color="#8B3E2F"][b]&[/b][/color][color="#8B3E2F"][b]&[/b][/color] [color="#1874CD"]_skippedFrames[/color] [color="#8B3E2F"][b]<[/b][/color] [color="#1874CD"]_inte[/color][color="#8B3E2F"][b]>[/b][/color]
[color="#FF0000"]20[/color][color="#8B3E2F"][b]:[/b][/color][color="#FF0000"]04[/color][color="#8B3E2F"][b]:[/b][/color][color="#FF0000"]06[/color]   Error [color="#191970"][b]position[/b][/color][color="#8B3E2F"][b]:[/b][/color] [color="#8B3E2F"][b]<[/b][/color][color="#1874CD"]_interval[/color] [color="#8B3E2F"][b]![/b][/color][color="#8B3E2F"][b]=[/b][/color] [color="#FF0000"]0[/color] [color="#8B3E2F"][b]&[/b][/color][color="#8B3E2F"][b]&[/b][/color] [color="#1874CD"]_skippedFrames[/color] [color="#8B3E2F"][b]<[/b][/color] [color="#1874CD"]_inte[/color][color="#8B3E2F"][b]>[/b][/color]
[color="#FF0000"]20[/color][color="#8B3E2F"][b]:[/b][/color][color="#FF0000"]04[/color][color="#8B3E2F"][b]:[/b][/color][color="#FF0000"]06[/color]   Error Undefined variable [color="#191970"][b]in[/b][/color] expression[color="#8B3E2F"][b]:[/b][/color] [color="#1874CD"]_interval[/color]
[color="#FF0000"]20[/color][color="#8B3E2F"][b]:[/b][/color][color="#FF0000"]04[/color][color="#8B3E2F"][b]:[/b][/color][color="#FF0000"]06[/color] Error [color="#191970"][b]in[/b][/color] expression [color="#8B3E2F"][b]<[/b][/color][color="#8B3E2F"][b]%[/b][/color][color="#FF0000"]1[/color]"[color="#8B3E2F"][b],[/b][/color] [color="#1874CD"]_projIndex[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b],[/b][/color] [color="#1874CD"]_positions[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color]


[color="#191970"][b]if[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_lifetime[/color] [color="#8B3E2F"][b]![/b][/color][color="#8B3E2F"][b]=[/b][/color] [color="#FF0000"]-1[/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]then[/b][/color] [color="#8B3E2F"][b]{[/b][/color]
[color="#191970"][b]waitUntil[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#8B3E2F"][b]([/b][/color]diag[color="#8B3E2F"][b]>[/b][/color]
[color="#FF0000"]20[/color][color="#8B3E2F"][b]:[/b][/color][color="#FF0000"]04[/color][color="#8B3E2F"][b]:[/b][/color][color="#FF0000"]06[/color]   Error [color="#191970"][b]position[/b][/color][color="#8B3E2F"][b]:[/b][/color] [color="#8B3E2F"][b]<[/b][/color][color="#1874CD"]_lifetime[/color] [color="#8B3E2F"][b]![/b][/color][color="#8B3E2F"][b]=[/b][/color] [color="#FF0000"]-1[/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]then[/b][/color] [color="#8B3E2F"][b]{[/b][/color]
[color="#191970"][b]waitUntil[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#8B3E2F"][b]([/b][/color]diag[color="#8B3E2F"][b]>[/b][/color]
[color="#FF0000"]20[/color][color="#8B3E2F"][b]:[/b][/color][color="#FF0000"]04[/color][color="#8B3E2F"][b]:[/b][/color][color="#FF0000"]06[/color]   Error Undefined variable [color="#191970"][b]in[/b][/color] expression[color="#8B3E2F"][b]:[/b][/color] [color="#1874CD"]_lifetime[/color]
[/color]

Made with KK's SQF to BBCode Converter

Share this post


Link to post
Share on other sites

This is a very good scripts that allow us to understand the physics of the bullet. We in  community run ACE3 and it also helped us there running the whole projectile tracing. 

 

We run a training ground mission for getting to how to use stuff of the mods and game. I am trying to force only officer can remove the projectile. No other person can have the option to remove the projectile trace. 

 

My Variable name for officer is Officer_blu

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×