Added server/dot tick groundwork

TODO: tidy up code...
move helper functions to a new .cs file.