Home » SIRTECH CLASSICS » Jagged Alliance: Unfinished Business » Vanilla Modding » It seems that we need someone to hack into jaggedalliance2.com....
It seems that we need someone to hack into jaggedalliance2.com....[message #101569] Mon, 19 July 2004 00:47 Go to next message
HQ is currently offline HQ

 
Messages:10
Registered:July 2004
It's obvious that the way http://www.jaggedalliance2.com/secrets/index.html explained how to calculate sighting penalty and crouch/prone penalty is very different from the source code...you got to see it yourself. But I bet there are still many players refering to there how to calculate those things...it seems we need a hacker to hack in there to correct the formulas :type: .

Report message to a moderator

Private
Re: It seems that we need someone to hack into jaggedalliance2.com....[message #101570] Mon, 19 July 2004 05:25 Go to previous messageGo to next message
Snap is currently offline Snap

 
Messages:286
Registered:September 2000
Location: USA (by way of the Old Wo...
The site is now owned by SF, but I doubt they'll bother with such corrections.

BTW, if you could explain here the correct mechanisms, I would appreciate it. Also Lords of the Bytes has a section for various JA2 discoveries - you could post there.

Report message to a moderator

Master Sergeant
Re: It seems that we need someone to hack into jaggedalliance2.com....[message #101571] Mon, 19 July 2004 19:47 Go to previous messageGo to next message
HQ is currently offline HQ

 
Messages:10
Registered:July 2004
Ok, about the sighting penalty, in Weapons.c, line 2793, you'll find this code:

	iChance += 3 * ( NORMAL_RANGE - iSightRange ) / CELL_X_SIZE; 
Note that the other code around this line are disabled. The line above, is the sighting penalty. The NORMAL_RANGE, which can be found at line 50, is defined as 90, so it should be 9 tiles. Adding the things up, the actual sighting penalty should be:

3*(9 - X) (X = tiles away from target) (note: this may actually increase your accuracy if you are in close range, namely within 9 tiles from the target)

Instead of jaggedalliance2.com's "-2% to hit for each tile beyond 5".

About the crouch/prone penalty, first, in Weapons.h, you'll find the following:

#define POINT_BLANK_RANGE 16
Back to Weapons.c, begins at line 2837, you'll find how they calculate your accuracy penalties when your target is crouching/prone/standing (yes, you'll suffer a PENALTY when shooting at a standing target, if you are prone!)

	// adjust for crouched/prone target
		switch( gAnimControl[ pTarget->usAnimState ].ubHeight )
		{
			case ANIM_CROUCH:
				if ( TANK( pSoldier ) && iRange < MIN_TANK_RANGE )
				{
					// 13% penalty per tile closer than min range
					iChance -= 13 * ( ( MIN_TANK_RANGE - iRange ) / CELL_X_SIZE );
				}
				else
				{
					// at anything other than point-blank range
					if (iRange > POINT_BLANK_RANGE + 10 * (AIM_PENALTY_TARGET_CROUCHED / 3) )
					{
						iChance -= AIM_PENALTY_TARGET_CROUCHED;
					}
					else if (iRange > POINT_BLANK_RANGE)
					{
						// at close range give same bonus as prone, up to maximum of AIM_PENALTY_TARGET_CROUCHED
						iChance -= 3 * ((iRange - POINT_BLANK_RANGE) / CELL_X_SIZE); // penalty -3%/tile
					}
				}
				break;
			case ANIM_PRONE:
				if ( TANK( pSoldier ) && iRange < MIN_TANK_RANGE )
				{
					// 25% penalty per tile closer than min range
					iChance -= 25 * ( ( MIN_TANK_RANGE - iRange ) / CELL_X_SIZE );
				}
				else
				{
					// at anything other than point-blank range
					if (iRange > POINT_BLANK_RANGE)
					{
						// reduce chance to hit with distance to the prone/immersed target
						iPenalty = 3 * ((iRange - POINT_BLANK_RANGE) / CELL_X_SIZE); // penalty -3%/tile
						iPenalty = __min( iPenalty, AIM_PENALTY_TARGET_PRONE );

						iChance -= iPenalty;
					}
				}
				break;
			case ANIM_STAND:
				// if we are prone and at close range, then penalize shots to the torso or head!
				if ( iRange <= MIN_PRONE_RANGE && gAnimControl[ pSoldier->usAnimState ].ubEndHeight == ANIM_PRONE )
				{
					if ( ubAimPos == AIM_SHOT_RANDOM || ubAimPos == AIM_SHOT_GLAND )
					{
						ubAdjAimPos = AIM_SHOT_TORSO;
					}
					else
					{
						ubAdjAimPos = ubAimPos;
					}
					// lose 10% per height difference, lessened by distance
					// e.g. 30% to aim at head at range 1, only 10% at range 3
					// or 20% to aim at torso at range 1, no penalty at range 3
					// NB torso aim position is 2, so (5-aimpos) is 3, for legs it's 2, for head 4
					iChance -= (5 - ubAdjAimPos - iRange / CELL_X_SIZE) * 10;
				} 
To make things short, you'll first suffer 1% penalty if you are aiming at a target 3 tiles away, and then for each additional 1 tile away you'll suffer 3% more, until you reach 20% (if the target is in crouch position) or 40% (if the target is prone). About the penalty of shooting at a standing target, the code already explained it clearly enough. Smile

Report message to a moderator

Private
Re: It seems that we need someone to hack into jaggedalliance2.com....[message #101572] Tue, 20 July 2004 00:52 Go to previous messageGo to next message
Tox is currently offline Tox

 
Messages:249
Registered:February 2000
Location: www.webcodesign.de
well, I think the reason might be that we have the sourcecode of the 1.12 version AFAIK. the info given on jaggedalliance2.com is based on 1.03.

Report message to a moderator

Sergeant 1st Class
JA2STI Creator
Re: It seems that we need someone to hack into jaggedalliance2.com....[message #101573] Tue, 20 July 2004 11:04 Go to previous messageGo to next message
Snap is currently offline Snap

 
Messages:286
Registered:September 2000
Location: USA (by way of the Old Wo...
Interesting. OK, I finally took a look at the source myself. Regarding the sight range penalty, judging by the comments in the code, it looks like they in fact did something different in UB (JA2.5), which was then ported back to JA2 Gold.

// Effects based on aiming & sight
// From for JA2.5:  3% bonus/penalty for each tile different from range NORMAL_RANGE.
// This doesn't provide a bigger bonus at close range, but stretches it out, making medium 
// range less penalized, and longer range more penalized
iChance += 3 * ( NORMAL_RANGE - iSightRange ) / CELL_X_SIZE;
/*
if (iSightRange < NORMAL_RANGE)
{
	// bonus to hit of 20% at point blank (would be 25% at range 0);
	//at NORMAL_RANGE, bonus is 0
	iChance += 25 * (NORMAL_RANGE - iSightRange) / NORMAL_RANGE;
}
else
{
	// penalty of 2% / tile
	iChance -= (iSightRange - NORMAL_RANGE) / 5;
}
*/
However, the old code still differs from what's on the site, which is something like this:

if (iSightRange > 5) iChance -= (iSightRange/CELL_X_SIZE - 5)*2;
Now where does that come from? I couldn't find anything like that in the source.

Report message to a moderator

Master Sergeant
Re: It seems that we need someone to hack into jaggedalliance2.com....[message #101574] Tue, 20 July 2004 12:21 Go to previous messageGo to next message
Snap is currently offline Snap

 
Messages:286
Registered:September 2000
Location: USA (by way of the Old Wo...
Another thing that's wrong on the site is this:

Quote:
At night time, the sight range is scaled. If your maximum sighting distance is half of normal, then each tile between you and your target will count as two for sight range purposes.
I always knew that was not the case. Perhaps that was the intention at some point, but as implemented the scaling doesn't occur.

Report message to a moderator

Master Sergeant
Re: It seems that we need someone to hack into jaggedalliance2.com....[message #101575] Tue, 20 July 2004 17:38 Go to previous messageGo to next message
Snap is currently offline Snap

 
Messages:286
Registered:September 2000
Location: USA (by way of the Old Wo...
Updated the first of my articles on shooting models with corrected plots for JA2 CtH (and added a couple of new ones):

Shooting model

Report message to a moderator

Master Sergeant
Re: It seems that we need someone to hack into jaggedalliance2.com....[message #101576] Mon, 26 July 2004 09:28 Go to previous messageGo to next message
DNA from the Lowlands is currently offline DNA from the Lowlands

 
Messages:337
Registered:July 2003
T.Y. :bow:
I'll be back for this, soon as I've got some attentionspan...

That piece about headshots-up-close-when-proned, I allready have a Q, Do rooftops have influence?

Report message to a moderator

Master Sergeant
Re: It seems that we need someone to hack into jaggedalliance2.com....[message #101577] Sun, 08 August 2004 14:03 Go to previous message
Chris Camfield is currently offline Chris Camfield

 
Messages:68
Registered:February 2000
Location: Toronto, Ontario
I don't remember for sure, but I expect that we did do more balancing and tweaking after I wrote that article about to-hit calculations. Smile

Report message to a moderator

Corporal
Previous Topic: time to code
Next Topic: Just a simple bug-fix patch
Goto Forum:
  


Current Time: Sun Jan 26 17:04:35 GMT+2 2025

Total time taken to generate the page: 0.00972 seconds