Dr. Eggman found an ancient relic built by his grandfather, Dr. Robotnik (about 5 years before his descent into madness). Eggman even uses this relic to turn time and space into clusters. Eventually, Sonic and his friends are transported to an area where random versions of themselves arrive: Pontaff, 4Kids, Dreamcast, Boom, and Paramount, and then ally themselves with the SonImagi cast to defeat an ancient god.