Asteroids on a Klein bottle

Monkey Archive Forums/Monkey Projects/Asteroids on a Klein bottle

Warpy(Posted 2011) [#1]
This isn't quite worth adding to the apps section, but it's a bit interesting.

Someone on twitter asked, 'What if the asteroids game space wasn't a torus, but instead a klein bottle?'
He made a sketch using Processing (yuk!), but the ship was player-controlled. I thought sorting out an AI that can correctly navigate the space would be interesting, so I made this.

It was quite interesting!

If anyone's interested, you can get the source here.


GfK(Posted 2011) [#2]
Just gave it a try, if I hold cursor down for a couple of seconds, it seems to crash. Pressing refresh doesn't help either, it seems to completely kill Chrome?


Warpy(Posted 2011) [#3]
Gosh, that seems to be true! I wonder why that is.


GfK(Posted 2011) [#4]
I don't know, but for what its worth I'm having the same problem with my code and I can't get to the bottom of it, nor can I reproduce the effect in a small code sample.

I think its affecting iOS, too. When my app crashes, it will not restart.

[edit] http://monkeycoder.co.nz/Community/posts.php?topic=1583


GfK(Posted 2011) [#5]
This is weird. Try this:

1. Click your app link above.
2. Click the browser's Home button (its hidden by default).
3. Click the app link again.
4. Nothing! White screen. Dead!

That can't be right? Its not just your app, either.


marksibly(Posted 2011) [#6]
Hi,

It's happening when scale goes <0, which appears to messing up mouse/target x/y coords.

[edit]Not sure why it's crashing so 'hard' though!


GfK(Posted 2011) [#7]
But its not just that - it also crashes if you don't do anything other than hit the Home button in Chrome, then try to run the app again.


Jesse(Posted 2011) [#8]
I had that same problem with the 8-Ball game when the the scale went to 0 on the slider. I had to limit it to greater than 0.


Floyd(Posted 2011) [#9]
The screen goes white and Chrome seems unresponsive. Clicking the close button on the Kleinsteroids tab does nothing. But if I keep clicking it as rapidly as I can the tab will close and Chrome seems back to normal.

I haven't tried to understand the code. But a Klein bottle is non-orientable. So things like deciding what 'side' of a line a point is on won't make sense.


Samah(Posted 2011) [#10]
My head asplode.


Warpy(Posted 2011) [#11]
OK, it dies because when the scale is either zero or pretty-much-zero, the mouse-controlled target seems to be at co-ords on the scale of several billion units. Because Monkey won't do Mod on floats properly, I have to have a While loop which does each individual boundary-crossing one at a time. So it gets hung up doing that several squillion times.

I've added a check to make sure the scale doesn't get too small, but I'm not particularly happy with that as a solution.