Hey guys, I know I am very vocal on the forums in everyone else's topic, but most of you don't really understand what it takes to get this mod to perform and feel like the GoldenEye 64. The developers and beta testers know all too well how many innocuous bugs crop up out of such benign additions such as a revamped blood screen or new team score display on the hud. Not to mention the extremely tricky bugs involved with bullet penetration, rolling explosions, and dynamic token gameplay...
This blog will discuss some of those bugs and what you can expect from Beta 4. I am not whining or complaining, but you have to understand how difficult it is to erase all the BAD things Valve hard coded into the SDK.
Bullet PenetrationMy first, second, and third approach to bullet penetration were complete failures in terms of effects and performance. Basically, I extended the penetration of glass to all other objects which seemed like a trivial extension, but Valve stepped in again...
Their generalization of what a shot does during it's "flight" prohibited the penetration from working on both client and server sides. Ever notice that when you fire on glass you only see a bullet hole on your side of the glass and you never see a tracer past the glass? Well that is what I am talking about. The shot stopped on client side at the glass and continued only server side after the glass. This causes a desync in the shot effects and potential lag in the visualization of your attack. The reason for this was actually quite simple. If glass is bullet proof, only the server knows. So they didn't draw the effect on client side pending the bullet was actually stopped and hoped you didn't notice.
The final implementation of penetration involved me rewriting the entire sequence of firing bullets to be both client and server side so the effects are visible to the local player and the other connected players. I also implemented a method of bullet "slowing" such that the deeper the bullet penetrates the less it can penetrate on the next hit of an object (including players!). Although another bug crept in.... penetrated weapons actually hit multiple hit boxes on the same player as it passed through the player! This resulted in an instant kill with the magnum even if you hit them in the legs. So another run through introduced a filter to prevent the same player from being hit by the same penetrated shot.
Rolling ExplosionsAnother thing that Valve's damage system was not designed for was damage over a prolonged period from the same entity. Basically when you are damaged by something the damage has to know who/what inflicted it and that information is passed down through all the functions that are called.
Take the mine for example. In a HL2 explosion the explosion damage lasts for 1 game frame. It is applied instantly to all objects within range and then it never happens again. The effect lasts for multiple frames, but it doesn't do anything damage wise. This allows the mine to remove itself from the world on the NEXT frame and still count as the inflictor, etc etc.
With rolling explosions, damage is applied over a 3 second interval (roughly). If the mine removed itself after that first frame the explosion would be holding onto an invalid pointer to the now deleted mine as it tried to apply damage again! This was causing serious crashes in our system that were very hard to identify at first. The fix was to create a new removal function that postponed actual deletion of the entity (mine) for X seconds and only kept it hidden from view during that time. That way damage application could use the information (printname, dmg amount, etc.) through all the successive damage applications over the course of the explosion.
To be continued...