Lagrangian-based Dynamics for Game Optimization