Weather and weapons system changes
Today’s update is all all about weapons systems and weather!
While I have been somewhat negligent lately with progress on project PW due to work commitments, I’ve quietly integrated a particle based weather system, it need’s a little work to polish it up and get it displaying exactly how I’d like it, including spawning sub particles for splashes when rain particles collide with either the player or the world.
With that in mind, and since I recently shifted weapon sprites out of the arm sprite (A hold-off from the placeholder player sprite), what I plan to do next is add a weapon temperature system which could later down the line be used to add additional features such as weapons jam, overheat, etc.
Essentially the weapon will have a base temp (0), and when a shot is fired, increment by a variable value each time the gun is fired, for example the base rifle will increment by 5 – meanwhile the current temp will count down to zero, pausing for 1 second each time the fire button is pressed (allowing the current temp to increase cleanly).
Player fires rifle, current temp increases to 5, if the player does not fire again, after 1 second the current temp of 5 will count down to zero (because we need the temperature to decrease relatively fast, it will run at -20 per second, we’ll refer to this as decay rate), meaning that if you rattle the fire button to 95, it will take approximately 5 seconds to reset to 0.
To make this useful we can implement a check that if the current temperature is higher than a variable we will call “templock” which as an example would be 100, disable the ability to fire and wait a variable amount of seconds before resetting the current temperature to 60 (NOT 0, because we want to give the effect that the weapon is still retaining heat, thus if you rattle the fire button again, it will reach the point of overheating faster!
A system such as this allows us to use the environment and weather effects to better integrate the gameplay, for example if a rain drop his a hot weapon, the weapon can let off steam, as well as being able to allow collision with rain particles to effect the current temperature – for this example we can make rain droplets take the current temperature value and reduce it by 2, so if you’re outside shooting the gun in the rain, it will take longer to overheat and subsequently cool down faster. Equally if we place the player in a thermally relevant environment, we can adjust the decay rate of current temperature, for example for a snowy winter environment the decay rate can be set to -30 or even -40, if the player is in a hot environment, or near to something such as lava or molten metal, we can reduce the decay rate to -10, so cool down will still occur but at a slower rate.
Additionally, we can adjust the “templock” variable for each weapon, or for the same weapon with upgrades or player power-ups, allowing for the weapon to be fired much more before locking up.
I had initially wanted to do similar for the ejected shells from weapons fire, however doing so may result in slowdown because each shell would be spawning it’s own timer and then require collision detection with any sprite given the tag water, so it knew when to sub-spawn a steam particle, and since the shells tend to bounce around a lot, it seemed to be more logical to me that I animate the shell to appear hot and cool as it falls, thus removing the need to handle temperature for them.