Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "Chris M. Thomasson" Newsgroups: comp.lang.javascript Subject: Re: Field Collisions Anime... Date: Sun, 12 Feb 2017 20:00:27 -0800 Organization: n/a Lines: 51 Message-ID: References: <0161d58e-ee3e-408b-aa2d-aa7b0247767d@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 13 Feb 2017 03:58:38 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="3cd205dee6ea66f62755079ba0e04480"; logging-data="12492"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1//MtOdX25YLYb1o1KfkXqSmV9CpMFVT4k=" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 In-Reply-To: <0161d58e-ee3e-408b-aa2d-aa7b0247767d@googlegroups.com> Cancel-Lock: sha1:LfhnfrUxFsrulsCUs5d83lsaN+s= Xref: csiph.com comp.lang.javascript:32617 On 2/12/2017 7:59 AM, Michael Haufe (TNO) wrote: > Chris M. Thomasson wrote: >> Here is the non-interactive pre-alpha test origin of a "collision >> avoidance system" based on vector fields. Its meant to be a fun, >> hopefully interesting, experiment. So far, the damn field lines just >> want to help the vehicles in circles avoid crashes. In this crude setup, >> a collision will make the anime flash, and tangentially move the >> colliding agents out of the way. The crude online example is here: >> >> http://funwithfractals.atspace.cc/ct_gf_explore >> (does this work for you at all?) >> >> Fwiw, I first posted about this here: >> >> https://plus.google.com/101799841244447089430/posts/JmbpLWvdJEf >> (has a screenshot of the program...) >> >> Can you please give it a go? Is it slow as shi%? Crap? >> >> Any radical bugs in the JavaScript? ;^o >> >> Thanks. > > averaging about 16 FPS. Nearly 20% of the time spent on Garbage Collection. Yup. Its because of all the damn arrays. The code uses them in the animation loop. Fwiw, this is in relation to: https://groups.google.com/d/topic/comp.lang.javascript/dgakiMzhgv0/discussion I did a benchmark, and the array version is slower. > > There are a significant number of optimizations that could be done here, such as double-buffering, not drawing in Immediate Mode, and others. > > Missing 'use strict' pragma > > JSHint shows a number of minor issues you should handle: Thank you Michael. Will study the problems. > > Aside: You seem to write JavaScript like a C or C++ programmer which is a little strange. > Big time. I am actually not all that used to JavaScript. However, its a nice little medium to get some quick, hopefully portable, animations up, to see whats going on.