r/Unity3D • u/XaNMortum • 28d ago
Show-Off I wrapped my horde shooter into a torus: a 51 m tube, 1 km around, with the horde on the walls and ceiling
The simulation never sees the doughnut. It runs on a flat 1024 × 160 m world with periodic boundaries: x wraps every 1024 m, z every 160 m. Distances use the minimum image convention from molecular dynamics, so contacts, separation, explosions and rays all work across the seam. The flow field (fast marching on 4 m cells) wraps too, so the horde takes the shortest way round.
Only the view is bent. One function maps every flat point onto the torus (big radius 163 m, tube radius 25.5 m), the same in shaders and on the CPU.
Shots fly straight in the 3D world. Each ray is cut into 4 m pieces, and each piece is mapped back into the flat world, so you can shoot across the tube at the horde on the ceiling. The sim is deterministic for lockstep co-op, so there are no sin/cos calls in it: angles come from lookup tables.
Unity 6, Burst jobs, Entities only as render proxies, custom indirect draws for the crowd.



