View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001807 | FSSCP | FRED | public | 2008-10-30 06:53 | 2008-11-09 05:11 |
Reporter | FUBAR-BDHR | Assigned To | taylor | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.6.9 | ||||
Fixed in Version | 3.6.10 | ||||
Summary | 0001807: Hits-left not evaluating properly | ||||
Description | While testing Taylor's multi_test build I ran into a situation where 2 caps were open firing on each other even though their turrets were locked. Traced the problem down to an event based on hits-left (ship) < 96. The ship's is set to 96% hull in the ship editor. The event becomes true immediately at mission start. If I set it to 97% it works. The 96% starting value works in 3.6.9. | ||||
Additional Information | Originally noticed testing Vidmaster's Operations mission Black Sun 1 in TBP using Taylor's multi test build. Confirmed in single and multi player in both TBP and FS2 using the latest Knightly build as well. Occurs weather or not special hits are enabled. | ||||
Tags | No tags attached. | ||||
2008-10-30 06:53
|
|
|
You're basically dealing with a rounding error here. Hits-left works out the number as being 95.999998. Since that's less than 96% the SEXP triggers immediately. Not entirely sure what can be done about that. |
|
It's strange that it works in 3.6.9 though. Has something changed in the way that sexp evaluates since then? Has the way the initial hull percentage changed? Doing the math for the actual mission with special hits 96% of 260000 hull should figure out to 249600. I don't see how it can round an even whole number divisible by 100 wrong. I could see there being a problem if the initial hull was 259999 or something. |
|
floating point optimizations probably. |
|
Wonder how many missions this has the potential to break. I don't think it's an uncommon thing to have a ship with an initial hull value < 100% in a mission with a check to see if it falls below it's initial hull value. The basic court martial for firing before your told to do so scenario. |
|
A common solution would be to say 95.999998 == 96 by doing something like fabs(actual_hits_left (95.999998) - goal_hits_left (96)) < delta, where delta is a really insignificant number like 0.00001 |
|
The precent is an int value, so the problem just looks rounding related to me, rather than a fp issue. I don't see why a simple "+ 0.5f" couldn't deal with the problem. Maybe I'm just missing something, but there seems to be way too much thought going into a five second fix. |
|
Should be fixed in my next multi test build. |
|
Fixered. |
Date Modified | Username | Field | Change |
---|---|---|---|
2008-10-30 06:53 | FUBAR-BDHR | New Issue | |
2008-10-30 06:53 | FUBAR-BDHR | File Added: turret_test.fs2 | |
2008-10-30 19:56 | karajorma | Note Added: 0010136 | |
2008-10-30 21:08 | FUBAR-BDHR | Note Added: 0010137 | |
2008-10-30 21:13 | FUBAR-BDHR | Note Edited: 0010137 | |
2008-10-30 21:14 | phreak | Note Added: 0010138 | |
2008-10-30 21:22 | FUBAR-BDHR | Note Added: 0010139 | |
2008-10-30 23:42 | phreak | Note Added: 0010140 | |
2008-11-05 00:02 | taylor | Note Added: 0010157 | |
2008-11-06 18:22 | taylor | Status | new => assigned |
2008-11-06 18:22 | taylor | Assigned To | => taylor |
2008-11-06 18:22 | taylor | Note Added: 0010159 | |
2008-11-09 05:11 | taylor | Status | assigned => resolved |
2008-11-09 05:11 | taylor | Fixed in Version | => 3.6.10 |
2008-11-09 05:11 | taylor | Resolution | open => fixed |
2008-11-09 05:11 | taylor | Note Added: 0010165 |