johnBuffer / NoCol

Trajectories finder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ported the code to web

KonradLinkowski opened this issue · comments

Hey, I've ported your code to TypeScript so it's possible to run it in the browser.
How long does it usually take to evolve to the non-collision state?
https://konradlinkowski.github.io/AntiCollision/
https://github.com/KonradLinkowski/AntiCollision

If you disable the v-sync it takes a few seconds. Not sure how it works on the browser, though.

@rodrigo1406 Unfortunately there's no such thing as v-sync on the browser, although the "window.requestAnimationFrame() method tells the browser that you wish to perform an animation and requests that the browser calls a specified function to update an animation before the next repaint. The method takes a callback as an argument to be invoked before the repaint."

Syntax: window.requestAnimationFrame(callback);

And @KonradLinkowski this is awesome! It'd be so cool if you ported AutoRocket (https://github.com/johnBuffer/AutoRocket) too!

@rodrigo1406 it's probably because v-sync sets the FPS to be your desktop - in most cases 60 FPS.
I didn't really run the original app, but it probably runs way faster.

@nuggetofwisdom you are right. requestAnimationFrame is v-synced by default.
I can calculate physics frames in the web worker or using setTimeout and drawing in UI frames independently.
My second thought is to precalculate desired positions so the circles start in kind of no collision mode.

Autorocket seems to be much more work and I'm not involved in neural networks yet.
Hope @johnBuffer will add the video link to the description of that project because I didn't know what it is at first.

Thanks for the feedback :)