The end of the Second Quarter Milestone
This past months focus was dedicated to a working Heads Up Display (HUD), an implementation of the last 3 weapons of the Marine class and weapon switching. Since the Rocket Launcher was completed in May, the highlight of this months update are the Blaster, the Shotgun, and the Hyperblaster fully equipped with Sound and FX.
Marine Class Weapons Demo
Working through these 3 new weapons required additions to the weapon system, which ensured all required features would be supported to provide the same feel as Q2WF. Take a quick look at the end result to see all firearms of the marine class.
The Blaster
The blaster is a weapon that all classes carry by default. This gun requires no ammo, shoots like a pistol, and leaves a trail of energy as it flies through the air.
While blaster wars was fun back in the day, the truth is that most players likely never truly want to use the blaster until you run out of bullets of your other weapons. When this happens, you are forced to use the blaster as a last resort until you've been fragged(killed), you've fragged your opponent or ammo packs were picked up from the spawn room to replenish your ammo.
The Shotgun
The shotgun is another common default among most classes. This gun shoots out 12 bullets per shell straight from the barrel randomized within a diameter, which can instantly reach long distance shots. The further away you are from the target the more spread out the bullets will be.
Light Property Interpolation
When you pull the shotgun trigger in Q2WF, a light turns on and fades off.
To match that in Roblox I decided to use TweenService for multiple properties of a light with different speeds over time. This required three different Tweens, since there isn't a way to have different speeds for multiple properties on the same Tween.
An event is also created, once the brightness property is interpolated to 0, the light disables at the end
Vector Direction Offset per Bullet
When firing the shotgun, the client provides a normalized vector direction from mouse click world position and the distance from the barrel. To offset a vector direction in each axis, we get a random number and modify them to fit the range we are looking for. In this case it becomes a unique random range between -0.05 and 0.05.
This value gets added to the vector direction to offset it slightly from going completely straight. A raycast is then shot to determine the hit.
The Hyperblaster
The hyperblaster is one of two of the unique firearms of the marine class. It's firing rate is similar to a machine gun, but more of an energy shot that requires energy cells to shoot more accurately than a machine gun does because there isn't much recoil.
Likely one of my favorite weapons to shoot when someone steals the flag and somehow gets ahead of you. Your rocket isn't accurate enough or too slow to catch up. This is when you whip out your hyperblaster and get multiple instant shots from a distance to take the flag carrier down.
Hyperblaster Aesthetic
While the hyperblaster is an instant energy shot.. a shot trail gets left behind due to movement even over a small amount of miliseconds. See the two matching here from Q2WF (left) vs WFR (right) for comparison.
I tried a couple solves here, like maintaining the start point on the barrel, or animating the transparency over time towards the shot hit. This solved it in different ways, but left it feeling not like the authentic hyperblaster from Q2WF. For now, I've decided to leave it authentic, with a bit brighter tones to match the new visuals in WFR. However, I will likely figure out a way to soften the harsh edge before release on a polish pass of the weapon FX.
Vertex Animation to Bone Animation
Wobbly vertex animation in Quake 2
Similar to Half-Life, The Quake and Quake 2 engine uses vertex animation with a linear interpolation of 2 to 3 frames. While this worked in the 90's, the result was always a noticeable wobbly vertex animation for slower animated models.
Take a look at the back portion of the gun here on the left, you should notice the subtle wobbliness of points within the original Quake 2 Weapons Factory MOD.
Skinning influences on bones per vertex
With more modern game engines, we use the concept of mesh vertex skinned to a specific bone. This determines which bone the vertex follows between a 0 and 1 value with a 4 bone max influence per vertex.
Skinning the entire gun to one bone is ideal because we want to animate one point for the whole gun to move.
The skinning influences of each point are highlighted in white across the model based on the selection of each bone used in WFR.
No more wobbly vertex animation
While this was an earlier bone setup, here we demonstrate animated bones in action from scrubbing through the timeline.
Skinning the entire gun to one bone is ideal because we want to animate one point for the whole gun to move.
Sounds much easier to animate 3 bones influencing multiple verts vs animating 155 individual verts, right? Well, it is.
Weapon System Update
From the beginning, I decided to go with an ad hoc approach to the weapon system to ensure progress wasn't going to be held up more then it should. The key in doing this successfully lies in the code foundation. It must be written to be re-usable in order to avoid re-working it over and over again every time. This takes some experience to avoid wasting precious time. This was a great design choice for me and will continue to do so as more special cases pop up, however I believe from working through 4 so far, the weapon system likely covers 95% of all weapons required from here on out.
Q2WF to WFR Challenges
There were multiple challenges faced during the re-creation process of each weapon.
The original model is completely un-usable in Roblox. Every vertex was reconstructed to create new models.
The original animation is vertex animation and it is not supported in Roblox. A custom rig with bones and skinning influences on the reconstructed mesh was built as required for a custom animation implementation.
The original textures are a simple flat diffuse, are pixelated and too low quality.
The Quake 2 engine handles settings for interpolations like blending, idle pausing, etc, therefore a custom LUA implementation of gameplay mechanics was created from scratch to closely resemble the visual appeal of Q2WF.
To Clarify: None of the original Quake 2 Code, Models, Textures or Animation are used directly in Weapons Factory Roblox.
Work was done to create a custom implementation of each element of an asset to match Q2WF, in a similar feel with a new shade of light for WFR.
Next months focus is Grenades
For Quake 2 Weapons Factory in Roblox
Implement Grenade System
Continue working through the Marine Class features
Add Model, Animation, FX and Lua Scripts for Normal, Proximity and Turret Grenades.
Bonus tasks if extra time:
Add Animation Events that trigger sounds like reload (currently using task.wait() in a coroutine)
Rocket splash damage, Rocket blast force, Rocket Jumping
Add variation of sounds when player gets hurt
Comments