Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #32637

Re: Field Collisions Anime...

From "Chris M. Thomasson" <invalid@invalid.invalid>
Newsgroups comp.lang.javascript
Subject Re: Field Collisions Anime...
Date 2017-02-14 18:27 -0800
Organization n/a
Message-ID <o80e7b$n33$1@dont-email.me> (permalink)
References <o7op8l$otg$1@dont-email.me> <0161d58e-ee3e-408b-aa2d-aa7b0247767d@googlegroups.com> <o7rate$c6c$1@dont-email.me> <o80di7$lle$1@dont-email.me>

Show all headers | View raw


On 2/14/2017 6:16 PM, Chris M. Thomasson wrote:
> On 2/12/2017 8:00 PM, Chris M. Thomasson wrote:
>> 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:
>>> <http://jshint.com/>
>>
>> Thank you Michael. Will study the problems.
>
> error 132 is serious, undefined variable.
>
>


Fixed it. The problem did not hit because that code path was not taken 
for this experimental online code. Hit refresh, and look at line 140.
____
     if (! aratio)
     {
         this.m_xstep = axes.width() / ((width > 1) ? (width - 1) : width);

         this.m_ystep = axes.height() / ((height > 1) ? (height - 1) : 
height);

140:    //this.m_xstep /= m_aratio;
         //^^^^^^^^^^^^^^^^^^^^^^^^

         this.m_xstep /= this.m_aratio;

         return;
     }
____

Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Field Collisions Anime... "Chris M. Thomasson" <invalid@invalid.invalid> - 2017-02-11 20:46 -0800
  Re: Field Collisions Anime... jonas.thornvall@gmail.com - 2017-02-11 23:00 -0800
    Re: Field Collisions Anime... "Chris M. Thomasson" <invalid@invalid.invalid> - 2017-02-13 16:15 -0800
  Re: Field Collisions Anime... jonas.thornvall@gmail.com - 2017-02-12 01:27 -0800
    Re: Field Collisions Anime... "Chris M. Thomasson" <invalid@invalid.invalid> - 2017-03-05 18:47 -0800
  Re: Field Collisions Anime... "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-02-12 07:59 -0800
    Re: Field Collisions Anime... "Chris M. Thomasson" <invalid@invalid.invalid> - 2017-02-12 20:00 -0800
      Re: Field Collisions Anime... "Chris M. Thomasson" <invalid@invalid.invalid> - 2017-02-14 18:16 -0800
        Re: Field Collisions Anime... "Chris M. Thomasson" <invalid@invalid.invalid> - 2017-02-14 18:27 -0800

csiph-web