[Fixed]2.0.2b14 Undo-ing changes vel/angvel

If you have problems installing or running Algodoo, have found a bug or need in-game help - this is it!

[Fixed]2.0.2b14 Undo-ing changes vel/angvel

Postby tatt61880 » Thu Mar 29, 2012 5:40 am

Edit: (by tatt61880 on 2012.05.13 21:26)
Fixed in 2.0.2b15. Thanks :clap:
-Tatt
----

NOTE: Please read my self-response, at first: Re: 2.0.2b14 Undo-ing changes vel/angvel.

Since Phun v5.28 or earlier.

When you undo, vel of Geoms will be changed under certain conditions.
This issue can be one of the cause of non-deterministic/randomness.

I consider that there are several conditions that can cause this issue.
* There is a small digit in vel and angvel (0.0000000003, 1.0000000003 etc.).
* Two or more Geoms are glued or fixated together.
* Other conditions of this issue aren't confirmed.

The scene below will reproduce this issue perfectly(100%).

Rating: rated 5
Filesize: 4.53 kB
Comments: 0
Ratings: 1
download


The code below is what I wrote for bug report.
// When you set angvel := 0, this issue won't happen.
Code: Select all
Scene.Clear;
Scene.addPolygon {
    color := [0, 0, 1, 1]; /* blue */
    surfaces := [[[0.0, 0.0], [1.0, 0.0], [1.0, 1.0]]];
    entityID := 1;
    geomID := 1;
    pos := [0.0, 0.0];
    body := 1;
    vel := [1.0000000003, 0.0];
    angvel := 0.0000000003
};
Scene.addPolygon {
    color := [1, 0, 0, 1]; /* red */
    surfaces := [[[0.0, 0.0], [1.0, 0.0], [1.0, 1.0]]];
    entityID := 2;
    geomID := 2;
    pos := [0.5, 0.3];
    body := 1;
    vel := [1.0000000005, 0.0];
    angvel := 0.0000000003
};


== How to reproduce bug ==
When you opened the scene,
vel := [1.0000000, -3.7617631e-011]; // blue one
vel := [1.0000000, 3.7617631e-011]; // red one
angvel := 1.5047052e-010;
(NOTE: When I open the scene, it sometimes says vel = [1.0000000, -3.7617603e-011] (instead of [1.0000000, -3.7617631e-011]), and angvel = 1.5047041e-010. I cannot reproduce the issue.... Maybe another bug?)

Sim start and Undo.
Then, the vel and angvel will be changed.
vel := [1.0000000, 2.9481001e-011]; // red one
angvel := 1.1792400e-010;

== Survey results ==
Surprisingly, this change is not random.
The plot below shows the relation between #trials and vel/angvel : exponentially decrease.
i.e. vel = first_vel * (second_vel/first_vel)^(#undo).
Image

math.abs(vel(1)) // 10 trials
Code: Select all
3.7617631e-011
2.9481001e-011
2.3104324e-011
1.8106849e-011
1.4190343e-011
1.1121021e-011
8.7154728e-012
6.8303696e-012
5.3529403e-012
4.1951165e-012


angvel // 10 trials
Code: Select all
1.5047052e-010
1.1792400e-010
9.2417296e-011
7.2427397e-011
5.6761373e-011
4.4484083e-011
3.4861891e-011
2.7321478e-011
2.1411761e-011
1.6780466e-011
Last edited by tatt61880 on Sun May 13, 2012 2:26 pm, edited 1 time in total.
Reason: Fixed!
NOTE: I'm not an Algoryx member.
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
User avatar
tatt61880
[Most Helpful Person 2010]
 
Posts: 1150
Joined: Mon Aug 31, 2009 5:45 pm
Location: Tokyo, Japan

Re: 2.0.2b14 Undo-ing changes vel/angvel

Postby tatt61880 » Fri Mar 30, 2012 1:46 am

Sorry, this issue happens not only with Polygons, but also with Circles and/or Boxes.
vel/angvel decrease exponentially. i.e. vel = first_vel * (second_vel/first_vel)^(#undo).
I've edited my post above.

The code below is an example.
Code: Select all
Scene.Clear;
Scene.addCircle {  /* blue circle */
    color := [0, 0, 1, 1];
    radius := 1;
    size := [1, 1];
    entityID := 1;
    geomID := 1;
    pos := [0.0, 0.0];
    body := 1;
    vel := [1.0000000003, 0.0];
    angvel := 0.0000000003
};
Scene.addBox {  /* red box */
    color := [1, 0, 0, 1];
    size := [1, 1];
    entityID := 2;
    geomID := 2;
    pos := [0.5, 0.3];
    body := 1;
    vel := [1.0000000005, 0.0];
    angvel := 0.0000000003
};
NOTE: I'm not an Algoryx member.
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
User avatar
tatt61880
[Most Helpful Person 2010]
 
Posts: 1150
Joined: Mon Aug 31, 2009 5:45 pm
Location: Tokyo, Japan

Re: 2.0.2b14 Undo-ing changes vel/angvel

Postby tatt61880 » Sat Mar 31, 2012 9:24 am

I guess the cause of this issue must be re-calculating process for vel/angvel of glued/fixated geoms when Algodoo loaded scene or undo scene.
You can

== My hypothesis ==
1. Algodoo loads a scene which data = A.
2. Algodoo re-calculate the data(A), then data = func(A) = B.
3. Algodoo sets the data(B) into memory for undoing.
4. When you undo the scene, Algoodo remember the scene is data = B.
5. Algodoo re-calculate the data(B), then data = func(B) = C.

After 2. and 5. the data should be same.
If func(B) = B, it's no problem. But in some case, func(B) != B, actually. I think this happens by precision issue.

====
There must be re-calculating process, because when you load next data, angvel != 0.0.
Code: Select all
Scene.Clear;
App.GUI.Forces.velocities = true;
App.GUI.Forces.rotation = true;
App.GUI.Forces.drawValues = true;
Scene.addBox {
    color := [0, 0, 1, 1];
    body := 1;
    angvel := 0.0;
};
Scene.addBox {
    color := [1, 0, 0, 1];
    body := 1;
    pos := [1, 0];
    vel := [0.0, 1.0];
    angvel := 0.0;
};


== How to fix? ==
If my hypothesis is correct, you can fix this issue. Do not re-calculating vel/angvel. ;)

NOTE: I believe this issue is one of a cause of randomness but there must be other cause of randomness.
NOTE: I'm not an Algoryx member.
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
User avatar
tatt61880
[Most Helpful Person 2010]
 
Posts: 1150
Joined: Mon Aug 31, 2009 5:45 pm
Location: Tokyo, Japan

Re: 2.0.2b14 Undo-ing changes vel/angvel

Postby emilk » Wed May 09, 2012 2:39 pm

The cause of this is that it is only the velocity of geometries that are serialized, not the body. The body velocity is calculated from the geometry velocity and vsv, producing rounding errors.

I will fix this for undo/redo in the next beta, but it is actually a bit harder to fix for scene save/load. I will think it over.
Emil Ernerfeldt, lead developer
emilk
 
Posts: 616
Joined: Mon Aug 31, 2009 11:01 am
Location: Umeå, Sweden

Re: 2.0.2b14 Undo-ing changes vel/angvel

Postby tatt61880 » Wed May 09, 2012 6:30 pm

Thanks!

emilk wrote:but it is actually a bit harder to fix for scene save/load. I will think it over.

Does this mean that reloading scene even changes vels?
NOTE: I'm not an Algoryx member.
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
User avatar
tatt61880
[Most Helpful Person 2010]
 
Posts: 1150
Joined: Mon Aug 31, 2009 5:45 pm
Location: Tokyo, Japan

Re: 2.0.2b14 Undo-ing changes vel/angvel

Postby emilk » Thu May 10, 2012 5:31 pm

tatt61880 wrote:Thanks!

emilk wrote:but it is actually a bit harder to fix for scene save/load. I will think it over.

Does this mean that reloading scene even changes vels?


For composite bodies, yes. But only sometimes, and only very little. I'll try to fix this for the next beta.
Emil Ernerfeldt, lead developer
emilk
 
Posts: 616
Joined: Mon Aug 31, 2009 11:01 am
Location: Umeå, Sweden

Re: 2.0.2b14 Undo-ing changes vel/angvel

Postby tatt61880 » Thu May 10, 2012 5:40 pm

emilk wrote:
tatt61880 wrote:Thanks!

emilk wrote:but it is actually a bit harder to fix for scene save/load. I will think it over.

Does this mean that reloading scene even changes vels?


For composite bodies, yes. But only sometimes, and only very little. I'll try to fix this for the next beta.

Great! I wish you success. ;)
NOTE: I'm not an Algoryx member.
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
User avatar
tatt61880
[Most Helpful Person 2010]
 
Posts: 1150
Joined: Mon Aug 31, 2009 5:45 pm
Location: Tokyo, Japan

Re: 2.0.2b14 Undo-ing changes vel/angvel

Postby emilk » Sun May 13, 2012 10:24 am

Should be fixed now in b15
Emil Ernerfeldt, lead developer
emilk
 
Posts: 616
Joined: Mon Aug 31, 2009 11:01 am
Location: Umeå, Sweden


Return to Help / Bug reports

Who is online

Users browsing this forum: No registered users and 0 guests