Copied framework code from tcp game