Interesting... I found similar code in the new_design branch and hence in my X Mod as well.
As far as I understand the code, nx and ny are intended to be the components of a vector that is perpendicular to the segment which has been hit. Initially, this vector is calculated from the end points of the segment that has been hit by a simple rotation (at least in new_design). Yet the vector is not normalized, and this is done by dividing each component by the length of the original vector.
A division by 0 error would mean, that the original vector had the lenght 0.
I wonder how this is possible, because originally the length of a segment is limited to be at least 2.
Do you have a clue when a segment has length=0?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Segment lengths are scaled down and if they get too small m[]/m[i] (effective segment length) becomes 0. This is also the reason, why organisms whose segments are all smaller than 2.5 (sometimes larger) disappear too. Because they get a _mass and _I (Inertia) of 0 this will also create division by 0 errors.
I really don´t want to ban segments smaller than 4 and these miniature organisms die immediately and don´t disturb the simulation.
But I have to reinstate the killing mechanism for these stillbirths.
Normally, it shouldn´t be a problem (they die and decay), but if someone wants to play with immortal organisms (like in your mod), they would accumulate because they also don´t breath, because organisms without mass don´t need to xD.
Last edit: MarcoA 2015-04-10
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I should try to to simulate it with biogenesis v0.8. The bug never appeared in the X Mod yet, although I was running a simulation with many (also small) organisms and had a conditional breakpoint that checked for segment lenght = 0.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Quote:"But I have to reinstate the killing mechanism for these stillbirths.
Normally, it shouldn´t be a problem (they die and decay), but if someone wants to play with immortal organisms (like in your mod), they would accumulate because they also don´t breath, because organisms without mass don´t need to xD."
Ok, I even think that it slows the game down noticeably, if this mechanism isn´t in the simulation.
I will upload a new jar.file. Please download again.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Great news!
It was a division by 0 error in touchMove()
...
double modn = Math.sqrt(nx * nx + ny * ny);
// The bug fix
if (modn == 0) {
modn = 0.000000000000001;
}
//
nx /= modn;
ny /= modn;
...
modn can become 0 and then there is the fatal division, and nx/ny will be NaN, and the consequences are catastrophic for both colliding organisms.
Found it by debugging for many hours, but I am really happy now.
I will upload the fixed 1.41 now :)
Interesting... I found similar code in the new_design branch and hence in my X Mod as well.
As far as I understand the code, nx and ny are intended to be the components of a vector that is perpendicular to the segment which has been hit. Initially, this vector is calculated from the end points of the segment that has been hit by a simple rotation (at least in new_design). Yet the vector is not normalized, and this is done by dividing each component by the length of the original vector.
A division by 0 error would mean, that the original vector had the lenght 0.
I wonder how this is possible, because originally the length of a segment is limited to be at least 2.
Do you have a clue when a segment has length=0?
Segment lengths are scaled down and if they get too small m[]/m[i] (effective segment length) becomes 0. This is also the reason, why organisms whose segments are all smaller than 2.5 (sometimes larger) disappear too. Because they get a _mass and _I (Inertia) of 0 this will also create division by 0 errors.
I really don´t want to ban segments smaller than 4 and these miniature organisms die immediately and don´t disturb the simulation.
But I have to reinstate the killing mechanism for these stillbirths.
Normally, it shouldn´t be a problem (they die and decay), but if someone wants to play with immortal organisms (like in your mod), they would accumulate because they also don´t breath, because organisms without mass don´t need to xD.
Last edit: MarcoA 2015-04-10
I should try to to simulate it with biogenesis v0.8. The bug never appeared in the X Mod yet, although I was running a simulation with many (also small) organisms and had a conditional breakpoint that checked for segment lenght = 0.
Quote:"But I have to reinstate the killing mechanism for these stillbirths.
Normally, it shouldn´t be a problem (they die and decay), but if someone wants to play with immortal organisms (like in your mod), they would accumulate because they also don´t breath, because organisms without mass don´t need to xD."
Ok, I even think that it slows the game down noticeably, if this mechanism isn´t in the simulation.
I will upload a new jar.file. Please download again.