add critical section for multi-thread and add Game struct to ecap global vars