View Issue Details

IDProjectCategoryView StatusLast Update
0001807FSSCPFREDpublic2008-11-09 05:11
ReporterFUBAR-BDHR Assigned Totaylor  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.6.9 
Fixed in Version3.6.10 
Summary0001807: Hits-left not evaluating properly
DescriptionWhile 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 InformationOriginally 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.
TagsNo tags attached.

Activities

2008-10-30 06:53

 

turret_test.fs2 (5,872 bytes)

karajorma

2008-10-30 19:56

administrator   ~0010136

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.

FUBAR-BDHR

2008-10-30 21:08

developer   ~0010137

Last edited: 2008-10-30 21:13

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.

phreak

2008-10-30 21:14

developer   ~0010138

floating point optimizations probably.

FUBAR-BDHR

2008-10-30 21:22

developer   ~0010139

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.

phreak

2008-10-30 23:42

developer   ~0010140

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

taylor

2008-11-05 00:02

administrator   ~0010157

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.

taylor

2008-11-06 18:22

administrator   ~0010159

Should be fixed in my next multi test build.

taylor

2008-11-09 05:11

administrator   ~0010165

Fixered.

Issue History

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