Author Topic: DJ Barnys AI Smoke Grenade  (Read 3730 times)

Offline MaxP

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: DJ Barnys AI Smoke Grenade
« Reply #15 on: 02-05-2018, 22:05:28 »
Interesting, sounds very promising. Have you posted about this in the BFSP forums as that's the "hub" for all BF2 mods that have any bots action in them ?
No. Maybe I'm wrong, but I'm just tired from the modding. Don't want to complain here, but I don't want to share some of my work to the most of modders, except for FH2 and PR teams.
I know that they can use it in the best way.

I've also implemented some new new features, like:
- bomber cars for AI (after a year the PR team made it's own implementation in 1.5, but I prefer my own config);
- new projectile collision system, based on networkable projectiles, that is greatly improves the automatic firing, including a new tracer effect for it;
- some minor tweaks for coop maps like dynamic spawn points, providing additional directions for attacks;
- scripted unmanned bombers with bombing capabilities (by the additional spawners);
- different levels of ai aiming skills (like insurgents, regulars and elite), differentiation between vechicle and handheld accuracy via adjusting handicaps for soldiers ai template;
- new configs for planes, that allows AI bots to fly a much higher than before
etc.
I know that there is nothing extraordinary, but just a useful tweaks that can bring some new experience to coop modes. Maybe, except the projectile collisions - I've always dreamed about the adequate calculations ))

I can provide the tweaks and explanations for those of modders who wil be interested in some of this stuff,  also there is a some videos on my youtube channel.
« Last Edit: 02-05-2018, 22:05:59 by MaxP »

Offline Michael Z Freeman

  • Jr. Member
  • **
  • Posts: 811
  • The Few are many ;)
    • View Profile
    • Homepage
Re: DJ Barnys AI Smoke Grenade
« Reply #16 on: 04-05-2018, 17:05:18 »
Hi MaxP,

An entirely understand. Yes, after all your hard work why not get it in the mods where it will be appreciated ! I also always think that the smoke adds a lot of dramatic atmosphere to FH as well. Also there are smoke shells in some of the artillery guns ? Commander smoke ?

So I looked at the files you sent me. I'm afraid I'm just not in the right head space to merge those into one of the FH grenades, for example "objects_weapons_server.zip\Weapons\Handheld\explosives\AN_M8_SmokeGrenade" which is the American "AN-M8 Smoke Grenade". But I'll post in the suggestions forum. If the FH team decide they want to include it then it will eventually get in there. However FH is a relatively small team so it could take a while.

Offline jan_kurator

  • FH-Betatester
  • ***
  • Posts: 2.546
  • Magnificent Mustard
    • View Profile
Re: DJ Barnys AI Smoke Grenade
« Reply #17 on: 04-05-2018, 18:05:52 »
...If the FH team decide they want to include it then it will eventually get in there. However FH is a relatively small team so it could take a while.
There is no one working on the singleplayer at the moment, but I bet many players who play SP would appreciate this. If you guys are interested in implementing this, just contact devs on our Discord and speak about your options, I think devs may consider accepting a helping hand.

Offline MaxP

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: DJ Barnys AI Smoke Grenade
« Reply #18 on: 04-05-2018, 23:05:54 »
Quote
Also there are smoke shells in some of the artillery guns ? Commander smoke ?
For atillery - unfortunately, no. The current implementation is based on spawner, which spawns PCO with the appropriate effect at the desired fixed time. For hand grenades it works fine, but the artilleery projectile must explode on impact, and when it explodes, in BF2 realm it will be destroyed, and will not be able to spawn anything. For commander smoke - maybe, I don't know how it works, but if it is the spawned object, I see no problems.

Quote
I'm afraid I'm just not in the right head space to merge those into one of the FH grenades, for example "objects_weapons_server.zip\Weapons\Handheld\explosives\AN_M8_SmokeGrenade" which is the American "AN-M8 Smoke Grenade".
I can do it and give you the tweak in a days.

That's interesting. What mod are you working on?
Sorry, I didn't see the question before ))
The cooperative mod, based on the Project Reality assets.
Also I've worked on adding new HD skyes, like that:
https://www.youtube.com/watch?v=cLA1S_TCxdI
https://www.youtube.com/watch?v=iumxGPHrDss
https://www.youtube.com/watch?v=PG0lPDkW0dU
You can see other of my old WIP videos at youtube. I was making it for my own purposes (we're playing at LAN with friends), but when it become very interesting, I've decided to share it.
Can't publish any links, 'cause it uses many PR and FH2 resources, but I can provide the links for those who will be interested - just give me your gmail in PM.
« Last Edit: 05-05-2018, 11:05:56 by MaxP »

Offline Michael Z Freeman

  • Jr. Member
  • **
  • Posts: 811
  • The Few are many ;)
    • View Profile
    • Homepage
Re: DJ Barnys AI Smoke Grenade
« Reply #19 on: 06-05-2018, 16:05:40 »
Quote
Also there are smoke shells in some of the artillery guns ? Commander smoke ?
For atillery - unfortunately, no. The current implementation is based on spawner, which spawns PCO with the appropriate effect at the desired fixed time. For hand grenades it works fine, but the artilleery projectile must explode on impact, and when it explodes, in BF2 realm it will be destroyed, and will not be able to spawn anything. For commander smoke - maybe, I don't know how it works, but if it is the spawned object, I see no problems.

Ah, so. Any smoke grenade stays there until the smoke runs out. Just like a real smoke grenade which does not explode. Only a reaction is started in the "grenade" which spurts out smoke ... just as shown in this, appropriately, Russian video - https://youtu.be/m_7b0eZRuQg

Could the artillery round be made to stay there, or is that hard coded ?

Quote
Quote
I'm afraid I'm just not in the right head space to merge those into one of the FH grenades, for example "objects_weapons_server.zip\Weapons\Handheld\explosives\AN_M8_SmokeGrenade" which is the American "AN-M8 Smoke Grenade".
I can do it and give you the tweak in a days.

Thanks mate. I'll make a few video's. Perfect timing as I now have AMD ReLive setup and working really well. I wonder if I could blind a machine gun emplacement ? Something dramatic might raise a bit of interest from dev's and players !

Quote
That's interesting. What mod are you working on?
Sorry, I didn't see the question before ))
The cooperative mod, based on the Project Reality assets.
Also I've worked on adding new HD skyes, like that:
https://www.youtube.com/watch?v=cLA1S_TCxdI

Love the sunset HD sky in the first video. There's also something compelling about having modern warfare in those WW2 maps.

Offline MaxP

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: DJ Barnys AI Smoke Grenade
« Reply #20 on: 06-05-2018, 19:05:16 »
Quote
Ah, so. Any smoke grenade stays there until the smoke runs out.
Not exactly. The grenade must exists until the spawner can spawn the smoke. For hand grenades it must be about 2.5 s.
But yes, if you want it, you can set the geometry for the spawner, so grenade body will stays visible till the end of effect.

Quote
Could the artillery round be made to stay there, or is that hard coded
As I said, there are only two options - explode at the end with the effect, or not explode ))
But, anyway, we can add the SatNav's ParticleEffect to the explosion effect, to make it work only for local games - there will be no side effect for the network games.

Quote
I wonder if I could blind a machine gun emplacement?
This is the reason I've wanted to make the smoke screen ))

P.S. Keep in mind, that some of weapons can fire through the smoke - mostly the stationary mg's. They have  weaponTemplate.setFiresThroughTransparent 1 parameter in the ai template.
If you'll encounter this, change it to 0.
« Last Edit: 07-05-2018, 00:05:44 by MaxP »

Offline Michael Z Freeman

  • Jr. Member
  • **
  • Posts: 811
  • The Few are many ;)
    • View Profile
    • Homepage
Re: DJ Barnys AI Smoke Grenade
« Reply #21 on: 07-05-2018, 15:05:13 »
Quote
Ah, so. Any smoke grenade stays there until the smoke runs out.
Not exactly. The grenade must exists until the spawner can spawn the smoke. For hand grenades it must be about 2.5 s.
But yes, if you want it, you can set the geometry for the spawner, so grenade body will stays visible till the end of effect.

Quote
Could the artillery round be made to stay there, or is that hard coded
As I said, there are only two options - explode at the end with the effect, or not explode ))
But, anyway, we can add the SatNav's ParticleEffect to the explosion effect, to make it work only for local games - there will be no side effect for the network games.

So it it can be done ? BTW just curious and don't want to add any more work at the moment. Smoke grenades first !

Quote
Quote
I wonder if I could blind a machine gun emplacement?
This is the reason I've wanted to make the smoke screen ))

P.S. Keep in mind, that some of weapons can fire through the smoke - mostly the stationary mg's. They have  weaponTemplate.setFiresThroughTransparent 1 parameter in the ai template.
If you'll encounter this, change it to 0.

Gotcha. That's something that looks simple enough to adjust if I have to.

You also may not be aware that I think it was Gavrant - FH Coop/Sp Dev when he's around - removed any usage by bots of their own smoke grenades so some consideration would need to be made over if that needs to be put back in assuming the smoke grenade fix is accepted by the devs.

EDIT: Actually I'm seeing "weaponTemplate.setFiresThroughTransparent 1" all over the place so it's just as well you mentioned this as my testing/video making would have shown the wrong thing. Is there a reason it is set to "1" in the first place ? For example to allow firing through some vegetation or something like that ? Plus what's its default ? Because some AI templates don't include that settings at all.

EDIT2: More stuff I really need Gavrant for: MG34 is already set to "0" apart from the "mg34_stukaAI" which is set to "1". I wonder if there are other reasons for this settings ? I'll just set it to "0" for the moment.

EDIT3: And here it is ! This shows it very well as I removed all bots apart from one on the enemy team who, on Purple Heart Lane, conveniently mounts a fixed MG position. Epic ! - https://youtu.be/S-0rHwSnhn4
« Last Edit: 07-05-2018, 17:05:07 by Michael Z Freeman »

Offline MaxP

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: DJ Barnys AI Smoke Grenade
« Reply #22 on: 07-05-2018, 17:05:33 »
Quote
So it it can be done?
The hiding effect for the artillery smoke shells? As I said - of course, but only for local games.
It will not have any effects on the network games, and no side effects, as I know.

Quote
Plus what's its default?
The default value is 1 for most weapons with small projectiles (the parameter not set), and the rockets/missiles have 0 (overriding default value).
The reason for it is the wire fences in vanilla BF2 - it can be shoot through with bullets, but it stops the missiles.

Quote
Is there a reason it is set to "1" in the first place? For example to allow firing through some vegetation or something like that?
I've tested it many times, and I've seen absolutely no changes between 1 and 0, while fighting on maps with the dense vegitation.
Maybe because the players cannot be completely hidden behind the vegetation on most of maps.
So I think we can easily change this parameter to 0 for most of mg's, without side effects.

Quote
Actually I'm seeing "weaponTemplate.setFiresThroughTransparent 1" all over the place
No, for the most of handheld weapons in FH2 it set to 0.

Quote
MG34 is already set to "0" apart from the "mg34_stukaAI" which is set to "1". I wonder if there are other reasons for this settings ? I'll just set it to "0" for the moment.
As I think, the main reason for it is to bring in more atmospheric gameplay, 'cause if you set this parameter to 0 for the plane's mg, the bot will stops the firing more often - as the plane's speed is high enough, and the bots can't shoot so precisely.

Quote
There's also something compelling about having modern warfare in those WW2 maps.
To be honest, as I prefer WW2 entourage, I would love to mod FH2, to have a PR-style explosions, sounds, a new flight dynamic, etc, in a some kind of coop minimod, but this is a huge work, and the FH2 file structure is more complicated. So all that I can is to port these beautiful maps to the existed mod platform...
« Last Edit: 08-05-2018, 03:05:49 by MaxP »

Offline Michael Z Freeman

  • Jr. Member
  • **
  • Posts: 811
  • The Few are many ;)
    • View Profile
    • Homepage
Re: DJ Barnys AI Smoke Grenade
« Reply #23 on: 08-05-2018, 16:05:21 »
Quote
So it it can be done?
The hiding effect for the artillery smoke shells? As I said - of course, but only for local games.
It will not have any effects on the network games, and no side effects, as I know.

If it won't work in coop best leave it then.

Quote
Quote
Plus what's its default?
The default value is 1 for most weapons with small projectiles (the parameter not set), and the rockets/missiles have 0 (overriding default value).
The reason for it is the wire fences in vanilla BF2 - it can be shoot through with bullets, but it stops the missiles.

Ah ! Of course. Had forgotten about those. So there are none of these in FH2 ? I vaguely remember some barbed wire stuff around bases but that might not be the same as the fence in BF2.

Quote
Quote
Is there a reason it is set to "1" in the first place? For example to allow firing through some vegetation or something like that?
I've tested it many times, and I've seen absolutely no changes between 1 and 0, while fighting on maps with the dense vegitation.
Maybe because the players cannot be completely hidden behind the vegetation on most of maps.
So I think we can easily change this parameter to 0 for most of mg's, without side effects.

Good.

Quote
Quote
Actually I'm seeing "weaponTemplate.setFiresThroughTransparent 1" all over the place
No, for the most of handheld weapons in FH2 it set to 0.

Well I changed about 10 of them to "0" in various places. I could have done a global search and replace but not understanding the setting I wanted to change it manually to see some of what is going on.

Quote
Quote
MG34 is already set to "0" apart from the "mg34_stukaAI" which is set to "1". I wonder if there are other reasons for this settings ? I'll just set it to "0" for the moment.
As I think, the main reason for it is to bring in more atmospheric gameplay, 'cause if you set this parameter to 0 for the plane's mg, the bot will stops the firing more often - as the plane's speed is high enough, and the bots can't shoot so precisely.

Ah, still not sure I understand exactly why that is but I'll set that back to what it was then.

Quote
Quote
There's also something compelling about having modern warfare in those WW2 maps.
To be honest, as I prefer WW2 entourage, I would love to mod FH2, to have a PR-style explosions, sounds, a new flight dynamic, etc, in a some kind of coop minimod, but this is a huge work, and the FH2 file structure is more complicated. So all that I can is to port these beautiful maps to the existed mod platform...

I assume you are aware that Project Reality has an upcoming WW2 release ?

Offline MaxP

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: DJ Barnys AI Smoke Grenade
« Reply #24 on: 08-05-2018, 16:05:28 »
Quote
I assume you are aware that Project Reality has an upcoming WW2 release ?
I've seen some versions, but wasn't impressed. The quality of weapons and maps is low.

Quote
If it won't work in coop best leave it then.
But I can modify the tank smoke mortars to add the smoke screen effect - it will works fine.
Also, if you'll decided to modify the map, there is a way to add scripted smoke screen (see the Siege of Tobruk video on my channel). There will be no real artillery, but only explosions and smoke, but I think it's acceptable for coop.
« Last Edit: 08-05-2018, 20:05:08 by MaxP »

Offline Michael Z Freeman

  • Jr. Member
  • **
  • Posts: 811
  • The Few are many ;)
    • View Profile
    • Homepage
Re: DJ Barnys AI Smoke Grenade
« Reply #25 on: 09-05-2018, 16:05:36 »
Quote
I assume you are aware that Project Reality has an upcoming WW2 release ?
I've seen some versions, but wasn't impressed. The quality of weapons and maps is low.

Was that early beta ? What I've seen looked Ok to me but I;ve not looked at it in great detail.

Quote
Quote
If it won't work in coop best leave it then.
But I can modify the tank smoke mortars to add the smoke screen effect - it will works fine.
Also, if you'll decided to modify the map, there is a way to add scripted smoke screen (see the Siege of Tobruk video on my channel). There will be no real artillery, but only explosions and smoke, but I think it's acceptable for coop.

Hang on. Tank mortar smoke launchers ? How do I use those in FH ? 

Offline jan_kurator

  • FH-Betatester
  • ***
  • Posts: 2.546
  • Magnificent Mustard
    • View Profile
Re: DJ Barnys AI Smoke Grenade
« Reply #26 on: 09-05-2018, 19:05:05 »
Hang on. Tank mortar smoke launchers ? How do I use those in FH ?
by changing the ammo type you use, on tanks I mentioned to you earlier (it's usually weapon selection #3 or #4 depending on how many types of ammunition those tanks have)

Which tanks fire smoke grenades ? Never seen it myself.
PzKpfw III Ausf. M & N, PzKpfw VI Ausf. E (early model Tiger only), Daimler Mk I, Vickers Mk. VIB, Cruiser Mk IVA, and Matilda Mk II. On all of these, smoke grenade discharges are mounted on the sides of their turrets.
« Last Edit: 09-05-2018, 19:05:49 by jan_kurator »

Offline Michael Z Freeman

  • Jr. Member
  • **
  • Posts: 811
  • The Few are many ;)
    • View Profile
    • Homepage
Re: DJ Barnys AI Smoke Grenade
« Reply #27 on: 09-05-2018, 22:05:45 »
Hang on. Tank mortar smoke launchers ? How do I use those in FH ?
by changing the ammo type you use, on tanks I mentioned to you earlier (it's usually weapon selection #3 or #4 depending on how many types of ammunition those tanks have)

Which tanks fire smoke grenades ? Never seen it myself.
PzKpfw III Ausf. M & N, PzKpfw VI Ausf. E (early model Tiger only), Daimler Mk I, Vickers Mk. VIB, Cruiser Mk IVA, and Matilda Mk II. On all of these, smoke grenade discharges are mounted on the sides of their turrets.

Thanks. I'll have to check this. I suspect they are turned off in Coop/SP just like (non-AI blocking) smoke grenades are, which Gavrant prevented the bots from using due to them being able to see through. So we might get AI blocking tank grenade dischargers as well.

Offline MaxP

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: DJ Barnys AI Smoke Grenade
« Reply #28 on: 10-05-2018, 05:05:35 »
I suspect they are turned off in Coop/SP just like (non-AI blocking) smoke grenades are, which Gavrant prevented the bots from using due to them being able to see through. So we might get AI blocking tank grenade dischargers as well.
I think it's turned off because of:
1. Unlimited ammo for AI
2. Aiming detection logic for AI

If we want the bots to use the smoke launchers, we need to use the stock target comps for weapons, like TSLaserGuided or TSWireGuided (FH2 doesn't have any). This is the embedded logic - they will launch the smoke (PIFlareFire) automatically while being "locked" by the enemy weapon.
As the AI bots have an unlimited ammo, there will be the smoke everywhere.

If it will be the weapon logic: the bots can't shoot the weapon (smoke launchers) if they're unable to predict the projectile trajectory to the target, so I think there is no way to make them launch it to the enemy direction, as for the main weapon - so this variant is useless.
So, if we want to implement this, we need to do it in a form of minimod for FH2, with our own config for a stock vehicles/weapons/ai templates and maps (like CMP).
It will also be useful for coop games as we need to break the team balance - i.e., adding more stationary weapons for AI defenders, or adding new spawnpoint, to make the gameplay more dynamic.
« Last Edit: 10-05-2018, 08:05:15 by MaxP »

Offline Michael Z Freeman

  • Jr. Member
  • **
  • Posts: 811
  • The Few are many ;)
    • View Profile
    • Homepage
Re: DJ Barnys AI Smoke Grenade
« Reply #29 on: 11-05-2018, 21:05:09 »
I see. Well we'll just help FH2 get the smoke grenade in there first. Worry about the rest later 8).