Home » MODDING HQ 1.13 » v1.13 Coding Talk » Code Snippets  () 1 Vote
Re: Code Snippets[message #332754] Sat, 17 May 2014 23:06 Go to previous messageGo to next message
Deleted.

 
Messages:2663
Registered:December 2012
Location: Russian Federation
@rummtata

You can turn off tooltips at any time using Shift+D

[Updated on: Mon, 09 March 2015 16:30]

Report message to a moderator

Lieutenant

Re: Code Snippets[message #332755] Sat, 17 May 2014 23:16 Go to previous messageGo to next message
rummtata is currently offline rummtata

 
Messages:103
Registered:April 2011
Location: Germany
Indeed. And I had been searching the .ini options like mad. Silly me :wb: thanks Seven =)

Report message to a moderator

Sergeant
Re: Code Snippets[message #332757] Sun, 18 May 2014 01:25 Go to previous messageGo to next message
Deleted.

 
Messages:2663
Registered:December 2012
Location: Russian Federation
Improved NCTH cursor

;------------------------------------------------------------------------------------------------------------------------------
; Visual improvements for NCTH cursor:
; 0 - default cursor
; 1 - improved cursor: show extended AP info, laser dot, scope mode icon, limit maximum displayed aperture size (100)
; 2 - compact cursor:  aiming level as numbers, limit displayed autofire bullets (10), limit maximum displayed aperture size (50)
;------------------------------------------------------------------------------------------------------------------------------
IMPROVED_NCTH_CURSOR = 0

r7208 patch
gamedir 2035 patch

Report message to a moderator

Lieutenant

Re: Code Snippets[message #332792] Sun, 18 May 2014 18:43 Go to previous messageGo to next message
wanne (aka RoWa21) is currently offline wanne (aka RoWa21)

 
Messages:1961
Registered:October 2005
Location: Austria
thanks Sevenfm for the NCTH improvements. Patch file has been committed to the development trunk

Report message to a moderator

Sergeant Major

Re: Code Snippets[message #333441] Tue, 03 June 2014 17:06 Go to previous messageGo to next message
Deleted.

 
Messages:2663
Registered:December 2012
Location: Russian Federation
Translated russian comments patch for stable r7253, if anyone interested.

EDIT: it works correctly on the current dev branch, too

[Updated on: Tue, 03 June 2014 18:22] by Moderator

Report message to a moderator

Lieutenant

Re: Code Snippets[message #333451] Tue, 03 June 2014 21:11 Go to previous messageGo to next message
wanne (aka RoWa21) is currently offline wanne (aka RoWa21)

 
Messages:1961
Registered:October 2005
Location: Austria
Sevenfm
Translated russian comments patch for stable r7253, if anyone interested.

EDIT: it works correctly on the current dev branch, too


Nice, committed.

Report message to a moderator

Sergeant Major

Re: Code Snippets[message #333789] Thu, 19 June 2014 17:01 Go to previous messageGo to next message
Deleted.

 
Messages:2663
Registered:December 2012
Location: Russian Federation
For those who want to use 25AP system with recent builds.

1. Bugfix: AP_JUMPWALL and AP_JUMPOFFWALL were swapped when read from ini.

2. Problem: Only default values from ini were converted in DynamicAdjustAPConstants.
I know it was intended by CHRISL, but it's not good to have constants in two different systems in one ini file at the same time.
Also with default behaviour you have to look at the code (to know exactly "default" value) each time when you want to change any AP related option to be sure.
Fix: check for default option disabled

stable r7277 patch

trunk r7277 patch

Note: this bug is also present in 4870 official release

Report message to a moderator

Lieutenant

Re: Code Snippets[message #333838] Sat, 21 June 2014 13:00 Go to previous messageGo to next message
wanne (aka RoWa21) is currently offline wanne (aka RoWa21)

 
Messages:1961
Registered:October 2005
Location: Austria
Sevenfm
For those who want to use 25AP system with recent builds.

1. Bugfix: AP_JUMPWALL and AP_JUMPOFFWALL were swapped when read from ini.

2. Problem: Only default values from ini were converted in DynamicAdjustAPConstants.
I know it was intended by CHRISL, but it's not good to have constants in two different systems in one ini file at the same time.
Also with default behaviour you have to look at the code (to know exactly "default" value) each time when you want to change any AP related option to be sure.
Fix: check for default option disabled

stable r7277 patch

trunk r7277 patch

Note: this bug is also present in 4870 official release


thanks, committed.

Report message to a moderator

Sergeant Major

Re: Code Snippets[message #337412] Fri, 31 October 2014 16:49 Go to previous messageGo to next message
Deleted.

 
Messages:2663
Registered:December 2012
Location: Russian Federation
Mini-fix for suppression system

1. For some unknown reason MAX_CTH_PENALTY_FROM_SHOCK and MAX_CTH_PENALTY_FOR_TARGET_SHOCK were swapped when read from ini.

Fixed that, so now:

MAX_CTH_PENALTY_FROM_SHOCK -> usMaxShooterCoweringPenalty
It's the amount of CTH penalty that shooter receives from his own shock.

MAX_CTH_PENALTY_FOR_TARGET_SHOCK -> usMaxTargetCoweringPenalty
It's the amount of CTH penalty that shooter receives from his target's shock (when the target is cowering)

2. At some point ths amount of shock needed for "cowering" state was modified by traits and backgrounds (new trait system only)
Unfortunately, the changes were applied only for starting cowering animation, but not for corresponding effects (additional AC from cowering, sight range limits, suppression tolerance calculation)

Fixed that, so now:

BOOLEAN CoweringShockLevel( SOLDIERTYPE * pSoldier )
is used in all places where the shock is checked for cowering level.
CalcEffectiveShockLevel( pSoldier ) is used in CalcSuppressionTolerance function instead of simple bShock.

This should prevent situation when player sees cowering animation and message, but the effects are not applied and vice versa.

stable 7620 patch
trunk 7619 patch

Report message to a moderator

Lieutenant

Re: Code Snippets[message #337414] Fri, 31 October 2014 17:33 Go to previous messageGo to next message
silversurfer

 
Messages:2793
Registered:May 2009
Thanks for the fix. Smile

Committed in r7621 (r7622).

Report message to a moderator

Lieutenant
Re: Code Snippets[message #339966 is a reply to message #337414] Mon, 09 March 2015 16:29 Go to previous messageGo to next message
Deleted.

 
Messages:2663
Registered:December 2012
Location: Russian Federation
Simplified ImprovedAutoFastForward feature (allows to accelerate only invisible enemies)

Now single option IMPROVED_AUTO_FAST_FORWARD=TRUE by default
Removed options:
AUTO_FAST_FORWARD_ENEMIES
AUTO_FAST_FORWARD_MILITIA
AUTO_FAST_FORWARD_CIVS
AUTO_FAST_FORWARD_CREATURES
ENEMY_CLOCK_SPEED_PERCENT

Also a small fix (additional update of AutoFastForward status when soldier arrives at new gridno)

source r7773 patch
gamedir r2220 patch



Left this community.

Report message to a moderator

Lieutenant

Re: Code Snippets[message #339979 is a reply to message #339966] Tue, 10 March 2015 03:15 Go to previous messageGo to next message
Buggler is currently offline Buggler

 
Messages:211
Registered:November 2009
So with Simplified ImprovedAutoFastForward patch, there's no more control for each factions to always auto fast forward movement (even when visible)?
With the massively increased teams feature, would still prefer to have their individual settings so that Civilians can fast forward even if visible (probably many will do so) as well as militia (they are just cannon fodder to me).

ENEMY_CLOCK_SPEED_PERCENT is a single setting that adjusts the game speed for all other factions' turn right?
Would still like to have that setting available as it accelerates game to the player preference during non-player turn without affecting the base game speed. happy

No actual gameplay experience since 4870 so interpretation could be wrong based on INI comments. ;)

Edit:
Reply for sevenfm's post below:
Then there shouldn't be any issues in eliminating the extraneous settings. happy

[Updated on: Tue, 10 March 2015 14:38]




No savegame (just before e bug occurs), no cure.

'Not everything that counts can b counted, n not everything that can b counted counts' - Albert Einstein
I may answer/reply in my old public posts & prefer PM over e former [FUDforum's PM suxx]

Report message to a moderator

Sergeant 1st Class
Re: Code Snippets[message #339984 is a reply to message #339979] Tue, 10 March 2015 10:24 Go to previous messageGo to next message
Deleted.

 
Messages:2663
Registered:December 2012
Location: Russian Federation
Buggler you can always use
Quote:
PLAYER_TURN_SPEED_UP_FACTOR = 1.0
ENEMY_TURN_SPEED_UP_FACTOR = 1.0
CREATURE_TURN_SPEED_UP_FACTOR = 1.0
MILITIA_TURN_SPEED_UP_FACTOR = 1.0
CIVILIAN_TURN_SPEED_UP_FACTOR = 1.0

So no need to overcomplicate things :-)



Left this community.

Report message to a moderator

Lieutenant

Re: Code Snippets[message #340483 is a reply to message #339984] Tue, 07 April 2015 17:23 Go to previous messageGo to next message
Deleted.

 
Messages:2663
Registered:December 2012
Location: Russian Federation
Looks like CalcManThreatValue in AIUtils.cpp doesn't take into account 100AP system:
		// ADD man's total action points (10-35)
		iThreatValue += pEnemy->CalcActionPoints();

		// ADD 1/2 of man's current action points (4-17)
		iThreatValue += (pEnemy->bActionPoints / 2);


Maybe better use smth like
		// ADD man's total action points (10-35)
		iThreatValue += 25 * pEnemy->CalcActionPoints() / APBPConstants[AP_MAXIMUM];

		// ADD 1/2 of man's current action points (4-17)
		iThreatValue += 25*pEnemy->bActionPoints / APBPConstants[AP_MAXIMUM] / 2;



Left this community.

Report message to a moderator

Lieutenant

Re: Code Snippets[message #340485 is a reply to message #340483] Tue, 07 April 2015 17:49 Go to previous messageGo to next message
silversurfer

 
Messages:2793
Registered:May 2009
??? The function CalcActionPoints() uses the 100AP system and returns a proper value according to the 100AP system.


Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Report message to a moderator

Lieutenant
Re: Code Snippets[message #340486 is a reply to message #340485] Tue, 07 April 2015 17:53 Go to previous messageGo to next message
Deleted.

 
Messages:2663
Registered:December 2012
Location: Russian Federation
From the comments, this function originally was designed to use 25 AP system.
Now AP value became 4 times more important than other values.



Left this community.

Report message to a moderator

Lieutenant

Re: Code Snippets[message #340487 is a reply to message #340486] Tue, 07 April 2015 18:54 Go to previous messageGo to next message
silversurfer

 
Messages:2793
Registered:May 2009
Ah, I see. You mean the weighting of AP is wrong now. I committed your fix in r7810.


Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Report message to a moderator

Lieutenant
Re: Code Snippets[message #340664 is a reply to message #339966] Wed, 22 April 2015 15:03 Go to previous messageGo to next message
Deleted.

 
Messages:2663
Registered:December 2012
Location: Russian Federation
sevenfm wrote on Mon, 09 March 2015 19:29
Simplified ImprovedAutoFastForward feature (allows to accelerate only invisible enemies)

Now single option IMPROVED_AUTO_FAST_FORWARD=TRUE by default
Removed options:
AUTO_FAST_FORWARD_ENEMIES
AUTO_FAST_FORWARD_MILITIA
AUTO_FAST_FORWARD_CIVS
AUTO_FAST_FORWARD_CREATURES
ENEMY_CLOCK_SPEED_PERCENT

Also a small fix (additional update of AutoFastForward status when soldier arrives at new gridno)


This was committed in r7828 (thanks Flugente!)



Left this community.

Report message to a moderator

Lieutenant

thumbs25.png  Re: Code Snippets[message #341171 is a reply to message #340664] Tue, 26 May 2015 12:23 Go to previous messageGo to next message
Deleted.

 
Messages:2663
Registered:December 2012
Location: Russian Federation
Ja2_options.ini says that you can control max CTH penalty from movement:
Quote:
; How much CTH can be lost in total due to the movement of your target?
MAX_CTH_PENALTY_FOR_MOVING_TARGET = 30

But you can't, because in gamesettings.cpp another value is used
// HEADROCK HAM 3.3: Externalized maximum possible penalty for hitting a moving target. JA2 Default = 30.
gGameExternalOptions.usMaxCTHPenaltyForMovingTarget = iniReader.ReadInteger("Tactical Gameplay Settings","MAX_CTH_PENALTY_FOR_TARGET_MOVEMENT", 30, 0, 300);

Even more, even this value is not used in the code!
// penalty for amount that enemy has moved
// HEADROCK HAM B2.6: Externalized the value
iPenalty = __min( (UINT16)((float)pTarget->bTilesMoved * (float)gGameExternalOptions.iMovementEffectOnAiming), 30 );

suprised



Left this community.

Report message to a moderator

Lieutenant

Re: Code Snippets[message #341174 is a reply to message #341171] Tue, 26 May 2015 14:12 Go to previous messageGo to next message
silversurfer

 
Messages:2793
Registered:May 2009
Hehe, looks like Headrock externalized the value and forgot to finish it. As of r7878 the value is read correctly and now applies to OCTH as intended.


Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Report message to a moderator

Lieutenant
Re: Code Snippets[message #342074 is a reply to message #341174] Thu, 13 August 2015 17:15 Go to previous messageGo to next message
Deleted.

 
Messages:2663
Registered:December 2012
Location: Russian Federation
Think I found another small 100AP issue in TacticalAI\AIUtils.cpp

In BOOLEAN IsActionAffordable(SOLDIERTYPE *pSoldier)
Quote:
INT8 bAPToLookAtWall = ( FindDirectionForClimbing( pSoldier, pSoldier->sGridNo, pSoldier->pathing.bLevel ) == pSoldier->ubDirection ) ? 0 : 1;

Maybe better use GetAPsToLook(pSoldier) to get correct APs in 100AP system?
Quote:
INT8 bAPToLookAtWall = ( FindDirectionForClimbing( pSoldier, pSoldier->sGridNo, pSoldier->pathing.bLevel ) == pSoldier->ubDirection ) ? 0 : GetAPsToLook(pSoldier);




Left this community.

Report message to a moderator

Lieutenant

Re: Code Snippets[message #342077 is a reply to message #342074] Thu, 13 August 2015 21:10 Go to previous messageGo to next message
Flugente

 
Messages:3509
Registered:April 2009
Location: Germany
It's also not necessary to calculate that for every action, since it's only used for AI_ACTION_CLIMB_ROOF - fixed in r7972.


I know now that it could never work between us, as much as we wanted to, it could never be! Not because you're a rabbit, but because you're black.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.

Report message to a moderator

Captain

Re: Code Snippets[message #342100 is a reply to message #342077] Mon, 17 August 2015 19:02 Go to previous messageGo to next message
Deleted.

 
Messages:2663
Registered:December 2012
Location: Russian Federation
Strange code in GameSettings.cpp r7975
//[Meduna]
gModSettings.ubQueenBasementSectorX = iniReader.ReadInteger("San Mona", "QUEEN_BASEMENT_SECTOR_X", 3);
gModSettings.ubQueenBasementSectorY = iniReader.ReadInteger("San Mona", "QUEEN_BASEMENT_SECTOR_Y", 16);
gModSettings.ubQueenBasementSectorZ = iniReader.ReadInteger("San Mona", "QUEEN_BASEMENT_SECTOR_Z", 1);
gModSettings.iQueenAlternateGridNo = iniReader.ReadInteger("San Mona", "QUEEN_ALTERNATE_GRIDNO", 11448);

This looks like a copypaste bug - comment says "Meduna" but the code will try to read ini value from "San Mona" ini section.



Left this community.

Report message to a moderator

Lieutenant

Re: Code Snippets[message #342101 is a reply to message #342100] Mon, 17 August 2015 20:04 Go to previous messageGo to next message
silversurfer

 
Messages:2793
Registered:May 2009
Definitely a copy+paste bug. Fixed in r7976.


Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Report message to a moderator

Lieutenant
Re: Code Snippets[message #343363 is a reply to message #342101] Sun, 29 November 2015 21:07 Go to previous messageGo to next message
Deleted.

 
Messages:2663
Registered:December 2012
Location: Russian Federation
Tactical\opplist.cpp
INT8 FindUnusedWatchedLoc( UINT8 ubID )
{
	INT8 bLoop;

	for ( bLoop = 0; bLoop < NUM_WATCHED_LOCS; bLoop++ )
	{
		// WANNE: I think this was a bug, should be != NOWHERE!
		//if ( gsWatchedLoc[ ubID ][ bLoop ] == NOWHERE )

		if (!TileIsOutOfBounds(gsWatchedLoc[ ubID ][ bLoop ]))
		{
			return( bLoop );
		}
	}
	return( -1 );
}

I think this 'fix' is wrong and prevents game from using "Watched Locations" system completely.

gsWatchedLoc array is initialized with NOWHERE values
// initialize public last known locations for all teams
	for (cnt = 0; cnt < MAX_NUM_SOLDIERS; cnt++)
	{
		for (cnt2 = 0; cnt2 < NUM_WATCHED_LOCS; cnt2++ )
		{
			gsWatchedLoc[ cnt ][ cnt2 ] = NOWHERE;
			gubWatchedLocPoints[ cnt ][ cnt2 ] = 0;
			gfWatchedLocReset[ cnt ][ cnt2 ] = FALSE;
		}
	}

So if we want to find unused location, we search for NOWHERE value.

[Updated on: Sun, 29 November 2015 21:53]




Left this community.

Report message to a moderator

Lieutenant

Re: Code Snippets[message #343511 is a reply to message #343363] Sat, 19 December 2015 15:12 Go to previous messageGo to next message
Deleted.

 
Messages:2663
Registered:December 2012
Location: Russian Federation
Some AI/tactical fixes and improvements

Bugfixes:
Fix: Watched Locations system (never worked in 1.13)
Fix: LineOfSight test with NO_DISTANCE_LIMIT (stopped on trees previously)

AI/tactical improvements:
- EstimateThrowDamage additionally calculates damage from fragments (important for AI to use frag grenades with low main damage and many fragments)
- EstimateThrowDamage correctly adds IndoorModifier
- Additional checks for RED suppression (check that the soldier will not shoot his friends, check that he has extra clip to reload weapon, check that target is not cowering, don't suppress when flanking)
- ClosestReachableDisturbance will use general noise only if cannot find any enemy
- Allow RED seeking in prone stance if we haven't seen enemy for several turns

Flanking improvements:
- allow YELLOW flanking for CLOSEPATROL at night
- better YELLOW/RED flanking start/stop conditions
- better RED AI behavior when finished flanking (try to reach flanking spot)
- allow RED flanking for CLOSEPATROL soldiers when at night, overcrowded or no other flanking soldiers yet

Optional AI improvements:
AI_EXTRA_SUPPRESSION
AI will use suppression fire more often in RED state (set minimum AI CTH to 1)

AI_NEW_MORALE
Better dynamic morale calculation depending on tactical situation.
Additional min/max limits for AI morale
Disabled HOPELESS morale for soldiers without guns (they can pick up weapon or attack with hands sometimes)

AI_BETTER_COVER
Additional checks for line of sight, fresh corpses and overcrowded locations

AI_EXTRA_FLANKING
Allow flanking for BRAVEAID/BRAVESOLO

source 8005 patch
gamedir 2274 patch

[Updated on: Sat, 19 December 2015 15:32]




Left this community.

Report message to a moderator

Lieutenant

Re: Code Snippets[message #343512 is a reply to message #343511] Sat, 19 December 2015 16:14 Go to previous messageGo to next message
silversurfer

 
Messages:2793
Registered:May 2009
Wow, looks like you've been very busy. happy

I committed your changes to r8006 with GameDir 2275.



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Report message to a moderator

Lieutenant
Re: Code Snippets[message #343522 is a reply to message #343512] Sun, 20 December 2015 13:00 Go to previous messageGo to next message
Slax is currently offline Slax

 
Messages:1411
Registered:July 2006
Location: People riding polar bears...
Oh lordy! Big ol' AI update? Delicious.


1.13: Install JA2, unpack latest, play.
AIMNAS: Complete 1.13 installation, Download ZIP and unpack, play.

Report message to a moderator

Sergeant Major
Re: Code Snippets[message #343916 is a reply to message #343522] Sun, 31 January 2016 17:25 Go to previous messageGo to next message
Deleted.

 
Messages:2663
Registered:December 2012
Location: Russian Federation
TacticalAI\Knowledge.cpp

// Flugente: chance to ignore the noise if the ceator is covert
		if ( pTemp->usSoldierFlagMask & (SOLDIER_COVERT_CIV|SOLDIER_COVERT_SOLDIER) )
		{
			// green  AI state: always ignore
			// yellow AI state: 50% chance to ignore
			if ( pSoldier->aiData.bAlertStatus == STATUS_GREEN ||
			    (pSoldier->aiData.bAlertStatus == STATUS_GREEN && Random(2) < 1 ) )
				continue;			// next merc
		}

should be

// Flugente: chance to ignore the noise if the creator is covert
		if ( pTemp->usSoldierFlagMask & (SOLDIER_COVERT_CIV|SOLDIER_COVERT_SOLDIER) )
		{
			// green  AI state: always ignore
			// yellow AI state: 50% chance to ignore
			if ( pSoldier->aiData.bAlertStatus == STATUS_GREEN || 
			    (pSoldier->aiData.bAlertStatus == STATUS_YELLOW && Random(2) < 1 ) )
				continue;			// next merc
		}




Left this community.

Report message to a moderator

Lieutenant

Re: Code Snippets[message #343917 is a reply to message #343916] Sun, 31 January 2016 17:29 Go to previous messageGo to next message
Flugente

 
Messages:3509
Registered:April 2009
Location: Germany
Good catch! Committed in r8046.

[Updated on: Sun, 31 January 2016 17:29]




I know now that it could never work between us, as much as we wanted to, it could never be! Not because you're a rabbit, but because you're black.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.

Report message to a moderator

Captain

Re: Code Snippets[message #344392 is a reply to message #343917] Sat, 05 March 2016 15:25 Go to previous messageGo to next message
Deleted.

 
Messages:2663
Registered:December 2012
Location: Russian Federation
In TacticalAI\AIUtils.cpp

In function NewDest, when deciding to use SWATTING for taking cover:

if ( IS_MERC_BODY_TYPE( pSoldier ) && pSoldier->aiData.bAction == AI_ACTION_TAKE_COVER &&
 (pSoldier->aiData.bOrders == DEFENSIVE || pSoldier->aiData.bOrders == CUNNINGSOLO || pSoldier->aiData.bOrders == CUNNINGAID ) && (SoldierDifficultyLevel( pSoldier ) >= 2) )

this looks like vanilla bug - comparing orders with attitude, should be:
if ( IS_MERC_BODY_TYPE( pSoldier ) && pSoldier->aiData.bAction == AI_ACTION_TAKE_COVER &&
 (pSoldier->aiData.bAttitude == DEFENSIVE || pSoldier->aiData.bAttitude == CUNNINGSOLO || pSoldier->aiData.bAttitude == CUNNINGAID ) && (SoldierDifficultyLevel( pSoldier ) >= 2) )




Left this community.

Report message to a moderator

Lieutenant

Re: Code Snippets[message #344393 is a reply to message #344392] Sat, 05 March 2016 16:33 Go to previous messageGo to next message
silversurfer

 
Messages:2793
Registered:May 2009
Good catch. Those are definitely not orders but attitudes. Fixed in r8091.


Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Report message to a moderator

Lieutenant
Re: Code Snippets[message #344708 is a reply to message #344393] Sat, 26 March 2016 10:27 Go to previous messageGo to next message
Deleted.

 
Messages:2663
Registered:December 2012
Location: Russian Federation
AI update:

https://www.dropbox.com/s/hbkjaxv8lc66rpt/r8124_AI.patch?dl=0

Details:
- removed AI_EXTRA_FLANKING option
- LocationToLocationLineOfSightTest allows to check sight with specified height
- IsActionAffordable allows to specify action to check without faking it
- ClosestReachableDisturbance: correctly calculate path to each disturbance, added safety checks, update for noise checks
- CalcMoraleNew: update
- CalcBestShot: allow shooting at empty vehicles, but they have low priority
- allow AI to fire at dying opponents to avoid AI decision problems
- CheckIfShotPossible: allow any soldier with long range weapon to shoot in RED state (if he can hit)
- Flanking update
- WATCH decision update
- removed distance check for HELP decision to allow vanilla behavior, don't help if seen enemy recently or under fire
- suppression fire update
- pick up item decision: check that location is safe



Left this community.

Report message to a moderator

Lieutenant

Re: Code Snippets[message #344717 is a reply to message #344708] Sat, 26 March 2016 15:30 Go to previous messageGo to next message
Flugente

 
Messages:3509
Registered:April 2009
Location: Germany
Thanks, committed in r8125.


I know now that it could never work between us, as much as we wanted to, it could never be! Not because you're a rabbit, but because you're black.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.

Report message to a moderator

Captain

Re: Code Snippets[message #345154 is a reply to message #344717] Fri, 22 April 2016 15:53 Go to previous messageGo to next message
Deleted.

 
Messages:2663
Registered:December 2012
Location: Russian Federation
In Soldier Init List.cpp:
// we simply look for a entry point inside a bigger circle, but not inside the merc deployment zone.
INT32 bettergridno = NOWHERE;
UINT16 counter = 0;
UINT8 ubDirection = DIRECTION_IRRELEVANT;

while ( counter < 100 && (bettergridno == NOWHERE || PythSpacesAway( bettergridno, gMapInformation.sCenterGridNo ) <= gAmbushRadiusModifier * gGameExternalOptions.usAmbushEnemyEncircleRadius1) )
{
	bettergridno = FindRandomGridNoBetweenCircles( gMapInformation.sCenterGridNo, gAmbushRadiusModifier * 	gGameExternalOptions.usAmbushEnemyEncircleRadius1, gAmbushRadiusModifier * gGameExternalOptions.usAmbushEnemyEncircleRadius2, ubDirection );
}

if ( bettergridno != NOWHERE )
{
	tempDetailedPlacement.sInsertionGridNo = bettergridno;

	// have the soldier look inward. We add + 100 because later on we use this to signify that we want really enforce this direction
	tempDetailedPlacement.ubDirection = (UINT8)GetDirectionToGridNoFromGridNo( tempDetailedPlacement.sInsertionGridNo, gMapInformation.sCenterGridNo ) + 100;
}


The counter variable is added probably to prevent endless loop, but it's never incremented.



Left this community.

Report message to a moderator

Lieutenant

Re: Code Snippets[message #345165 is a reply to message #345154] Sat, 23 April 2016 17:29 Go to previous messageGo to next message
Flugente

 
Messages:3509
Registered:April 2009
Location: Germany
sevenfm wrote on Fri, 22 April 2016 12:53
In Soldier Init List.cpp:
// we simply look for a entry point inside a bigger circle, but not inside the merc deployment zone.
INT32 bettergridno = NOWHERE;
UINT16 counter = 0;
UINT8 ubDirection = DIRECTION_IRRELEVANT;

while ( counter < 100 && (bettergridno == NOWHERE || PythSpacesAway( bettergridno, gMapInformation.sCenterGridNo ) <= gAmbushRadiusModifier * gGameExternalOptions.usAmbushEnemyEncircleRadius1) )
{
	bettergridno = FindRandomGridNoBetweenCircles( gMapInformation.sCenterGridNo, gAmbushRadiusModifier * 	gGameExternalOptions.usAmbushEnemyEncircleRadius1, gAmbushRadiusModifier * gGameExternalOptions.usAmbushEnemyEncircleRadius2, ubDirection );
}

if ( bettergridno != NOWHERE )
{
	tempDetailedPlacement.sInsertionGridNo = bettergridno;

	// have the soldier look inward. We add + 100 because later on we use this to signify that we want really enforce this direction
	tempDetailedPlacement.ubDirection = (UINT8)GetDirectionToGridNoFromGridNo( tempDetailedPlacement.sInsertionGridNo, gMapInformation.sCenterGridNo ) + 100;
}


The counter variable is added probably to prevent endless loop, but it's never incremented.

Hu. Good spot. Fixed in r8169.



I know now that it could never work between us, as much as we wanted to, it could never be! Not because you're a rabbit, but because you're black.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.

Report message to a moderator

Captain

Re: Code Snippets[message #345575 is a reply to message #345165] Wed, 18 May 2016 01:58 Go to previous messageGo to next message
Deleted.

 
Messages:2663
Registered:December 2012
Location: Russian Federation
AI and tactics improvements

New options:
AI_YELLOW_FLANKING - yellow flanking is disabled by default
IMPROVED_TACTICAL_UI - use name color to show soldier's status (disguised, drunk)

Removed obsolete options:
SHOW_COVER_INDICATOR
SHOW_ENEMY_RANK_ICON
SHOW_ENEMY_AWARENESS

Fixes and improvements:
- collapsed enemies should not taunt
- if soldier is unconscious, he can't see anything or anybody
- ClosestReachableDisturbance - performance improvement
- allow InternalGoAsFarAsPossibleTowards to jump over fences

Patch:
https://www.dropbox.com/s/6mqjb26xqu4qsdl/trunk_8221.patch?dl=0
https://www.dropbox.com/s/fbpmyazbi0cctfp/gamedir_2321.patch?dl=0



Left this community.

Report message to a moderator

Lieutenant

Re: Code Snippets[message #345580 is a reply to message #345575] Wed, 18 May 2016 12:37 Go to previous messageGo to next message
Deleted.

 
Messages:2663
Registered:December 2012
Location: Russian Federation
In Soldier Control.cpp / SeemsLegit():

// are we targeting a buddy of our observer?
if ( this->ubTargetID && MercPtrs[this->ubTargetID] && MercPtrs[this->ubTargetID]->bTeam == pSoldier->bTeam )
{
...
}


should be
// are we targeting a buddy of our observer?
if ( this->ubTargetID != NOBODY && MercPtrs[this->ubTargetID] && MercPtrs[this->ubTargetID]->bTeam == pSoldier->bTeam )
{
...
}




Left this community.

Report message to a moderator

Lieutenant

Re: Code Snippets[message #345602 is a reply to message #345575] Fri, 20 May 2016 21:16 Go to previous messageGo to next message
silversurfer

 
Messages:2793
Registered:May 2009
sevenfm wrote on Wed, 18 May 2016 00:58
AI and tactics improvements

I think this got overlooked. Committed in r8226 and GameDir 2323.



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Report message to a moderator

Lieutenant
Re: Code Snippets[message #345608 is a reply to message #345575] Sat, 21 May 2016 08:43 Go to previous messageGo to previous message
Tyxe is currently offline Tyxe

 
Messages:78
Registered:May 2012
Location: France
Nice little improvements, much appreciated.

[Updated on: Sat, 21 May 2016 08:44]

Report message to a moderator

Corporal
Previous Topic: New Attachment System Beta
Goto Forum:
  


Current Time: Fri Apr 19 08:19:34 GMT+3 2024

Total time taken to generate the page: 0.04041 seconds