Proton therapy is a modality in fast development. Characterized by a maximum dose deposition at the end of the proton trajectory followed by a sharp fall-off, proton beams can deliver a highly conformal dose to the tumor while sparing organs at risk and surrounding healthy tissues. New treatment planning systems based on spot scanning techniques can now propose multi-field optimization. However, in most cases, this optimization only processes the field fluences whereas the choice of ballistics (field geometry) is left to the oncologist and medical physicist. In this work, we investigate a new optimization framework based on a genetic approach. This tool is intended to explore new irradiation schemes and to evaluate the potential of actual or future irradiation systems. We propose to optimize simultaneously the target points and beam incidence angles in a continuous manner and with a variable number of beams. No \textit{a priori} technological constraints are taken into account, \textit{i.e.}~the beam energy values, incidence directions and target points are free parameters. The proposed algorithm is based on a modified version of classical genetic operators: mutation, crossover and selection. We use the real coding associated with random perturbations of the parameters to obtain a continuous variation of the potential solutions. We also introduce a perturbation in the exchange points of the crossover to allow variations of the number of beams. These variations are controlled by introducing a beam fluence lower limit. In this paper, we present a complete description of the algorithm and of its behaviour in an elementary test case. The proposed method is finally assessed in a clinically-realistic test case.