Talk:Simulated Bullets

From Valve Developer Community
Jump to: navigation, search

I'd really like assistance with this if anyone can do any implementation of this or any fixes to the bullet simulator... implementation includes making the gun shoot them out, making the bullets hurt, and making clientside effects... I have a feeling that other mods WILL want to use timed bullets, and this code will do the trick... I just need help (or plenty of time) getting it finished first and then it will be available to everyone!—ts2do (Talk | @) 23:06, 20 Nov 2005 (PST)

Yes ts2do (you went away before i came back), the myth was busted, best to contact Wrayith at Nightfall mod for more info. He was interested, and was implementing something like this with the quake 2 code, and was going to port it to hl2 latter. MSN [email protected] --Amckern 01:07, 21 Nov 2005 (PST)

[snip]

[snip2]

Wait, maybe I'm talking about something else... You said that in CUtlMemory<T>::operator[]( int ) you found m_pMemory to be null. Where in the function were you? I assumed (foolishly) that you meant at the second line. If you were checking as you first entered the function, though, then it's OK, because m_nAllocationCount will be zero and therefore the Assert will fail. If CUtlMemory<T>::operator[]( int ) is being called when m_nAllocationCount is zero, though, then the calling code is at fault for using an illegal index. —Maven (talk) 17:57, 3 Dec 2005 (PST)

I don't see why it's doing what it's doing...I'm so lost; I'm just gonna make the linked list global...that should solve it—ts2do (Talk | @) 18:30, 3 Dec 2005 (PST)

As I thought...it works marvelously now..time to move on to other errors—ts2do (Talk | @) 18:37, 3 Dec 2005 (PST)

Erm, OK... I hope that that fixed the bug rather than just hiding it. It will be well worth your time to learn strong debugging skills, though. —Maven (talk) 12:48, 4 Dec 2005 (PST)

I'm currently revamping part of it to use the tempent system...it'll be better!—ts2do (Talk | @) 19:45, 4 Dec 2005 (PST)

Revert highlights: [1] & [2]ts2do (Talk | @) 19:59, 4 Dec 2005 (PST)

I want to reimplement this so there's a DrawModel function for the bullets...the problem is I only change the origin every centisecond...

My question is how should I go by doing this?

  • Should I instead simulate the bullet every frame
  • Should I make the DrawModel move at the same speed through the centisecond
    • This requires direction * speed * time & could look jittery when penetration occurs

If I also made the CSimulatedBullet into an interface with this DrawModel addition, it'd be possible to show how to reimplement the crossbow so the bolts are predicted.

Sampley:

class ISimulatedBullet
{
public:
	virtual bool StartSolid(trace_t &ptr, Vector &vecNewRay) = 0;
	virtual bool AllSolid(trace_t &ptr) = 0;
	virtual bool EndSolid(trace_t &ptr) = 0;
#ifdef CLIENT_DLL
	virtual bool SimulateBullet(void) = 0;
#else
	virtual void EntityImpact(trace_t &ptr) = 0;
	virtual bool SimulateBullet(float flLagCompensation=-1) = 0;
#endif
};

ts2do (Talk | @) 06:03, 5 Dec 2005 (PST)

New bugs:

  • Multiplayer crashy stuff (Game crashes on quit command issued)
  • GetTargetTick doesn't work (Tested only on localhost)

ts2do (Talk | @) 19:30, 5 Dec 2005 (PST)

Maven...uncomment this: The bullets will know when they're being fired so in CHL2MP_Player::WantsLagCompensationOnEntity

Comment out
	if ( !( pCmd->buttons & IN_ATTACK ) && (pCmd->command_number - m_iLastWeaponFireUsercmd > 5) )
		return false;

ts2do (Talk | @) 19:33, 5 Dec 2005 (PST)

if someone'd like to assist me in totally revamping this with a CAutoGameSystem, contact me—ts2do (Talk | @) 01:17, 30 Dec 2005 (PST)