[HN Gopher] C Port of Ken Thompson's Space Travel
       ___________________________________________________________________
        
       C Port of Ken Thompson's Space Travel
        
       Author : nixcraft
       Score  : 119 points
       Date   : 2023-02-05 12:37 UTC (10 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | SloopJon wrote:
       | At the risk of derailing the conversation on this fun project,
       | one my first thoughts was that this game for a long-dead computer
       | is probably still under copyright for another few decades. Then
       | it occurred to me that even after all of that SCO nonsense, I
       | don't know what the copyright/license status of ancient Unix is.
       | 
       | The code in this repo does not show any license. The repo from
       | which it's derived claims GPL 3.0, although the README notes:
       | "The code in the original scans are (c) Micro Focus who own the
       | rights to the Unix source code" (Micro Focus International having
       | acquired Attachmate, which acquired Novell, which bought Unix
       | System Laboratories from AT&T).
        
         | chungy wrote:
         | > after all of that SCO nonsense, I don't know what the
         | copyright/license status of ancient Unix is.
         | 
         | It's under a BSD-style license:
         | http://www.lemis.com/grog/UNIX/ancient-source-all.pdf
        
           | SloopJon wrote:
           | I wonder whether that license is valid, given that it was
           | issued by Caldera, when Novell was in fact determined to be
           | the copyright holder.
           | 
           | I did find a forum in which a user stated: "[Novell's Legal
           | Vice President] said that while Novell retains certain
           | copyrights over UNIX, they also acknowledge and recognize the
           | validity of certain legacy SCO/Caldera licenses regarding
           | UNIX technologies."
           | 
           | https://www.betaarchive.com/forum/viewtopic.php?t=25745
        
       | dotancohen wrote:
       | For those unfamiliar with the game, development of Space Travel
       | consisted of several ports to different contemporary OSes. This
       | directly led Thompson to develop ideas for his own OS, which we
       | today know as the original Unix.
        
         | exitb wrote:
         | Turns out that Unix was the ultimate yak shave for Space
         | Travel.
        
           | mrlonglong wrote:
           | Yes apparently SpaceX and NASA use Linux in space.
        
       | ape4 wrote:
       | If I understand correctly there was no floating point on the
       | PDP-7                   // format for hand-rolled floating point
       | used in PDP-7 version         struct flt {             char exp;
       | // exponent             int m1;  // signed 36-bit mantissa (0-18)
       | int m2;  // 18-36         };
        
         | thefilmore wrote:
         | Yup, Ken and Dennis wrote an entire floating point library from
         | scratch for the game, among other things. [1]
         | 
         | > Also during 1969, Thompson developed the game of 'Space
         | Travel.' First written on Multics, then transliterated into
         | Fortran for GECOS (the operating system for the GE, later
         | Honeywell, 635), it was nothing less than a simulation of the
         | movement of the major bodies of the Solar System, with the
         | player guiding a ship here and there, observing the scenery,
         | and attempting to land on the various planets and moons. The
         | GECOS version was unsatisfactory in two important respects:
         | first, the display of the state of the game was jerky and hard
         | to control because one had to type commands at it, and second,
         | a game cost about $75 for CPU time on the big computer. It did
         | not take long, therefore, for Thompson to find a little-used
         | PDP-7 computer with an excellent display processor; the whole
         | system was used as a Graphic-II terminal. He and I rewrote
         | Space Travel to run on this machine. The undertaking was more
         | ambitious than it might seem; because we disdained all existing
         | software, we had to write a floating-point arithmetic package,
         | the pointwise specification of the graphic characters for the
         | display, and a debugging subsystem that continuously displayed
         | the contents of typed-in locations in a corner of the screen.
         | All this was written in assembly language for a cross-assembler
         | that ran under GECOS and produced paper tapes to be carried to
         | the PDP-7.
         | 
         | [1] https://www.bell-labs.com/usr/dmr/www/hist.pdf
        
           | JoeAltmaier wrote:
           | Brings back memories of programming in the 70s. Stuff like
           | that was necessary _all the time_. Writing your own
           | character-plotting code on a graphics terminal; wild attempts
           | to calculate floating point (or estimate it) using every
           | trick in the book and some you invented.
           | 
           | Add to that doing bit-banging on pins to simulate serial
           | protocols with timing loops; storing things in odd places
           | like the file buffer on a time-share system (used to run 20+
           | terminal sessions on a single 1MHz processor!) or the
           | previous line on a programmable terminal (up-arrow and
           | transmit-line to get it back).
        
             | thefilmore wrote:
             | The code also used a neat approximation to draw circles.
             | Instead of using sin and cos for rotating along the edge of
             | the circle to draw it, it simply used x (~= sin(x) for
             | small values) and 1-x^2/2 (a Taylor series approximation
             | derived from cos(x) = sqrt(1-sin(x)^2)), respectively.
        
               | JoeAltmaier wrote:
               | I would draw circles using vectors. A vector normal to
               | the last radii long enough to span about 7 degrees would
               | sketch a circle that looked as good as round without
               | drawing too many lines.
        
       | Waterluvian wrote:
       | Call me weird but I have an odd nostalgia for games whose control
       | schemes don't make all that much sense. I had a bunch of Apple II
       | games where the keys weren't laid out ergonomically at all. As if
       | they were seen more as "software" than a console game.
        
         | acadiel wrote:
         | Half the fun with old computer games was figuring out which
         | keys they used (if you didn't have the manual)!
        
         | flohofwoe wrote:
         | Sometimes the control scheme suddenly makes a lot of sense when
         | you see the original keyboard layout, and sometimes joysticks
         | also emulated key pressed (like here on the ZX Spectrum:
         | https://en.wikipedia.org/wiki/ZX_Interface_2).
        
         | Bluecobra wrote:
         | One thing I kinda miss were those little keyboard overlays to
         | help remember the control scheme.
        
       | dang wrote:
       | I found surprisingly little in past HN threads:
       | 
       |  _Space Travel (the video game that led to creation of Unix)_ -
       | https://news.ycombinator.com/item?id=12563387 - Sept 2016 (1
       | comment)
       | 
       |  _A video game contributed to Unix Development_ -
       | https://news.ycombinator.com/item?id=9690739 - June 2015 (11
       | comments)
       | 
       |  _Early Unix history and evolution_ -
       | https://news.ycombinator.com/item?id=4048704 - May 2012 (0
       | comments but top text mentions it)
        
       | juancn wrote:
       | The amount of octal numbers in the source code makes my brain
       | itch.
       | 
       | It emulates PDP's floating point support with 36 bit words.
        
       | mseepgood wrote:
       | I'm gonna port it to his new language Go. lol
        
         | Yuioup wrote:
         | I think you mean Rust
        
           | mseepgood wrote:
           | No, Ken Thompson didn't create Rust.
        
         | queuebert wrote:
         | Which graphics library would you use? Or would you still tie
         | into SDL2, which is written in C. ;-)
        
           | tmountain wrote:
           | For me, Ebiten hits the right level of abstraction/simplicity
           | for developing games in Golang.
        
           | zserge wrote:
           | There's also https://github.com/zserge/fenster which is
           | fairly minimal and comes with Go bindings out of the box.
        
           | mseepgood wrote:
           | https://github.com/veandco/go-sdl2
           | 
           | or I'll try something like
           | 
           | https://github.com/fzipp/canvas
        
             | mseepgood wrote:
             | Here's my first shot at it: https://github.com/gophun/st I
             | don't think everything works as intended, but I'm not sure
             | yet, because I'm not familiar with the original.
        
       | fatneckbeard wrote:
       | sdl_getticks64 was undefined
       | 
       | replaced with sdl_getticks
       | 
       | now i just seea bunch of dots on a screen
       | 
       | i can zoom in i see a circle
       | 
       | i press thrust/downthrust and the circle disappears
       | 
       | not sure i get it
        
         | thefilmore wrote:
         | > sdl_getticks64 was undefined
         | 
         | I used this because it was recommended by the docs, but it's
         | somewhat recent (introduced in SDL 2.0.18, November 2021).
         | 
         | > now i just seea bunch of dots on a screen
         | 
         | The dots are other planets and moons you can travel to.
         | 
         | > i press thrust/downthrust and the circle disappears
         | 
         | If the circle disappears then you've crashed into the planet
         | (it will blink CL in the bottom right). You'll have to start a
         | new game, and thrust in the other direction this time. I've
         | added some more information to the README about the gameplay.
        
         | detrites wrote:
         | > The player can move and turn the ship, and adjust the overall
         | speed by adjusting the scale of the simulation.
         | 
         | Seems scale works with ship speed to control traversing the
         | solar systems distances:
         | 
         | https://en.m.wikipedia.org/wiki/Space_Travel_(video_game)
        
       | Egoist wrote:
       | Not sure if it's based on this, but Ken also talked about a
       | similar, but multiplayer game, to play with random people at Bell
       | Labs which sounded fun.
       | 
       | https://youtu.be/EY6q5dv_B-o?t=1171
       | 
       | I wonder if the source code for that exists too.
        
       | nativecoinc wrote:
       | Crazy. I thought Pong was "the first video game (released in the
       | 1970s)". And this sounds a lot more involved.
        
         | wrs wrote:
         | Depending on the definition you use, the first video game was
         | Spacewar! on the PDP-1, written at MIT in 1962.
         | 
         | https://www.thoughtco.com/history-of-spacewar-1992412
        
         | djur wrote:
         | Pong is one of those cases where it isn't the technical "first"
         | of anything objective. It's not the first video game, the first
         | arcade game, the first home video game, the first ping-pong
         | video game, it's not even the first game Nolan Bushnell was
         | involved with. But it was the first arcade game that was a
         | really big commercial success, that attracted leagues of
         | imitators, etc. And the same is true of Home Pong.
        
       ___________________________________________________________________
       (page generated 2023-02-05 23:01 UTC)