Add shared.h (OMG!), implement some game functions.