Live data from Hacker News

Translating a Fortran F-16 Simulator to Unity3D

vazgriz.com

41–50 of 129 posts

Re: Translating a Fortran F-16 Simulator to Unity3D

#42
post #6

> Note that Fortran supports arrays with an arbitrary starting index, in this case -2. So this table supports indices in the range [-2, 9]. That is such a useful feature! Surprised I haven’t seen that more often. So much fiddly code exists that’s just fixing offsets to conform to 0 (or 1 for Lua) -based indexing!

Lua actually has arbitrary indexing, it's just that some iterator functions in the standard library assume arrays begin at 1.

Re: Translating a Fortran F-16 Simulator to Unity3D

#43

When I was growing up computers were getting faster by leaps and bounds, and I remember a video game that was so 'sophisticated' that it needed a math (FP) co-processor (80387) to play some parts of it: > The program requires a minimum of a 12MHz 80286, 1MB RAM, DOS 5.0 or DR DOS, one 1.2MB 5 1⁄4" or 1.44MB 3 1⁄2" disk drive, hard drive with 11MB of free disk space, and VGA graphics. In addition, Falcon3.O supports a…

Falcon game still have a large following today.

Re: Translating a Fortran F-16 Simulator to Unity3D

#44
post #18

Earlier quoted context omitted.

I'd agree with 1-based indexing problems, but not 0-based, which seems very natural. And if you have -2-based, I'd argue that perhaps you don't want an array.

I think it's down to personal preferences/how you think. I haven't actually used any languages that didn't have 0 based indexing, but I remember it being very painful and super unintuitive to learn, it just didn't make sense at all (still doesn't, but it's not a problem for me anymore). I always thought 1 based would make a lot more sense and be way easier to learn.

The zero-based approach makes sense in C, where it is syntactic sugar and `a[i]` is equal to `*(a + i)` Treating it as offset of 0 is logical.

The more you go away from raw pointer semantics the less intuitive it gets.

Re: Translating a Fortran F-16 Simulator to Unity3D

#45
post #6

> Note that Fortran supports arrays with an arbitrary starting index, in this case -2. So this table supports indices in the range [-2, 9]. That is such a useful feature! Surprised I haven’t seen that more often. So much fiddly code exists that’s just fixing offsets to conform to 0 (or 1 for Lua) -based indexing!

not sure why would i want that. Now to get the 3rd element from array, you have to know the start index, so another parameter to pass to function.

When you pass the array to a function, it is 1-indexed by default in the body of that function, unless that function sets a specific starting index.

Re: Translating a Fortran F-16 Simulator to Unity3D

#47
My Mom was a FORTRAN programmer for a defense contractor from the late 50s to the mid 90s. She spent her career doing things like that F16 simulator. The last thing I remember her talking about was one of the B1 or B2 bombers.

When I was elementary school age in the late 70s, I'd go into her office with her sometimes on school holidays that were not work holidays. She'd let me play Colossal Cave Adventure on a terminal in her office. I remember looking at printouts of code she was working on, and seeing a wireframe diagram of some futuristic plane. I think it must have been one of the first Stealth fighters. I wonder how many security protocols she broke by having me there... :)

She passed a way many years ago, but I think she would have been excited to see work like this.

Re: Translating a Fortran F-16 Simulator to Unity3D

#48

I'm somewhat surprised the physical units matter in a computer simulation. As long as the simulation is internally consistent (which I would assume the original code is) it seems odd to me that the nominal units are important at all. Is that video game character walking 100 yards? Or maybe the character is 500 feet tall and he's walking 50 leagues?

Physical units help modeling and review, it's much easier to sanity check values from just reading, and comparing constants. I've heard that for rendering/raytracing, a lot of people move to model light intensities by actual physical values which makes it much easier to author and compare - such as for example "oh I want a light here that is as bright as this old lightbulb I like so much, but there's sunlight also shining through the window". That's much easier than estimating it in arbitrary units, in particular as here human perception is non-linear. I assume this would be similar for other simulations.

Re: Translating a Fortran F-16 Simulator to Unity3D

#49

Earlier quoted context omitted.

Pascal (and Modula if I'm not mistaken) supports this too.

Ada too, which is of course Pascal-based. Like many programming language features, it feels like it was lost simply because C didn't have it and everyone wanted to copy C.

In C can't you just offset pointer and then you'll be able to index with arbitrary starting value?

Re: Translating a Fortran F-16 Simulator to Unity3D

#50

I'm somewhat surprised the physical units matter in a computer simulation. As long as the simulation is internally consistent (which I would assume the original code is) it seems odd to me that the nominal units are important at all. Is that video game character walking 100 yards? Or maybe the character is 500 feet tall and he's walking 50 leagues?

Gravity doesn't scale this way. Earth's gravitational pull (~10m/s^2) is a constant that ties distance to time, so if you want to observe the same gravitational effects in the same gravitational pull on a small dimensional scale, you need to adjust the time scale to compensate.

This is why scale model sets for practical VFX in cinema were always recorded at higher frame rates and then played back slower.

Post reply on HN