ecs-demo
ecs-demo copied to clipboard
Compile Asteroids on WSL: error: the compiler is unable to type-check this expression in reasonable time;
❯ swift run Asteroids
Building for debugging...
/home/arckex/ecs-demo/Sources/Asteroids/EntityCreator.swift:94:14: error: the compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions
.addInstance(Display(renderable: SpaceshipView()))
Particles runs and looks great! I can get about 1500 particles on WSLg and stay at 60fps. I think that's pretty awesome. Thanks for the code.
It was a red herring. My compiler didn't like the raw values from the enums in the initializer.
Changing EntityCreator.swift lines 80 fixed this for me, and it runs great -- thanks!
fsm.createState(name: .playing)
.addInstance(Motion(velocityX: 0, velocityY: 0, angularVelocity: 0, damping: 15))
.addInstance(
MotionControls(
left: [Int32(SDLK_LEFT), Int32(SDLK_a)],
right: [Int32(SDLK_RIGHT), Int32(SDLK_d)],
accelerate: [Int32(SDLK_UP), Int32(SDLK_w)],
accelerationRate: 100,
rotationRate: 3
)
)
.addInstance(Gun(offsetX: 8, offsetY: 0, minimumShotInterval: 0.3, bulletLifetime: 2))
.addInstance(GunControls(trigger: Int32(SDLK_SPACE)))