Zombie Hunter, Inc. can be described as Left 4 Dead meets Golden Axe. It is a top-down PC shooter set in Washington, DC. Your job is to rescue survivors from the zombie apocalypse . . . for a reasonable fee, of course. More than an arcade shooter, Zombie Hunter, Inc. also includes gear customization, quests, and non-linear storytelling with branching paths to deliver the most exciting top-down shooting you’ve ever seen.
Hi again, We are working our socks off to bring you the alpha version of Zombie Hunter inc as soon as possible, the first level has already been balanced, three others left to go. Quite soon we will post an update showing some gameplay and our new area called “Riverfront”. In this blog I will tell you how we made our muzzleflashes look like Battlefield 3.
Posted by cubr on Oct 10th, 2013
Battlefield 3 made a revolution in FPS gunplay. It changes your understanding of how a gun should fire in a videogame so much that whenever you try playing another shooter, if feels like you are firing a water pistol with an empty tank. It is not, therefore, surprising that we tried to mimic Battlefield 3 gunplay in Zombie Hunter inc. To implement such a quality of gunfire in an FPS is a tough challenge but for the top-down setting that our game has it is quite doable. However, modern internet lacks any information on how EXACTLY Battlefield 3 gunfire is working, so I hope this short article will fill this gap.
Battlefield 3 has made several innovations in FPS gunplay. Insane sound system, superb camera animation, unreachable ragdoll kinematics are but a few things to list. But for our game, we concentrated on something that in our opinion was truly revolutionary - the muzzleflashes.
While the shooters of the past (Battlefield 2 included) tended to create a muzzleflash whenever you squeezed the trigger, in Battlefield 3 they only appear rarely, but when they do, man they make a show. Battlefield 3 muzzleflashes are huge! When your opponent is shooting, his muzzleflash might extend for up to a meter forward. Having half a meter in diameter, they sometimes completely hide the shooter behind their blaze. On the other hand, when YOU are the shooter, discreet muzzleflash appearance make you truly feel like firing a real firearm.
Another big innovation DICE made for their muzzleflashes was the shape and quality of the sprites. Traditional shooters had quite basic low-resolution muzzleflashes of star-like shape. From the side view, the flash always followed the bullet, having a spiky shape. The guys from DICE thought “Hell, muzzleflash is something that occupies up to 40% of the player screen, why not make it detailed”. And it worked. Though you only see the flash a fraction of a second, it really shines with insane level of detail they put into them. They also made the flashes round in shape with rough edges, so when they appear on your screen it feels like they tear the picture apart, underlining the power of your gun. And once again, it work amazingly. To be honest I am still not sure why exactly the fireball-shaped flashes are better than traditional stars, but it definitely feels right when you play.
DICE even put a twist on the way their flashes light up the scene. To better understand how DICE made their gunfire, we made a highframerate highresolution video capture of Battlefield 3 gameplay. When we looked into it frame by frame, we noticed that lightsources are not synched with the muzzleflashes! Sometimes the light will not even show up when the bright muzzleflash appears. However, you still perceive that the flash lights the scene because of its bloom. On the other hand, sometimes lightsource might appear even when the flash is completely absent, which also, amazingly, works. The only thing that appears consistently with each shot in Battlefield 3 is the smoke, which sometimes gets lit up.
So after the analysis was done, we were ready to implement the muzzleflashes. I will write a separate blog on how we created our advanced 3d deferred rendering engine from scratch in just one month, but to put it short, in order to implement the flashes, we used the next technology:
A. A solid renderer, supporting an arbitrary number of lights and unlit translucent objects;
B. A 2d sprite sheet animation player and
C. An HDR advanced lighting, bloom and color bleeding effects.
The more interesting part of the implementation was the assets. We used 3d billboards with spritesheet textures playing over them to create both the smoke and the muzzleflashes. They were necessarily translucent so the scene lights did not apply to them (due to the specifics of our engine). But it was not a problem as muzzleflashes are lightsources themselves and do not need to be lit up. The smoke, well we did not bother to light it up and it still worked ok :). We got lucky with the smoke-following-gun effect by simply creating smoke billboards with random scale factor, which made smaller smokes look like tails of the bigger ones.
However, alongside the diffuse maps we used other maps to further improve the effect. Muzzleflashes came with the bloom map, that allowed us to manually specify bloomy areas of the flash to our HDR effect. The effect allowed muzzleflashes to radiate light all around, even when they are partially covered by other objects.
Another map we used was the depth map, which allowed us to add volume to the flashes and smoke. In a complex scene they would partially cover other objects, giving an illusion of them being 3d.
The final step was to make the flashes and lights appear randomly when firing a gun. With trial and error we identified that a 40% chance is the best for the lightsources. Thus, every 4 shots out of 10 produced a point light, that had a random range and intensity. It only needs to last two frames out of thirty. Make it shorter and you won’t see them. Make it longer and the effect will be dull.
The chance for the actual flash to appear was 25% - one every 4 shots. Our flash had more frames displayed per second that human eye can distinguish, which created a unique effect where every two frames you saw blended together to make an absolutely new flash every time.
Of course our flashes are not perfect and there is much room for improvement. Battlefield 3 bloom system is way better than ours and they sometimes put cool sparks instead of muzleflashes, also we can't quite tune the specular highlights yet. We will deffinitely make our muzzleflashes even better before December’s alpha, so stay tuned!