Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile Asteroids on WSL: error: the compiler is unable to type-check this expression in reasonable time; #8

Open
andymule opened this issue Apr 29, 2022 · 1 comment

Comments

@andymule
Copy link

❯ 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.

@andymule
Copy link
Author

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)))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant