Body Equations of Motion
During the contact the contact force is applied at equal and opposite measure on the two bodies
$$ \begin{aligned} m_1 \ddot{x}_1 &= -F = -k\,e - d\,\dot{e} \\ m_2 \ddot{x}_2 & = F = k\,e + d\,\dot{e}\end{aligned} $$
The accelerations of the two bodies are expressed in terms of the center of mass acceleration $\ddot{x}_c$ and the overlap acceleration $\ddot{e}$.
$$ \begin{aligned}
\ddot{x}_1 & = \ddot{x}_c + \frac{m_2}{m_1+m_2} \ddot{e} \\
\ddot{x}_2 & = \ddot{x}_c - \frac{m_1}{m_1+m_2} \ddot{e}
\end{aligned}$$
Use the accelerations in the equations of motion and solve for $\ddot{x}_c$ and $\ddot{e}$
$$ \begin{aligned}
\ddot{x}_c & = 0 \\
\ddot{e} & = - \frac{m_1+m_2}{m_1 m_2} (k\,e + d\,\dot{e})
\end{aligned} $$
Overlap Equations of Motion
So besides the obvious that the center of mass velocity remains constant $\dot{x}_c = \mbox{(const)}$ the overlap obeys the 1D damped vibration equation
$$ \mu\, \ddot{e} = -k\, e - d\,\dot{e} $$
Where $\mu = \frac{m_1 m_2}{m_1+m_2}$ is the reduced mass of the system.
Damped Harmonic Solution
We need to specify the initial conditions at $t=0$ as $e=0$ and $\dot{e}=v$, where $v = \dot{x}_1 - \dot{x}_2$ is the relative speed at impact. The general solution of the equations of motion is
$$ e(t) = \frac{v}{\omega} \exp(-\beta t) \sin(\omega t) $$
Using the substitution $k = \mu \omega_n^2$ and $d = 2 \zeta \mu \omega_n$ the above solves the equations of motion when $\omega = \omega_n \sqrt{1-\zeta^2}$ and $\beta = \zeta \omega_n$
$$ e(t) = \frac{v}{\omega_n} \left( \frac{ \exp(-\zeta \omega_n t) \sin (\omega_n t \sqrt{1-\zeta^2})}{\sqrt{1-\zeta^2}} \right) $$
The individual object positions are thus
$$\begin{aligned}
x_1 (t) & = \dot{x}_c\,t + \frac{m_2}{m_1+m_2} (e(t)-r_1-r_2) \\
x_2 (t) & = \dot{x}_c\,t - \frac{m_1}{m_1+m_2} (e(t)-r_1-r_2) \\
\end{aligned} $$
Parametrized Solution
$$\begin{cases}
v & = \dot{x}_1 - \dot{x}_2 & & \mbox{relative speed at }t =0 \\
\mu & = \frac{m_1 m_2}{m_1+m_2} & & \mbox{reduced mass} \\
\omega_n & = \sqrt{ \frac{k}{\mu} } & & \mbox{natural frequency} \\
\zeta & = \frac{d}{2 \mu \omega_n} & & \mbox{damping ratio} \\
\omega & = \omega_n \sqrt{1-\zeta^2} & & \mbox{damped frequency} \\
\varphi &= \frac{t}{\omega_n} & & \mbox{phase angle}
\end{cases} $$
$$\boxed{ \begin{aligned}
e & = \frac{v}{\omega} \exp(-\zeta \varphi) \sin\left( \frac{\omega}{\omega_n} \varphi \right) \\
\dot{e} & = v\, \exp(-\zeta \varphi) \left( \cos\left( \frac{\omega}{\omega_n} \varphi \right) - \frac{\zeta \omega_n}{\omega} \, \sin\left( \frac{\omega}{\omega_n} \varphi \right) \right)
\end{aligned} } $$
Force vs. Time
Using the solution from above the force is evaluated from $F = k e + d \dot{e}
= (\mu \omega_n^2) e + (2 \zeta \mu \omega_n) \dot{e}$ as
$$ F = \mu v \exp(-\zeta \varphi) \left( 2 \zeta \omega_n \cos \left( \frac{\omega}{\omega_n} \varphi\right) + \frac{\omega_n^2 (1-2\zeta^2)}{\omega} \sin \left( \frac{\omega}{\omega_n} \varphi\right) \right) $$
Note that at critical damping with $\zeta = 1$ the overlap and force equations are
$$e = \frac{v \varphi \, {\rm e}^{-\varphi} }{\omega_n}$$
$$F = \mu v \omega_n (2-\varphi) \, {\rm e}^{-\varphi}$$
Energy Loss due to Damping
Since the center of mass moves with constant velocity the change in kinetic energy is purely because of losses during the impact.
$$ \Delta K = \frac{1}{2} \mu v^2 - \frac{1}{2} \mu \dot{e}^2 $$
The end of the contact is when $e=0$, or specifically that the phase angle $\varphi = \frac{\pi}{\sqrt{1-\zeta^2}}$
$$\Delta K = \frac{1}{2} \mu v^2 \left(1 - \exp\left( - \frac{2 \pi \zeta}{\sqrt{1-\zeta^2}} \right) \right) $$
So now if you want to target specific energy loss ratio $\eta = \frac{\Delta K}{K}$ you need to use damping ratio