|
|
(17 intermediate revisions by 2 users not shown) |
Line 4: |
Line 4: |
| [snip] | | [snip] |
|
| |
|
| I was thinking that too...I put a constructor and deconstructor in the manager that prints warnings saying created and destroyed...I'll see if it's destroying it too soon then—'''[[User:Ts2do|ts2do]]''' <sup>([[User talk:Ts2do|Talk]] | [mailto:tsdodo@gmail.com @])</sup> 19:19, 27 Nov 2005 (PST)
| | [snip2] |
|
| |
|
| Ok...I made it so it creates the manager when it does the clientshared thing...haven't tried restarting the server and seeing if it's still intact yet tho...what I did b4 was made it when the clientdll initialized WHICH ISN"T GOODZ!—'''[[User:Ts2do|ts2do]]''' <sup>([[User talk:Ts2do|Talk]] | [mailto:tsdodo@gmail.com @])</sup> 19:32, 27 Nov 2005 (PST)
| | Wait, maybe I'm talking about something else... You said that in <code>CUtlMemory<T>::operator[]( int )</code> you found <code>m_pMemory</code> 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 <code>m_nAllocationCount</code> will be zero and therefore the <code>Assert</code> will fail. If <code>CUtlMemory<T>::operator[]( int )</code> is being called when <code>m_nAllocationCount</code> is zero, though, then the calling code is at fault for using an illegal index. —'''[[User:Maven|Maven]]''' <sup>([[User talk:Maven|talk]])</sup> 17:57, 3 Dec 2005 (PST) |
|
| |
|
| Now it fails <code>Assert( !"CreateNoSpawn: only works for CBaseEntities" );</code>.
| | 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—'''[[User:Ts2do|ts2do]]''' <sup>([[User talk:Ts2do|Talk]] | [mailto:tsdodo@gmail.com @])</sup> 18:30, 3 Dec 2005 (PST) |
| | |
| server.dll!CBaseEntity::CreateNoSpawn(const char * szName=0x22a8b92c, const Vector & vecOrigin={...}, const QAngle & vecAngles={...}, CBaseEntity * pOwner=0x00000000) Line 2451 + 0x69 C++
| |
| server.dll!CBaseEntity::Create(const char * szName=0x22a8b92c, const Vector & vecOrigin={...}, const QAngle & vecAngles={...}, CBaseEntity * pOwner=0x00000000) Line 2436 + 0x15 C++
| |
| server.dll!CGameRules::CreateStandardEntities() Line 552 + 0x16 C++
| |
| server.dll!CHL2MPRules::CreateStandardEntities() Line 183 C++
| |
| server.dll!CWorld::Precache() Line 605 C++
| |
| server.dll!CWorld::Spawn() Line 513 C++
| |
| server.dll!DispatchSpawn(CBaseEntity * pEntity=0x0bd13400) Line 1727 C++
| |
| server.dll!MapEntity_ParseAllEntities(const char * pMapData=0x118cf1d8, IMapEntityFilter * pFilter=0x00000000, bool bActivateEntities=false) Line 329 + 0xc C++
| |
| server.dll!CServerGameDLL::LevelInit_ParseAllEntities(const char * pMapEntities=0x118cf040) Line 27 + 0xd C++
| |
| server.dll!CServerGameDLL::LevelInit(const char * pMapName=0x0de1fb10, const char * pMapEntities=0x118cf040, const char * pOldLevel=0x00000000, const char * pLandmarkName=0x00000000, bool loadGame=false, bool background=false) Line 700 C++
| |
| | |
| szName "bullet_manager" const char *
| |
| vecOrigin {x=0.00000000 y=0.00000000 z=0.00000000 } const Vector &
| |
| vecAngles {x=0.00000000 y=0.00000000 z=0.00000000 } const QAngle &
| |
| pOwner 0x00000000 CBaseEntity *
| |
| | |
| —'''[[User:Maven|Maven]]''' <sup>([[User talk:Maven|talk]])</sup> 20:10, 27 Nov 2005 (PST)
| |
| | |
| well I did LINK_ENTITY_TO_CLASS...do you have that?—'''[[User:Ts2do|ts2do]]''' <sup>([[User talk:Ts2do|Talk]] | [mailto:tsdodo@gmail.com @])</sup> 20:30, 27 Nov 2005 (PST)
| |
| | |
| :Oops. Yes, I did miss that. —'''[[User:Maven|Maven]]''' <sup>([[User talk:Maven|talk]])</sup> 07:29, 28 Nov 2005 (PST)
| |
| | |
| I solved it not thinking on the client...but now it's giving me an assert when <code>SetNextClientThink( TICK_NEVER_THINK );</code> in <code>RemoveBullet</code> is done—'''[[User:Ts2do|ts2do]]''' <sup>([[User talk:Ts2do|Talk]] | [mailto:tsdodo@gmail.com @])</sup> 20:53, 27 Nov 2005 (PST)
| |
| | |
| :Do you mean <code>Assert( GetClientHandle() != INVALID_CLIENTENTITY_HANDLE );</code> in <code>C_BaseEntity::SetNextClientThink</code>? —'''[[User:Maven|Maven]]''' <sup>([[User talk:Maven|talk]])</sup> 08:59, 28 Nov 2005 (PST)
| |
| | |
| ok it did crash on restart...what's also notable is the fact that there's a slight difference between the serverside and clientside direction vectors (normal)—'''[[User:Ts2do|ts2do]]''' <sup>([[User talk:Ts2do|Talk]] | [mailto:tsdodo@gmail.com @])</sup> 23:38, 27 Nov 2005 (PST)
| |
| | |
| I'm currently failing the <code>if ( !m_ThinkEntries.IsInList( (unsigned long)hThink ) )</code> line in <code>CClientThinkList::PerformThinkFunctions()</code>. It fires the assert in <code>CUtlLinkedList<T,I>::Previous</code> with ''i''==42, ''m_TotalElements''==43, and unknown contents of ''m_Memory[i]''. If I rerun it I get different values of ''i'', but it's always one less than ''m_TotalElements''. This might be related to the <code>SetNextClientThink( TICK_NEVER_THINK );</code> problem you mentioned. —'''[[User:Maven|Maven]]''' <sup>([[User talk:Maven|talk]])</sup> 08:59, 28 Nov 2005 (PST) | |
| | |
| Did you catch my edit?
| |
| in <code>clientmode_shared.cpp</code>
| |
| <pre> HOOK_MESSAGE( Bullet );
| |
| if(!g_pBulletManager)
| |
| {
| |
| g_pBulletManager = (C_BulletManager *)CreateEntityByName("bullet_manager");
| |
| ClientEntityList().AddNonNetworkableEntity(g_pBulletManager);
| |
| }</pre>
| |
| —'''[[User:Ts2do|ts2do]]''' <sup>([[User talk:Ts2do|Talk]] | [mailto:tsdodo@gmail.com @])</sup> 16:26, 28 Nov 2005 (PST) | |
| | |
| :Yup, I have that. Running it again, I had several successful shots before one caused the error. I intend to do more testing later. —'''[[User:Maven|Maven]]''' <sup>([[User talk:Maven|talk]])</sup> 19:39, 28 Nov 2005 (PST)
| |
| | |
| Maven...you must help me...I've been looking at:
| |
| inline T& CUtlMemory<T>::operator[]( int i )
| |
| {
| |
| Assert( IsIdxValid(i) );
| |
| return m_pMemory[i];
| |
| }
| |
| And I did a break while debugging and it said m_pMemory = 0x00000000
| |
|
| |
|
| is taht a bad thing?—'''[[User:Ts2do|ts2do]]''' <sup>([[User talk:Ts2do|Talk]] | [mailto:tsdodo@gmail.com @])</sup> 23:02, 30 Nov 2005 (PST)
| | As I thought...it works marvelously now..time to move on to other errors—'''[[User:Ts2do|ts2do]]''' <sup>([[User talk:Ts2do|Talk]] | [mailto:tsdodo@gmail.com @])</sup> 18:37, 3 Dec 2005 (PST) |
|
| |
|
| :I'm confident that you already know that it ''is'' bad, so I'm guessing that the actual question is "What now?". The SDK utility classes are pretty solid, despite their peccadillos, so I doubt that they caused the error. You should check <code>this</code> (via the debugger; do a Quick Watch if you need) to make sure that it's not null or an error. If it is, keep going up the call stack until <code>this</code> is no longer invalid, then look for illegal memory access. If you find the general area but don't know exactly what's wrong, scatter <code>Assert</code>s around liberally—check everything you pass to SDK code, and check every pointer before dereferencing. | | :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. —'''[[User:Maven|Maven]]''' <sup>([[User talk:Maven|talk]])</sup> 12:48, 4 Dec 2005 (PST) |
|
| |
|
| :If, on the other hand, <code>this</code> is valid, you'll have to examine how the <code>CUtlMemory</code> object was constructed, with attention to what might have gone wrong there. —'''[[User:Maven|Maven]]''' <sup>([[User talk:Maven|talk]])</sup> 17:52, 1 Dec 2005 (PST)
| | I'm currently revamping part of it to use the tempent system...it'll be better!—'''[[User:Ts2do|ts2do]]''' <sup>([[User talk:Ts2do|Talk]] | [mailto:tsdodo@gmail.com @])</sup> 19:45, 4 Dec 2005 (PST) |
|
| |
|
| Yes but how could it be the bullet_manager giving the problems? it's only destroyed on level shutdown
| | Revert highlights: |
| | [http://developer.valvesoftware.com/w/index.php?title=Simulated_Bullets&diff=0&oldid=18448] & [http://developer.valvesoftware.com/w/index.php?title=Simulated_Bullets&diff=18448&oldid=18447]—'''[[User:Ts2do|ts2do]]''' <sup>([[User talk:Ts2do|Talk]] | [mailto:tsdodo@gmail.com @])</sup> 19:59, 4 Dec 2005 (PST) |
|
| |
|
| There must be something going on with the utllinkedlist!
| | I want to reimplement this so there's a DrawModel function for the bullets...the problem is I only change the origin every centisecond... |
| It has this ref to utlmemory:
| |
| CUtlMemory<ListElem_t> m_Memory;
| |
| I don't know how that will help...it
| |
| what seems to be the problem is in the CUtlMemory constructor...it initializes the m_pMemory
| |
|
| |
|
| the default constructor is
| | My question is how should I go by doing this? |
| CUtlMemory( int nGrowSize = 0, int nInitSize = 0 );
| | * Should I instead simulate the bullet every frame |
| when it gets 0 passed in, it doesn't initialize m_pMemory, hence the error...the question is is why is it working the first time though? Calling EnsureCapacity(2) on the CUtlLinkedListseems to be the right thing to do...nothing happened
| | * 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. |
|
| |
|
| what I could do that would work fine is I could make the whole linked list static...since it's an important part of the game...that way I can forget about this problem—'''[[User:Ts2do|ts2do]]''' <sup>([[User talk:Ts2do|Talk]] | [mailto:tsdodo@gmail.com @])</sup> 21:15, 2 Dec 2005 (PST)
| | Sampley: |
| | <pre>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 |
| | };</pre>—'''[[User:Ts2do|ts2do]]''' <sup>([[User talk:Ts2do|Talk]] | [mailto:tsdodo@gmail.com @])</sup> 06:03, 5 Dec 2005 (PST) |
|
| |
|
| :Apparently I wasn't clear. <code>CUtlMemory::m_pMemory</code> is null, you say. It ''could'' be that the <code>CUtlMemory</code> code made a mistake. This is unlikely. What's more likely is that the <code>CUtlMemory</code> object is corrupt. To find out, we have two questions:
| | New bugs: |
| :*''Is'' it corrupt?
| | * Multiplayer crashy stuff (Game crashes on quit command issued) |
| :*''How'' could it have become corrupt?
| | * GetTargetTick doesn't work (Tested only on localhost) |
| :To find the first, check <code>this</code>. If <code>this</code> (which points to the <code>CUtlMemory</code> object) is null or is reported as <code>CXX0030</code>, then the answer is, "Yes, the <code>CUtlMemory</code> object is corrupt." (Because it's not really a <code>CUtlMemory</code> object—it's some random chunk of memory being ''treated'' as a <code>CUtlMemory</code> object.) So please check the <code>this</code> pointer first.
| | —'''[[User:Ts2do|ts2do]]''' <sup>([[User talk:Ts2do|Talk]] | [mailto:tsdodo@gmail.com @])</sup> 19:30, 5 Dec 2005 (PST) |
| :If the <code>CUtlMemory</code> object is corrupt, then how did it get that way? Well, that object is <code>CUtlMemory CUtlLinkedList::m_Memory</code>. The most reasonable first guess as to why <code>CUtlLinkedList::m_Memory</code> is corrupt is that the <code>CUtlLinkedList</code> object is corrupt. So again, use the debugger to see whether it's either null or <code>CXX0030</code>.
| |
| :If the <code>CUtlLinkedList</code> object is corrupt, then check where it came from. What code called the function that called the <code>CUtlLinkedList</code> object? Check that code for bad pointer usage, for uninitialized pointers, for out-of-bounds array access, etc. If nothing obvious shows up, start putting in <code>Assert</code> statements for things that you know ''must'' be true. Eventually you should find something that ''you'' know ''must'' be true, but the ''code'' thinks is ''false''—and that's your bug.
| |
| :It might be that I'm completely wrong, and that <code>this</code> isn't null. In that case please let me know, and I'll tinker with the code again when I get the opportunity. —'''[[User:Maven|Maven]]''' <sup>([[User talk:Maven|talk]])</sup> 17:49, 3 Dec 2005 (PST)
| |
|
| |
|
| Wait, maybe I'm talking about something else... You said that in <code>CUtlMemory<T>::operator[]( int )</code> you found <code>m_pMemory</code> 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 <code>m_nAllocationCount</code> will be zero and therefore the <code>Assert</code> will fail. If <code>CUtlMemory<T>::operator[]( int )</code> is being called when <code>m_nAllocationCount</code> is zero, though, then the calling code is at fault for using an illegal index. —'''[[User:Maven|Maven]]''' <sup>([[User talk:Maven|talk]])</sup> 17:57, 3 Dec 2005 (PST)
| | Maven...uncomment this: |
| | The bullets will know when they're being fired so in <code>CHL2MP_Player::WantsLagCompensationOnEntity</code> |
| | {| style="background: transparent;" |
| | | Comment out || <pre> if ( !( pCmd->buttons & IN_ATTACK ) && (pCmd->command_number - m_iLastWeaponFireUsercmd > 5) ) |
| | return false;</pre> |
| | |} |
| | —'''[[User:Ts2do|ts2do]]''' <sup>([[User talk:Ts2do|Talk]] | [mailto:tsdodo@gmail.com @])</sup> 19:33, 5 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—'''[[User:Ts2do|ts2do]]''' <sup>([[User talk:Ts2do|Talk]] | [mailto:tsdodo@gmail.com @])</sup> 18:30, 3 Dec 2005 (PST)
| | if someone'd like to assist me in totally revamping this with a CAutoGameSystem, contact me—'''[[User:Ts2do|ts2do]]''' <sup>([[User talk:Ts2do|Talk]] | [mailto:tsdodo@gmail.com @])</sup> 01:17, 30 Dec 2005 (PST) |
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 wraiyth@gmail.com --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)