From 304358b5f928bc2d6653642aa883063bf22b84e9 Mon Sep 17 00:00:00 2001 From: Grrr kitten <158611449+GrrrKitten@users.noreply.github.com> Date: Thu, 4 Jul 2024 19:29:18 -0400 Subject: [PATCH] Gives Screenshake an actual smoothing value versus just jumping over a single frame (#6524) # About the pull request ![image](https://github.com/cmss13-devs/cmss13/assets/158611449/58503bfd-0c2e-42b9-8534-8d2d01281d28) ![image](https://github.com/cmss13-devs/cmss13/assets/158611449/226062a7-0e76-40c0-b488-1a0481125ca6) Basically in game rn, screenshake uses jump easing, which over the span of a single frame sends you from your current screen position to the location of the screenshake. This PR gives it cubic easing, which while being one of the more 'rough' easing options, makes it look like your FPS arent dropping. # Explain why it's good for the game Screenshake looked extremely low FPS/jumpy and honestly over long periods of screenshake like queen screech kinda made your eyes hurt. CM's screenshake was one of the worst of any SS13 servers and had us looking extremely dated. Screenshake should be Screenshake,not give players motion sickness This PR fixes that, now with screenshake being heavily dependent on your personal FPS choice, with those who choose to play on the server FPS/lower FPS having whats more similarly to the older 'jumpy' screenshake, while those on higher FPS have to deal with random low FPS screenshake The vids speak for themselves # Testing Photographs and Procedure
Screenshots & Videos I have vids of what it looks like too for gun recoil but photoshop refuses to render my videos so theyll come later What it used to look like: https://streamable.com/c4wk97 One of the worst examples of old screenshake (at 48fps) https://streamable.com/iyj8d7 What it looks like now (note I use 48 FPS for first one, then server FPS for low fps ones) https://streamable.com/5nd11l
Like the stuff I make? [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/J3J6102QI0) # Changelog :cl: qol: Makes screenshake look less low FPS/jumpy /:cl: --- code/modules/mob/mob_helpers.dm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index 7c44605bf4bf..4771626ee78c 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -315,7 +315,7 @@ GLOBAL_LIST_INIT(limb_types_by_name, list( message = replace_X.Replace(message, "CKTH") return message -#define PIXELS_PER_STRENGTH_VAL 24 +#define PIXELS_PER_STRENGTH_VAL 28 /proc/shake_camera(mob/M, steps = 1, strength = 1, time_per_step = 1) if(!M?.client || (M.shakecamera > world.time)) @@ -326,10 +326,10 @@ GLOBAL_LIST_INIT(limb_types_by_name, list( var/old_X = M.client.pixel_x var/old_y = M.client.pixel_y - animate(M.client, pixel_x = old_X + rand(-(strength), strength), pixel_y = old_y + rand(-(strength), strength), easing = JUMP_EASING, time = time_per_step, flags = ANIMATION_PARALLEL) + animate(M.client, pixel_x = old_X + rand(-(strength), strength), pixel_y = old_y + rand(-(strength), strength), easing = CUBIC_EASING | EASE_IN, time = time_per_step, flags = ANIMATION_PARALLEL) var/i = 1 while(i < steps) - animate(pixel_x = old_X + rand(-(strength), strength), pixel_y = old_y + rand(-(strength), strength), easing = JUMP_EASING, time = time_per_step) + animate(pixel_x = old_X + rand(-(strength), strength), pixel_y = old_y + rand(-(strength), strength), easing = CUBIC_EASING | EASE_IN, time = time_per_step) i++ animate(pixel_x = old_X, pixel_y = old_y,time = clamp(floor(strength/PIXELS_PER_STRENGTH_VAL),2,4))//ease it back