To implement this technique you'd just want to adjust the view slightly every frame by some smooth factor, typically along axes that lie within the plane of the viewport.
In other words, you want to adjust your camera position upwards and rightwards by some small periodic factor whenever the player is moving. The sine and/or cosine functions can work well for this; you could just:
- At the start of a frame, if the player is still, set a "run time" variable to 0.
- Otherwise if the player is moving, increment the run time.
- Once your view position is computed, offset it to the left by (say)
sin(run time) and upwards by (say)
You will probably want to play around with how you increment the run time, and how to damp the resulting offsets so that the effect is quite subtle, otherwise you may disorient or nauseate your players.
You can also combine this with a similar effect applied to whatever gun or implement the player is holding -- this is best done with a specific animation for that object, however. You can see in the Battlefield videos that the guns precess far more than the actual view does. This disconnect in the magnitude of the relative motion helps make the illusion feel more grounded and gives it some depth (much like parallax motion) which can make it look less fake.