.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > General Bot Coding
General Bot Coding See what a pain it is to get those little mechs shooting around

Reply
 
Thread Tools
Some CS.DLL sources...
Old
  (#1)
Immortal_BLG
Member
 
Status: Offline
Posts: 171
Join Date: Nov 2007
Location: Russian Federation
Default Some CS.DLL sources... - 08-01-2013

Something can I already post, but nevertheless...
Attached Files
File Type: zip Interfaces.zip (115.6 KB, 955 views)
  
Reply With Quote
Re: Some CS.DLL sources...
Old
  (#2)
jeefo
путинхуйлоебаное
 
jeefo's Avatar
 
Status: Offline
Posts: 453
Join Date: Nov 2005
Location: Saint-Petersburg
Default Re: Some CS.DLL sources... - 13-01-2013

Still reversing game? )

Last edited by jeefo; 13-01-2013 at 22:16..
  
Reply With Quote
Re: Some CS.DLL sources...
Old
  (#3)
Immortal_BLG
Member
 
Status: Offline
Posts: 171
Join Date: Nov 2007
Location: Russian Federation
Default Re: Some CS.DLL sources... - 14-01-2013

Yep! From time to time...
  
Reply With Quote
Re: Some CS.DLL sources...
Old
  (#4)
Whistler
Summoner
 
Whistler's Avatar
 
Status: Offline
Posts: 1,499
Join Date: Feb 2004
Location: Mist Village
Default Re: Some CS.DLL sources... - 14-01-2013

interesting stuff

Code:
		class DefuseBombState : public BotState
		{
/*			public:
				virtual       void        OnEnter  (TemplateCSBot *const owner) = 0;
				virtual       void        OnUpdate (TemplateCSBot *const owner) = 0;
				virtual       void        OnExit   (TemplateCSBot *const owner) = 0;
				virtual const char *const GetName  (void) = 0;	// { return "DefuseBomb"; }
*/		};	// sizeof (DefuseBombState) == 4 (1)
		class HideState : public BotState
		{
			public:
				enum { MaximumHidingSpotsToPickNumber = 3u };

/*! off=4(1)/2840(710) */				NavigationArea *m_searchArea;
/*! off=8(2)/2844(711) */				float           m_searchRange;
/*! off=12(3)/2848(712) */				Math::Vector3D  m_hiddingSpot;
/*! off=24(6)/2860(715) */				bool            m_isAtSpot;
/*! off=28(7)/2864(716) */				float           m_duration;
/*! off=32(8)/2868(717) */				bool            m_holdPosition;	// Can bot hold position?
/*! off=36(9)/2872(718) */				float           m_holdPositionTimeAmount;
/*! off=40(10)/2876(719) */				bool            m_holdPositionAndWaitingEnemy;
/*! off=44(11)/2880(720) */				float           m_holdPositionStartTimestamp;
/*! off=48(12)/2884(721) */				unsigned int    m_hidingSpotPickTriesNumber;	// Up to 'MaximumHidingSpotsToPickNumber'.
/*! off=52(13)/2888(722) */				Math::Vector3D  m_followingTargetPosition;
/*
			public:
				virtual       void        OnEnter  (TemplateCSBot *const owner) = 0;
				virtual       void        OnUpdate (TemplateCSBot *const owner) = 0;
				virtual       void        OnExit   (TemplateCSBot *const owner) = 0;
				virtual const char *const GetName  (void) = 0;	// { return "Hide"; }
*/		};	// sizeof (HideState) == 64 (16)
		class EscapeFromBombState : public BotState
		{
/*			public:
				virtual       void        OnEnter  (TemplateCSBot *const owner) = 0;
				virtual       void        OnUpdate (TemplateCSBot *const owner) = 0;
				virtual       void        OnExit   (TemplateCSBot *const owner) = 0;
				virtual const char *const GetName  (void) = 0;	// { return "EscapeFromBomb"; }
*/		};	// sizeof (EscapeFromBombState) == 4 (1)
		class FollowState : public BotState
		{
			public:
/*! off=4(1)/2908(727) */				EntityHandle              m_leader;
/*! off=12(3)/2916(729) */				Math::Vector3D            m_UNKNOWN0;
/*! off=24(6)/2928(732) */				bool                      m_UNKNOWN1;
/*! off=28(7)/2932(733) */				unsigned int              m_UNKNOWN2;
/*! off=32(8)/2936(734) */				unsigned int              m_UNKNOWN3_Type;
/*! off=36(9)/2940(735) */				unsigned int              m_UNKNOWN4_Timestamp;
/*! off=40(10)/2944(736) */				bool                      m_UNKNOWN5;
/*! off=44(11)/2948(737) */				float                     m_UNKNOWN6_Timestamp;
/*! off=48(12)/2952(738) */				Utilities::CountdownTimer m_UNKNOWN7_Timer;
/*! off=56(14)/2960(740) */				float                     m_UNKNOWN8_Timestamp;
/*! off=60(15)/2964(741) */				bool                      m_UNKNOWN9;
/*! off=64(16)/2968(742) */				float                     m_UNKNOWN10_TimeAmount;
/*! off=68(17)/2972(743) */				Utilities::CountdownTimer m_UNKNOWN11_Timer;
/*
			public:
				virtual       void        OnEnter  (TemplateCSBot *const owner) = 0;
				virtual       void        OnUpdate (TemplateCSBot *const owner) = 0;
				virtual       void        OnExit   (TemplateCSBot *const owner) = 0;
				virtual const char *const GetName  (void) = 0;	// { return "Follow"; }
*/		};	// sizeof (FollowState) == 76 (19)
		class UseEntityState : public BotState
		{
			public:
/*! off=4(1)/2984(746) */				EntityHandle m_target;
/*
			public:
				virtual       void        OnEnter  (TemplateCSBot *const owner) = 0;
				virtual       void        OnUpdate (TemplateCSBot *const owner) = 0;
				virtual       void        OnExit   (TemplateCSBot *const owner) = 0;
				virtual const char *const GetName  (void) = 0;	// { return "UseEntity"; }
*/		};	// sizeof (UseEntityState) == 12 (3)
[...]
	public:
/*! off=2684(671) */		IdleState              m_idleState;
/*! off=2688(672) */		HuntState              m_huntState;
/*! off=2696(674) */		AttackState            m_attackState;											// Executed when variable 'm_isAttacking' is true no metter what....
/*! off=2756(689) */		InvestigateNoiseState  m_investigateNoiseState;
/*! off=2772(693) */		BuyState               m_buyState;
/*! off=2800(700) */		MoveToState            m_moveToState;
/*! off=2824(706) */		FetchBombState         m_fetchBombState;
/*! off=2828(707) */		PlantBombState         m_plantBombState;
/*! off=2832(708) */		DefuseBombState        m_defuseBombState;
/*! off=2836(709) */		HideState              m_hideState;
/*! off=2900(725) */		EscapeFromBombState    m_escapeFromBombState;
/*! off=2904(726) */		FollowState            m_followState;
/*! off=2980(745) */		UseEntityState         m_useEntityState;

/*! off=2992(748) */		BotState              *m_currentState;											// Executed when variable 'm_isAttacking' is false.
does this mean the official CS bot uses a finite state-machine design with each state wrapped in a class?
  
Reply With Quote
Re: Some CS.DLL sources...
Old
  (#5)
Whistler
Summoner
 
Whistler's Avatar
 
Status: Offline
Posts: 1,499
Join Date: Feb 2004
Location: Mist Village
Default Re: Some CS.DLL sources... - 14-01-2013

Code:
void CCSBot::UpdateLookAngles (void)
{
	/// @todo CONTINUE DECOMPILING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
	/// @note FROM SOURCE ENGINE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

	if (*(_DWORD *)(bot_mimic + 48) != 0)
		return;

	if (IsAttacking ())
	{
		v24 = 300.0f;
		v4 = 30.0f;
	}
	else
	{
		v24 = 200.0f;
		v4 = 25.0f;
	}
	v23 = m_lookAngleYaw;
	v26 = m_lookAnglePitch;
	if (m_currentLadder != NULL && !IsLookingAtSpot (PriorityType_High))
		ComputeLadderAngles ((int)&v23, (int)&v26);
	v5 = EyeAngles ();
	LODWORD(v28) = *(_DWORD *)v5;
	LODWORD(v29) = *(_DWORD *)(v5 + 4);
	v30 = *(_DWORD *)(v5 + 8);
	v7 = AngleNormalize (v23 - v29);
	v8 = 3000.0f;
	if (v7 >= 1.0f || v7 <= -1.0f)
	{
		v9 = v7;
		v10 = -3000.0f;
		v11 = v9 * v24 - m_lookAngleYawUNKNOWN * v4;
		if (v11 > 3000.0f || (v8 = v11, v11 >= -3000.0f))
			v10 = v8;
		v13 = v10 * g_flBotCommandInterval + m_lookAngleYawUNKNOWN;
		m_lookAngleYawUNKNOWN = v13;
		v29 = g_flBotCommandInterval * v13 + v29;
//		if (Math::fabsf (v10) > 1000.0)
//			*(float *)(this + 14340) = CountdownTimer__Now();
	}
	else
	{
		m_lookAngleYawUNKNOWN = 0.0f;
		v29 = v23;
	}
	v15 = AngleNormalize (v26 - v28);
	v16 = v15 * v24 + v15 * v24 - m_lookAnglePitchUNKNOWN * v4;
	if (v16 <= 3000.0f)
	{
		if (v16 < -3000.0f)
			v16 = -3000.0f;
	}
	else
		v16 = 3000.0f;
	v18 = v16 * g_flBotCommandInterval + m_lookAnglePitchUNKNOWN;
	m_lookAnglePitchUNKNOWN = v18;
	v19 = g_flBotCommandInterval * v18 + v28;
	v28 = v19;
	v20 = v19;
	v21 = v16;
	v22 = v20;
	if (Math::fabsf (v21) > 1000.0f)
	{
//		*(float *)(this + 14340) = CountdownTimer__Now();
		v22 = v28;
	}
	if (v22 >= -89.0f)
	{
		if (v22 > 89.0f)
			v28 = 89.0f;
	}
	else
		v28 = -89.0f;
	CBasePlayer__SnapEyeAngles(this, (int)&v28);
//	if (CountdownTimer__Now() <= *(float *)(this + 15580))
//		*(float *)(this + 14340) = CountdownTimer__Now();
}
this looks like how the aiming was done.
IIRC there was a discussion on this one here...
http://forums.bots-united.com/showthread.php?t=3330
  
Reply With Quote
Re: Some CS.DLL sources...
Old
  (#6)
jeefo
путинхуйлоебаное
 
jeefo's Avatar
 
Status: Offline
Posts: 453
Join Date: Nov 2005
Location: Saint-Petersburg
Default Re: Some CS.DLL sources... - 15-01-2013

if anyone need this now:

Code:
/**
 * Move actual view angles towards desired ones.
 * This is the only place v_angle is altered.
 * @todo Make stiffness and turn rate constants timestep invariant.
 */
void CCSBot::UpdateLookAngles( void )
{
	VPROF_BUDGET( "CCSBot::UpdateLookAngles", VPROF_BUDGETGROUP_NPCS );

	const float deltaT = g_BotUpkeepInterval;
	float maxAccel;
	float stiffness;
	float damping;

	// If mimicing the player, don't modify the view angles.
	if ( bot_mimic.GetInt() )
		return;

	// springs are stiffer when attacking, so we can track and move between targets better
	if (IsAttacking())
	{
		stiffness = 300.0f;
		damping = 30.0f;			// 20
		maxAccel = 3000.0f;	// 4000
	}
	else
	{
		stiffness = 200.0f;
		damping = 25.0f;
		maxAccel = 3000.0f;
	}

	// these may be overridden by ladder logic
	float useYaw = m_lookYaw;
	float usePitch = m_lookPitch;

	//
	// Ladders require precise movement, therefore we need to look at the 
	// ladder as we approach and ascend/descend it.
	// If we are on a ladder, we need to look up or down to traverse it - override pitch in this case.
	//
	// If we're trying to break something, though, we actually need to look at it before we can
	// look at the ladder
	//
	if ( IsUsingLadder() && !(IsLookingAtSpot( PRIORITY_HIGH ) && m_lookAtSpotAttack) )
	{
		ComputeLadderAngles( &useYaw, &usePitch );
	}

	// get current view angles
	QAngle viewAngles = EyeAngles();

	//
	// Yaw
	//
	float angleDiff = AngleNormalize( useYaw - viewAngles.y );

	/*
	 * m_forwardAngle is unreliable. Need to simulate mouse sliding & centering
	if (!IsAttacking())
	{
		// do not allow rotation through our reverse facing angle - go the "long" way instead
		float toCurrent = AngleNormalize( pev->v_angle.y - m_forwardAngle );
		float toDesired = AngleNormalize( useYaw - m_forwardAngle );

		// if angle differences are different signs, they cross the forward facing
		if (toCurrent * toDesired < 0.0f)
		{
			// if the sum of the angles is greater than 180, turn the "long" way around
			if (abs( toCurrent - toDesired ) >= 180.0f)
			{
				if (angleDiff > 0.0f)
					angleDiff -= 360.0f;
				else
					angleDiff += 360.0f;
			}
		}
	}
	*/

	// if almost at target angle, snap to it
	const float onTargetTolerance = 1.0f;		// 3
	if (angleDiff < onTargetTolerance && angleDiff > -onTargetTolerance)
	{
		m_lookYawVel = 0.0f;
		viewAngles.y = useYaw;
	}
	else
	{
		// simple angular spring/damper
		float accel = stiffness * angleDiff - damping * m_lookYawVel;

		// limit rate
		if (accel > maxAccel)
			accel = maxAccel;
		else if (accel < -maxAccel)
			accel = -maxAccel;

		m_lookYawVel += deltaT * accel;
		viewAngles.y += deltaT * m_lookYawVel;

		// keep track of how long our view remains steady
		const float steadyYaw = 1000.0f;
		if (fabs( accel ) > steadyYaw)
		{
			m_viewSteadyTimer.Start();
		}
	}

	//
	// Pitch
	// Actually, this is negative pitch.
	//
	angleDiff = usePitch - viewAngles.x;

	angleDiff = AngleNormalize( angleDiff );


	if (false && angleDiff < onTargetTolerance && angleDiff > -onTargetTolerance)
	{
		m_lookPitchVel = 0.0f;
		viewAngles.x = usePitch;
	}
	else
	{
		// simple angular spring/damper
		// double the stiffness since pitch is only +/- 90 and yaw is +/- 180
		float accel = 2.0f * stiffness * angleDiff - damping * m_lookPitchVel;

		// limit rate
		if (accel > maxAccel)
			accel = maxAccel;
		else if (accel < -maxAccel)
			accel = -maxAccel;

		m_lookPitchVel += deltaT * accel;
		viewAngles.x += deltaT * m_lookPitchVel;

		// keep track of how long our view remains steady
		const float steadyPitch = 1000.0f;
		if (fabs( accel ) > steadyPitch)
		{
			m_viewSteadyTimer.Start();
		}
	}

	//PrintIfWatched( "yawVel = %g, pitchVel = %g\n", m_lookYawVel, m_lookPitchVel );

	// limit range - avoid gimbal lock
	if (viewAngles.x < -89.0f)
		viewAngles.x = -89.0f;
	else if (viewAngles.x > 89.0f)
		viewAngles.x = 89.0f;

	// update view angles
	SnapEyeAngles( viewAngles );

	// if our weapon is zooming, our view is not steady
	if (IsWaitingForZoom())
	{
		m_viewSteadyTimer.Start();
	}
}
  
Reply With Quote
Re: Some CS.DLL sources...
Old
  (#7)
Immortal_BLG
Member
 
Status: Offline
Posts: 171
Join Date: Nov 2007
Location: Russian Federation
Default Re: Some CS.DLL sources... - 16-01-2013

Quote:
Originally Posted by Whistler
does this mean the official CS bot uses a finite state-machine design with each state wrapped in a class?
Yes, almost like in your GINABot

Quote:
Originally Posted by jeefo
if anyone need this now:
Big thanks!
But where you took this piece?
Maybe you will share if you have something else? :{P

Last edited by Immortal_BLG; 16-01-2013 at 11:13..
  
Reply With Quote
Re: Some CS.DLL sources...
Old
  (#8)
jeefo
путинхуйлоебаное
 
jeefo's Avatar
 
Status: Offline
Posts: 453
Join Date: Nov 2005
Location: Saint-Petersburg
Default Re: Some CS.DLL sources... - 17-01-2013

Quote:
Originally Posted by Immortal_BLG View Post
Maybe you will share if you have something else? :{P
What do you need ?
  
Reply With Quote
Re: Some CS.DLL sources...
Old
  (#9)
Immortal_BLG
Member
 
Status: Offline
Posts: 171
Join Date: Nov 2007
Location: Russian Federation
Default Re: Some CS.DLL sources... - 18-01-2013

wow!
I need all related to CS/CSS or HL Engine (especially that associated with bots)
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com