Ranked Fire and Friendly Fire Effects.

I did some experiments with the Cavalli Realism Mod projectile and with the standad musket weapon. None of my experiments were very successful although I did discover some useful things.

But first let me explain what I was trying to do. The Cavalli musket bullet idea looks promising. It prevents troops firing through friendly units and through solid structures. Some of the effects are good. Where clumps of men from an 18th C musket formation are drawn into bayonet fights, the other men of the formation will not fire into them but still fire elsewhere where they have a clear shot. This looks great.

On the minus side, only the front rank fires. The second rankers can sort of shoulder their way through the front rank and then start firing. Third rank basically won't fire till the men in front die. This does not look so good and it makes proper shot to cold steel balancing harder.

It occured to me that implementing friendly fire effects (the inhibition of firing into friendly troops) also requires an implementation of ranked fire, so that the front three ranks can fire a near unified volley. A little raggedness to the volley would not matter, indeed it would enhance the realism effect. But three ranks must fire or balancing muskets to cold steel gets very hard to set up make it look realistic. The two must operate together: friendly fire inhibition plus ranked fire.

It also occurred to me that permitting three ranks to fire could be "fudged" or "kludged" without new graphics of ranked fire or complicated rotating of ranks. If the "friend on line" (of sight) calculation can be fudged by lifting the start point of the projectile a little then this could help. If the start point of the projectile calculation started just above the soldiers heads (at exactly the right point) then about three ranks (even two ranks and say half of the third by luck of angles would do) could fire a volley. We would keep the muzzle flash and smoke at the right height so that the visual effect would still be fine.

I tried to achieve the above in my experiments but I had no success. I have no idea if I was on the right track or the wrong track or if the whole idea is unsound. I am not a good enough programmer to know.

Also, the Cavalli projectile did not seem to get accurate enough at low dispertion values to make enough extra kills. At lowered (very low) dispertion values, it got the same amount of modest extra kills at any given range but not the further extra kills it should have gotten at very close range.

The standard musket weapon can be set to not fire through friendlies too. However, then an effect occurs where the enemy can fire through your buildings and walls but your troops can't. This really screws over the defender in my tests. Again, I could not solve this problem. But then I am not a good programmer. I have had a breather and will look at all this again. Any suggestions from other modders and ideas from devs would be most appreciated.

I firmly believe if these two issues could be resolved (combination of friendly fire prohibition and ranked fire) then the game could be transformed in mods and even in vanilla if the developers and players wished to see that. The unit capabilities and interactions will become much more interesting. The need for more tactics will be much enhanced rather than just using death ball blobs or stacking tactics for shooters.

Well to put it into laymans terms you dont wanna use cavallis projectile but you will have to completely revamp the shooting logic and calculations to deal with both allies and enemies properly.

Click to expand...

Unless someone tells me the accuracy problems of Cavalli's projectile are fixable in some way... but otherwise, yes. The standard musket weapon is surely not far off what is required. I'm not sure why the devs don't want it to perform better. For example, to not shoot through stone walls and buildings. Surely, that would enhance vanilla play. I also think a very basic kludged simulation of ranked fire would improve vanilla and all mods. It shouldn't really be up to modders to make such fundamental fixes and enhancements, IMHO. I will try again but I don't think I have the skills or knowledge necessary.

Unless someone tells me the accuracy problems of Cavalli's projectile are fixable in some way... but otherwise, yes. The standard musket weapon is surely not far off what is required. I'm not sure why the devs don't want it to perform better. For example, to not shoot through stone walls and buildings. Surely, that would enhance vanilla play. I also think a very basic kludged simulation of ranked fire would improve vanilla and all mods. It shouldn't really be up to modders to make such fundamental fixes and enhancements, IMHO. I will try again but I don't think I have the skills or knowledge necessary.

Click to expand...

Cavalli uses projectiles, forcing him to make the bullets very fast which makes collision calculations inaccurate. If you slowed bullets down however it would lead to them being unable to hit moving units so you are in a lose-lose situation.

All you really need to do is implement a proper hitscan that has to be checked for both friend and foe respectively and base hit and damage calculations off that.

I'm no game programmer, I'm a parameter modder. I had to look up hitscan on Wikipedia. From what you write, it is would be best to stick with the current musket "laser" weapon which I think is clearly a hitscan implementation. Certainly, it can have the "friend-on-line" function implemented so that it does not fire through friendlies. I have done that in an experiment. The problem with enemies firing through the defenders walls and buildings, while the defender cannot, then comes into play. I guess the logic needs implementation which says essentially "do not fire through friendly bodies and do not fire through any structures at all". With the bit "do not fire through any structures at all", I really wonder why the devs don't implement this. Admittedly, wooden walls might need to be an exception.

The other main problem with implementing "no fire through friendlies" is that only the front rank fires. The second rank will fire as its units shoulder their way between the front rank (if and only if you are using move on attack). The third rank and deeper won't fire at all until the men in front die. Of course, I don't want deeper ranks than third to fire but I certainly want the first three ranks to fire. Even if the first two ranks fired reliably and parts of the third rank fired depending on angles and casualties in front ranks, this would give musket line formations enough firepower for balancing to proceed.

My tests show that a practical and believable balance can only occur with three ranks of fire and more three-rank formations. I say practical and believable balance for a "realism" mod.

Thinking Aloud Here

The other solution, and I believe Cavalli looked at it, would be to give 17th C muskets a melee weapon (their sword). But without the graphics to support it, this will not look all that great. Where muskets have a melee weapon, like the 18th C bayonet, they behave reasonably well, even if only the front rank of an ordered formation fires. Once the formation becomes disordered into clumps, in battle, each clump or knot of soldiers will use muskets or bayonets as appropriate. This situation actually looks pretty good in Cavalli Realism Mod. I like the effect.

In this case, in the 17th C without a musket melee weapon , the player would be forced to mix pikes with muskets, pretty much like the historically real case. Has anyone tried making composite formations in C3? Would it be possible to create a formation that held both pikes and muskets? Two ranks of muskets around the periphery and pikes in the core would work well. Muskets would fire and then the pikes would walk through on attack. Muskets would continue to find targets when they could get a clear line of fire. This would work if melee combat was protracted (push of pike style) and the muskets got enough shots in. What would aid this style would be longer musket ranges, especially if the muskets could get two volleys into attacking pikes before contact.

Nah hitscanning is basically what the game does to determine whether or not a unit is on your line of fire. There is a raycasting function that returns objects that collide with a line between two points, in this case the shooter and the target. This does not happen for enemy units and you just have to add them into the logic to check for buildings and do damage calculations accordingly or send a return code that tells the game they cannot fire from their position.

It sounds simple in theory. It makes me wonder why the hitscanning and raycasting is not set up better in the vanilla game. For example, in vanilla, troops fire through stone walls and through mountains. I understand why an arcade game does not want to prevent fire through friendlies (that can be left to modders) but why does it permit musket fire through solid objects like mountains, buildings and stone walls? It seems basic to me that even an arcade vanilla should already have that fixed.

And no, performance has nothing to do with it. The vast majority of performance is swallowed by unit-to-unit automatic movement and attacks and all that. The detection algorithm for targets is a huge mess that scans the area like those submarine radars from movies.

So my idea of enabling the line(s) behind the 1st (and 2nd) line be able to fire through them will not work?

I remember having an idea of using different symbols for the front line which would mean that when given a proper animation they would kneel and let the 2nd line fire behind them and so forth.

Of course I am not saying that this will work, I'm just sharing what my idea was back then, Wraith seems to know his stuff so I'll let him be the judge of that. Like I said I'm only throwing my idea out there for you guys, I don't have the time for experiments of my own anymore because of college and work so I sadly can't help you altho I am a big supporter of implementing more orderly shooting in formations.

So my idea of enabling the line(s) behind the 1st (and 2nd) line be able to fire through them will not work?

I remember having an idea of using different symbols for the front line which would mean that when given a proper animation they would kneel and let the 2nd line fire behind them and so forth.

Of course I am not saying that this will work, I'm just sharing what my idea was back then, Wraith seems to know his stuff so I'll let him be the judge of that. Like I said I'm only throwing my idea out there for you guys, I don't have the time for experiments of my own anymore because of college and work so I sadly can't help you altho I am a big supporter of implementing more orderly shooting in formations.

Click to expand...

Youd have to constantly analyze your formation at runtime since units can die and that would mean others have to be assigned that variable on the fly which is a huuuuuge mess to code

My simpler idea now, when I get to it, is to lift the origin point of the hitscan (target seeking) and raycast (bfriendonline) of the musket weapon to just above the head of the unit. Thus maybe two or three ranks can fire. This is because ideally rank three's shot will go over rank one's heads but rank four's shot will not. Hopefully, I could get approximately 3 rank firing results. The muzzle flash and smoke would not be lifted of course but would stay at the current level. I would use the standard musket weapon for this. Animations would not need to be changed at all. I leave to others the creation of ranked fire and reload animations. That's way too difficult for me.

At the moment, I am trying to solve another bug in the mod. Then I can try experiments on this stuff again. I am very slow at coding unfortunately so it will take me quite a while. The standard musket weapon can be made to do the bfriendonline test. The only problem in my previous tests was that units could not fire through their own buildings and walls but the enemy could. This was really bad for defenders behind their own walls and buildings. But I am sure some logic can be put in to capture this. Something like "if (bfriendonline or bstructureonline) then don't fire".

Ritorno dalla tomba! I come to suggest looking at the ‘little mod’ on Steam - he’s managed to make whole formations wait until each man has reloaded before firing BUT firing at will at close range. It may be they can work something out.

I’m not going to seriously look at improving the game further till we have morale of some kind (at least rudimentary fleeing) as I think that’s what is most lacking at present...

Ritorno dalla tomba! I come to suggest looking at the ‘little mod’ on Steam - he’s managed to make whole formations wait until each man has reloaded before firing BUT firing at will at close range. It may be they can work something out.

I’m not going to seriously look at improving the game further till we have morale of some kind (at least rudimentary fleeing) as I think that’s what is most lacking at present...

Click to expand...

Hi, I really would like to talk to you a bit more. Even if you aren't modding I am sure you can give me some pointers. I have made an experimental mod called TestBed3 which uses your Cavalli musket code. It is currently only available to my friends on Steam. What is your Steam name? Mine is Crazy Cossack.

I have not solved ranked fire but I have balanced the experimental mod reasonably well for a first "Beta" attempt. I have changed the Academy firepower upgrades to be accuracy upgrades. They reduce dispertion of all muskets. This seems to work reasonably well. A dispertion of 1024 (for example) means a musket can't hit a barn door at 20 paces. A dispertion of 0 (zero) means they never miss. I am running the experimental mod totally on head-shots. Because muskets tend to double-shot some targets and not target others, a formation never gets anything like 100% hits for a full salvo even if dispertion is zero. I have copied you in making their range longer. They can now reload on the move again and I have made musket lines faster than pike lines so they can use fire and retreat tactics. All this helps to balance them.

You say you won't look at it until we have morale. A good modder could do morale I believe. But let's talk more in a conversation perhaps. Have a look at my other post too. I wish you would get a little more active again even if just to talk to me about ideas. I haven't given up on bringing your mod and mine closer until they can be unified. For example flag colors could be made to have options like;

As for building size, would it be possible to strike a compromise? Not sure how much work that would be. By a compromise I mean a building size about half way between current size and Cavalli realism mod size. I know your buildings are the correct scale compared to human figures but to the eye in a game they still look a bit big, in my opinion. An approach to right size but not actual true size might look better.

Above I wrote; "A dispertion of 0 (zero) means they (Cavalli muskets) never miss." This is not completely true as I have now found out from many tests and test games versus the AI. The correct statement would be; "A dispertion of 0 (zero) means they never miss a stationary target on flat ground with no intervening obstacles." I have found that the musket projectile does not lead a moving target so they often miss moving targets. Hills and plateaus mess up targeting too. Either the projectile is slamming into the ground at times or it is over-shooting or under-shooting due to elevation issues. None of these things are deal breakers. They just add to the glorious inaccuracy of the musket weapon. Massed infantry formations still get enough kills. Sometimes they need to maneuver or fire and retire and sometimes they need cold steel (melee) cavalry for support. This is all to the good for the game model. It leads to the need for combined arms tactics.

As a bit of fun and amusement I can report:

(1) Sometimes I can just see the musket balls flying. Once when firing short range from a plateau I could see some slow musket ball projectiles arcing down. That admittedly did not look quite right.

(2) I saw an enemy peasant come out of a town center and just die without me hearing any shot or seeing any unit bayonet him. I can only assume the poor fellow died of fright when he saw a formation of 196 grenadiers in the town square getting ready to blow up his town center.

After more tests, it is clear to me that the musket ball projectile does miss moving targets most of the time. The muskets cannot lead a target with this system as it stands. This is not a problem so far. Musket infantry and dragoons stop to shoot and melee units stop to cut and thrust. Once they are stopped they can be hit. Sooner or later, peasants stop walking to perform a work task. Again, once they are stopped they can be hit. This all suggests that melee cavalry charging in will take few hits until they engage. Certainly, those who love cavalry power will love that.

I will probably test the standard musket weapon at some stage with firing disabled when friends are on the shot line. I believe the standard musket weapon can also be made to perform like that. Interactions with buildings and walls may well be different. To me what matters is the final result. I want the weapon system which gives the most likeness to realism and thus generates realistic tactics. The best thing so far is that the musket ball projectile, in disabling fire when friends are on the shot line, stops the blobbing and stacking of firing units. You will lose firepower if you blob and stack firing units.

I know the Cavalli Realism has had this system for a long time. OCMOD3, although late to the party, is now moving towards this system when tests in TestBed3 are finished. However, the balance is set up differently in TestBed3 compared to Cavalli Realism. The muskets get more kills in TestBed3. As I say, it's not about the actual weapon simulation, its the results for casualties and outcomes for tactics that count.

I'm looking at the moment at how we can get your projectile to avoid enemy buildings - I'm sure it's a simple case of copying a single phrase in so that enemy buildings are included in the raycast calculations

Francesco, Thank you for looking at this. I am also getting a bit worried about the musket weapon not being able to lead even the infantry targets enough. Here is a summary I posted on the Old Cossacks site.

Coswar and I gave Testbed3 a good test. It is not ready for public release yet but the results were promising.

The main faults are;

(1) The musket weapon (Cavalli musket ball physics as implemented in the Testbed3) cannot lead moving targets. It can hit (some) moving targets coming directly at the muskets or retreating directly away. It can hardly ever hit even infantry or peasants moving across the line of fire. It hits stationary targets well enough for sure. But it is not good enough when it misses so many moving targets and this is the major reason that the melee units are still a bit overpowered. If we can fix this targeting problem, it will basically fix the game balance too.

(2) There is damage to structures from musket fire incidental hits (although you can't target the structures directly).

(3) Enemies can fire through your stone walls and buildings but you can't.

These three major faults definitely need to be fixed. It might be possible for me to revert to the standard musket weapon to achieve all of the above. Otherwise we will hopefully find fixes for the Cavalli weapon itself. This experiment needs more work but we have definitely made worthwhile progress this time. I remain hopeful. If we crack it, the tactics will be far better as a realism simulation. The playing experience will be better too.

Right I can solve 2) (add bullet protection to buildings so they are impervious to shot) and 3) (I've fixed the collision so that while the ai will still attempt to fire the bullets will not get through).

There is code for predicting shot, which I assume means the unit firing a little ahead in the hope it will strike a moving target, but I've yet to look at it properly. At the moment my main grievance is that masses of unformed ai units can still decimate well-formed ranks because accuracy is too high - I'm going to see if I can fiddle with General's code so that units have awful accuracy unless in formation