In this week's update, I would like to share a feature that I made to improve the overall momentum of the game--the Camera Motion System-- or CMS in short.
During the development of 《Drifting》, I learned that adding camera motion at the right moment will create a positive feedback to players in the form of either enhanced momentum, increase spatial awareness, less motion sickness or simply better visual aesthetics.
(The left side is dashing backward without CMS, the right side is dashing backward with CMS. Notice at the right side, the character seems to bounce back from the camera at the end.)
(The left side is dashing leftward without CMS, the right side is dashing leftward with CMS. The right side looks like it adopts a higher initial velocity, but in fact, both are dashing at the same speed.)
The difficulties I encountered when implementing this camera feature are two folds: Different animation requires different camera offsets and blend out conditions; multiple animations may occur at the same time which means multiple camera motion may interfere with each other during gameplay.
To solve both these issues at once, I created a stack that holds all the currently active camera motion ques--each contains its own camera offset, blend out duration and speed. The combination of these offsets is calculated every tick, which is then used to interpolate the current camera offset.
(The stack contains all the information needed to calculate the targeted camera offset. The targeted offset is then used to interpolate the current camera offset for every tick.)
When one of the ques are no longer needed, to remove the camera effect is simply popping out the desired que from the stack and the targeted camera offset will then reflect that change accordingly.
(Removing or adding camera motions is essentially removing or adding ques containing camera information.)
I hope you enjoy the article, have a wonderful weekend! :3