Statistical physics is all about emergence: take a large number of identical objects with simple rules of behaviour and interactions (plus some randomness), put them together, take a step back, and see what collective behaviour comes out. The natural language to describe the large size limit of such systems is that of large deviation functions, sometimes called dynamical free energies. They are, in essence, the actions of those processes, appearing in path integrals over Lagrangians which contain the relevant part of their dynamics. In this talk, I will present some old and recent results on the structure of large deviations in two different situations. First, I will look at well-mixed population models, where individuals of different types meet and react together to produce various effects. This can include animals eating each-other and/or reproducing, in the case of ecological models (such as the famous Lotka-Volterra predator/prey model), or molecules reacting with each-other to produce new compounds, in the case of chemical reaction networks (which include the standard mass-action dynamics for dilute chemical solutions). All of those are nonlinear stochastic processes on discrete networks. In the second part of my talk, I will look at processes in continuous space, namely nonlinear diffusions far from equilibrium. Those can be seen as the continuous limit of interacting lattice gases (particles performing random walks on a lattice). In many cases, the local average density of particles has a hydrodynamic behaviour in the large volume limit, and we will see when and why that is the case or not. I will illustrate both classes of models by exhibiting some of their dynamical phase transitions, which are qualitative differences in the states of the systems which produce specific fluctuations of some dynamical observables.