{"action":"created","issue":{"url":"https://api.github.com/repos/jastice/boxes-and-bubbles/issues/1","labels_url":"https://api.github.com/repos/jastice/boxes-and-bubbles/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/jastice/boxes-and-bubbles/issues/1/comments","events_url":"https://api.github.com/repos/jastice/boxes-and-bubbles/issues/1/events","html_url":"https://github.com/jastice/boxes-and-bubbles/pull/1","id":55047561,"number":1,"title":"Changed List to Array, elm-linear-algebra for vecs, and animationframe for time","user":{"login":"TheSeamau5","id":3227869,"avatar_url":"https://avatars.githubusercontent.com/u/3227869?v=3","gravatar_id":"","url":"https://api.github.com/users/TheSeamau5","html_url":"https://github.com/TheSeamau5","followers_url":"https://api.github.com/users/TheSeamau5/followers","following_url":"https://api.github.com/users/TheSeamau5/following{/other_user}","gists_url":"https://api.github.com/users/TheSeamau5/gists{/gist_id}","starred_url":"https://api.github.com/users/TheSeamau5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheSeamau5/subscriptions","organizations_url":"https://api.github.com/users/TheSeamau5/orgs","repos_url":"https://api.github.com/users/TheSeamau5/repos","events_url":"https://api.github.com/users/TheSeamau5/events{/privacy}","received_events_url":"https://api.github.com/users/TheSeamau5/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-01-21T17:10:10Z","updated_at":"2015-09-18T20:58:18Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/jastice/boxes-and-bubbles/pulls/1","html_url":"https://github.com/jastice/boxes-and-bubbles/pull/1","diff_url":"https://github.com/jastice/boxes-and-bubbles/pull/1.diff","patch_url":"https://github.com/jastice/boxes-and-bubbles/pull/1.patch"},"body":"Hey there,\r\n\r\nFirst of all, I'd like to say that your physics engine is really cool. I hope you don't mind if I hacked into it a little bit. \r\n\r\nI made a couple of changes which, at least on my machine (5 yr old macbook pro), have made the example run around twice as fast. Basically, on chrome, I get a consistent 30fps and it takes a while before the fan kicks in. \r\n\r\nThe changes I've made:\r\n\r\n* Switched from using Lists to using Arrays \r\n* Switch to elm-linear-algebra for vector math\r\n* Switch from Time.fps to AnimationFrame.frame\r\n\r\nI've noticed that each of these changes made the example run faster (although, you should probably try it yourself) and together the example ran about twice as fast.\r\n\r\n**I do have to note** that in order to switch from using lists to arrays, and since I don't fully understand the internals of the algorithms used (I'm not an expert on physics engines by any means), I did change one small bit. \r\n\r\nBasically, if you look at `src/BoxesAndBubblesEngine.elm`, I changed slightly how the `collide` function works. Instead of modifying both bodies when resolving the collision, I'm only modifying one of them. That's mainly because of my limitations as a programmer and all the pattern-matching on lists made me go \"huh?\". Also, in order to get the \"tail recursion\", I make use of trampolines. So, you'll notice that the `collide` function calls `trampoline`. This did make the code easier but perhaps not completely faithful to the original. The simulation does compute different values, but it doesn't seem to be significantly more \"right\" or more \"wrong\".\r\n\r\nAlso, I have to note, that if you switch from `Animation.frame` to `Time.fps`, you'll start noticing tunnelling. Small objects will just fall off the ground if they move too fast. I think it has more to do with the fact that collision doesn't look ahead in time for potential future collisions rather than because I switch from updating just one of the bodies rather than both. So, having `Animation.frame` makes things both faster and hides this artifact in the example. (I consider that a win to some extent... a hack to be sure... but a winning hack nonetheless :D )\r\n\r\nAside from that, note that I haven't changed a single function. I just switched the types of vectors and lists. I tried to make the new code look as much as the old code as possible so as not to confuse you.\r\n\r\nI don't know if you're interested in this pull request or even accept them, but I'll just put it here in any case.\r\n\r\nAwesome engine btw,\r\nHassan Hayat"},"comment":{"url":"https://api.github.com/repos/jastice/boxes-and-bubbles/issues/comments/141567549","html_url":"https://github.com/jastice/boxes-and-bubbles/pull/1#issuecomment-141567549","issue_url":"https://api.github.com/repos/jastice/boxes-and-bubbles/issues/1","id":141567549,"user":{"login":"david-crespo","id":3612203,"avatar_url":"https://avatars.githubusercontent.com/u/3612203?v=3","gravatar_id":"","url":"https://api.github.com/users/david-crespo","html_url":"https://github.com/david-crespo","followers_url":"https://api.github.com/users/david-crespo/followers","following_url":"https://api.github.com/users/david-crespo/following{/other_user}","gists_url":"https://api.github.com/users/david-crespo/gists{/gist_id}","starred_url":"https://api.github.com/users/david-crespo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/david-crespo/subscriptions","organizations_url":"https://api.github.com/users/david-crespo/orgs","repos_url":"https://api.github.com/users/david-crespo/repos","events_url":"https://api.github.com/users/david-crespo/events{/privacy}","received_events_url":"https://api.github.com/users/david-crespo/received_events","type":"User","site_admin":false},"created_at":"2015-09-18T20:58:18Z","updated_at":"2015-09-18T20:58:18Z","body":"Any progress here? This package is wonderful by the way."}}