An idea About Unit Accuracy.

Get some help with creating maps or modding.
Need a map editor or other tools, look here!
Post Reply
User avatar
Turin86
Greenhorn
Posts: 11
Joined: 25 May 2018, 17:18

An idea About Unit Accuracy.

Post by Turin86 » 22 Feb 2019, 06:28

I am thinking of a better way to explain this, but within the game I came across an interesting function that essentially makes the Units with veterancy stronger, and also have a lower chance to get hit. So, I mainly have two main questions.


1. What file within the Warzone file structure governs unit experience, and their bonuses?


2. Is it possible at all to add these features to a unit WITHOUT them gaining experience? For example, would it be possible to make a function where a certain body "lets say the New Paradigm bodies" have a lower chance of getting hit right out of the gate? Or would it be possible to make certain types of weapons more or less accurate against specific body types or propulsion systems?


For example, making machine guns less accurate against hovers and VTOLS?



I got this idea from an old game series called Vigilante 8. In that game you had 4 main factors of a car.


Image


It's Speed, Aceleration, HP, and "Avoidance Rating" the avoidance rating is the little crosshair at the bottom. Essentially the higher the avoidance rating, the lower the chance to hit the car with weapons like guided missiles and cannons. Would it be at all possible to implement a system such as this into warzone? Thanks.




-----------------------------------------------------------------------------------------------------


Edit; After reading through some of the past discussions on this topic, I came to some conclusions

I think the simplest way to implement this idea, if possible. Is to use the in-built system, I don't think there would be any need for complex formulas for this. The current system that uses the "Longhit" tag works well, however, all you would need to do for this system is to make it like this.



"Weapon Accuracy" - 100 %

"Body Accuracy" - 80 %

"Final accuracy" - 80%

Simply reduce the Weapons accuracy by the accuracy rating of the body.

User avatar
alfred007
Regular
Regular
Posts: 537
Joined: 31 Jul 2016, 06:25
Location: Stuttgart, Germany

Re: An idea About Unit Accuracy.

Post by alfred007 » 23 Feb 2019, 21:11

1. Look here.

Code: Select all

/* Experience modifies */
#define EXP_REDUCE_DAMAGE		6		// damage of a droid is reduced by this value per experience level, in %
#define EXP_ACCURACY_BONUS		5		// accuracy of a droid is increased by this value per experience level, in %
#define EXP_SPEED_BONUS			5		// speed of a droid is increased by this value per experience level, in %
2. The different bodies are having different armors, so that they suffer different damages from the same weapons. The base armors of every body for the campaign you find here, for MP games here.


Turin86 wrote:Or would it be possible to make certain types of weapons more or less accurate against specific body types or propulsion systems?

For example, making machine guns less accurate against hovers and VTOLS?
This feature is already implemented. You find the modifiers for the campaign here, for MP games here. It's the string weaponEffect in the file weapons.json that defines what modifier is applied to which weapon. Every weapon has also a modifier against different structures. All these stats are moddable. You find all stats files for the campaign here, for MP games here.

If you want to change these values you have to open the base.wz or the mp.wz files in the "data" folder of the game. You can open these files with 7-Zip and modify the included .js and .json files with, for example, Notepad++. If you want to know how to make a mod read the FAQ.

User avatar
Turin86
Greenhorn
Posts: 11
Joined: 25 May 2018, 17:18

Re: An idea About Unit Accuracy.

Post by Turin86 » 23 Feb 2019, 21:46

alfred007 wrote:
23 Feb 2019, 21:11
1. Look here.

Code: Select all

/* Experience modifies */
#define EXP_REDUCE_DAMAGE		6		// damage of a droid is reduced by this value per experience level, in %
#define EXP_ACCURACY_BONUS		5		// accuracy of a droid is increased by this value per experience level, in %
#define EXP_SPEED_BONUS			5		// speed of a droid is increased by this value per experience level, in %
2. The different bodies are having different armors, so that they suffer different damages from the same weapons. The base armors of every body for the campaign you find here, for MP games here.


Turin86 wrote:Or would it be possible to make certain types of weapons more or less accurate against specific body types or propulsion systems?

For example, making machine guns less accurate against hovers and VTOLS?
This feature is already implemented. You find the modifiers for the campaign here, for MP games here. It's the string weaponEffect in the file weapons.json that defines what modifier is applied to which weapon. Every weapon has also a modifier against different structures. All these stats are moddable. You find all stats files for the campaign here, for MP games here.

If you want to change these values you have to open the base.wz or the mp.wz files in the "data" folder of the game. You can open these files with 7-Zip and modify the included .js and .json files with, for example, Notepad++. If you want to know how to make a mod read the FAQ.



Right. But those functions dictate the Damage taken, I am trying to find if theres any way to change the ACCURACY of incoming fire?

User avatar
alfred007
Regular
Regular
Posts: 537
Joined: 31 Jul 2016, 06:25
Location: Stuttgart, Germany

Re: An idea About Unit Accuracy.

Post by alfred007 » 23 Feb 2019, 22:33

Turin86 wrote: Right. But those functions dictate the Damage taken, I am trying to find if theres any way to change the ACCURACY of incoming fire?
With the current accuracy system, it's not possible. At the moment your own accuracy increase with every experience level and the enemy accuracy decrease by the same value. I think like there are modifiers for the damage it should also in principle possible to implement modifiers for accuracy. But if you can't do it by your own you would have to convince one of the contributors to do it. And because they are not paid but doing this in their spare time I'm afraid that they don't have the time to do it because the formula for accuracy is hardcoded in combat.cpp.

Code: Select all

	int baseHitChance = 0;
	if (dist <= longRange && dist >= psStats->upgrade[psAttacker->player].minRange)
	{
		// get weapon chance to hit in the long range
		baseHitChance = weaponLongHit(psStats, psAttacker->player);

		// adapt for height adjusted artillery shots
		if (min_angle > DEG(PROJ_MAX_PITCH))
		{
			baseHitChance = baseHitChance * iCos(min_angle) / iCos(DEG(PROJ_MAX_PITCH));
		}
	}
	else
	{
		/* Out of range */
		objTrace(psAttacker->id, "combFire(%u[%s]->%u): Out of range", psAttacker->id, getName(psStats), psTarget->id);
		return false;
	}

	// apply experience accuracy modifiers to the base
	//hit chance, not to the final hit chance
	int resultHitChance = baseHitChance;

	// add the attacker's experience
	if (psAttacker->type == OBJ_DROID)
	{
		SDWORD	level = getDroidEffectiveLevel((DROID *) psAttacker);

		// increase total accuracy by EXP_ACCURACY_BONUS % for each experience level
		resultHitChance += EXP_ACCURACY_BONUS * level * baseHitChance / 100;
	}

	// subtract the defender's experience
	if (psTarget->type == OBJ_DROID)
	{
		SDWORD	level = getDroidEffectiveLevel((DROID *) psTarget);

		// decrease weapon accuracy by EXP_ACCURACY_BONUS % for each experience level
		resultHitChance -= EXP_ACCURACY_BONUS * level * baseHitChance / 100;
}
So it's more work to do it than just to make a mod.

User avatar
Turin86
Greenhorn
Posts: 11
Joined: 25 May 2018, 17:18

Re: An idea About Unit Accuracy.

Post by Turin86 » 24 Feb 2019, 01:31

Ok, I think that the way to possibly do this, would be to create a modified version of the script. Or a modified version of the experience script. (But the experience script is very complex so it will take me a little while longer to devise some sort of solution)


However, the "Evasion rating" As I will call it from now on, will need a few components to work.



Image





1. Define the value that would determine the evasion rating, and add it to the strings list.

2. A definition in the body.json file, it would be stated underneath the armor rating.

3. A script that calls to the value stated in the body.json value, and then plugs it into the forumla,
We know that it currently looks like this.



Code: Select all


{
		// get weapon chance to hit in the long range
		baseHitChance = weaponLongHit(psStats, psAttacker->player);

		// adapt for height adjusted artillery shots
		if (min_angle > DEG(PROJ_MAX_PITCH))
		{
			baseHitChance = baseHitChance * iCos(min_angle) / iCos(DEG(PROJ_MAX_PITCH));
		}
	



I think The key here lies in how the engine handles the artilley shots. I think A similar function could be used to calculate the chance to miss direct fire. Of course there is more to it than this, but this could be a step in the right direction.

Code: Select all

baseHitChance = baseHitChance * Evaderate / baseHitchance);

Post Reply