zompiexx / wargames

Wargames Simulator (Wargames Movie, 1983) by Andy Glenn - WOPR, Union Marine Bank, Pan-AM, School Computer, Tic-Tac-Toe Programs included in project
99 stars 13 forks source link
andy-glenn basic basic-80 c cpm global-thermonuclear-war imsai joshua microsoft-basic ms-basic norad tic-tac-toe tictactoe wargames wargames-movie wargames-movie-simulator wargames-movie-software wargames-simulator wopr

wargames

Wargames Movie Simulator by Andy Glenn, originally written in BASIC, and later re-written/converted to C. Both the BASIC and C versions are included in this project. It simulates the IMSAI 8080, WOPR and other Computer Systems from the Wargames Movie, 1983, featuring Matthew Broderick and Ally Sheedy.

NOTE: The C source code and scripts have been written to compile on Debian Linux. If you want to compile this code to run on any other platform, you will need to modify the code to suit your purposes. The C programs are all work in progress, so expect some bugs! The client/server mode uses telnet instead of ssh because the IMSAI 8080esp WiFi modem only supports telnet. If this is not an issue for you, then by all means use ssh (although, this will require authentication - so it's not ideal for this simulation). If you are running it in local mode, then this doesn't affect you.

TIP: In the C version of the code, some features will not work in unauthenticated telnet client/server mode (i.e. espeak, shell-gpt). If you want all features to work in client/server mode, then you can connect on the standard telnet port 23 (or ssh if you are not limited to telnet), and when prompted, authenticate/login using the same account that you used to install the wargames software, then run ~/wargames/imsai8080. The idea is that when connecting from a retro computer using a WiFi modem or serial connection, the wargames software is hosted on a small computer running Linux, ideally an SBC such as a Raspberry PI (but can be whatever you want) that is located behind the retro hardware, ideally running headless, but with audio out connected. That way, the user/operator can experience using the retro hardware as a terminal, but with all the wargames systems hosted on another server - as it would have been in the movie (other than slightly cheating with the sound).

WARNING: In addition to the simulated computer systems featured in the Wargames movie, the dialer, associated data files, and scripts may contain connection details for other systems that are period (1970s, 1980s) relevant, such as Telehack.com - which simulates the old ARPANET. You should check that the method of connection used in the scripts is acceptable for your purposes, and if not - then either modify the scripts accordingly, or not use that feature. When connecting to external systems, especially over the Internet, it is always best practice to use encrypted protocols such as ssh. For example, in order to connect to Telehack.com using ssh as opposed to telnet, you would need to modify the telehack.sh script to replace the telnet command with ssh, in the appropriate format, e.g. ssh -p 2222 username@telehack.com. It's not possible to provide the scripts for ssh access since your username to an external system will be unique, which is why the scripts provided use telnet - and are only intended to be used for guest access.

The code was originally developed on a Sinclair QL using SuperBasic, but then I re-wrote it in BASIC-80 on CP/M so it would run on my IMSAI 8080esp (emulated IMSAI 8080 replica), and I then subsequently re-wrote/converted it to C on Linux (more details on progress of the C code below) to allow additional features to be included. The code could be easily ported to other platforms. To save space in memory, the BASIC-80 code uses text files for the help pages, and these are included in the project.

If you are intending to run this on a CP/M machine, you will need a SYSGEN 64 image/boot disk.

You can use the included disk image file to create your own media or mount it using the Z80PACK or IMSAI 8080esp: https://github.com/zompiexx/wargames/blob/main/wargames.dsk

NOTE: Boot your IMSAI 8080esp using this disk image and then run: MBASIC WARGAMES

You are free to use and modify the code for your own purposes, but must credit the author, Andy Glenn, under all circumstances.

This BASIC code is fully functional, but there are some additional features that I planned to include. Most of these have been written into the C code:

NOTE: The code will run using a BASIC-80 interpreter (on a SYSGEN 64 image/boot disk), but it may not be possible to compile and link the code as it stands because of the 64KB TPA Memory limit of CP/M. To overcome this limitation of CP/M and to enable the code to be compiled and linked, I am considering breaking the code up into a series of smaller programs and using data files to share variables between them; in fact this is the approach that I have taken with the C code, but not due to resource limitations, simply because it's easier to develop the code that way.

If you want to see a demo of the BASIC code in action, running on an IMSAI 8080esp (albeit, a slightly earlier version of the code), please watch these Youtube videos: https://youtu.be/GsTtD4rpM6E and https://youtu.be/U8yCnbcdOrg

The C code is almost the same, but with a few extra features, such as Speech Synth, Samples for WOPR voice, AI tic-tac-toe, customisable systems list for dialer with connectivity to external systems, and AI integration using Chat GPT. If you want to see a demo of the C code in action, please watch these Youtube videos: https://youtu.be/SULOI-x5fKs and https://youtu.be/ULw2MiVK-GE

Useful Links:

Update 25 June 2022: The plan is to re-write the WOPR (and other remote systems) code in C so that it can be easily compiled on various platforms. The intention is to make it client/server so that when the DIALER (running on the IMSAI 8080 or other CP/M machine) connects to a system, e.g. WOPR, Pan AM etc. these will actually be hosted on another machine, ideally Linux, each with a unique TCP listener port; assuming I can get BASIC-80 to open the uc1 port on the IMSAI 8080 so AT commands can be sent to the WiFi modem, but if not then Kermit is working fine.

Update 11 June 2023: I have started re-writing the Wargames programs for the various systems in C on Linux. The code is still a little untidy in places, but I will refine it as the project develops.

At the moment, the Wargames C code has the following features:

Still to do: Planned by Author 1) Add user function: create/edit/delete documents/text files. This should uitilise the data/wopr/usr/ and data/wopr/pub folder structure to store files and call nano as the editor. 2) Similar to above, but allow call to BASIC to create simple programs. 3) Directory Listing 4) Enhance functionality of Pan-AM system to include options to modify, delete records etc., and to cross reference flight schedules 5) Customised version of the IMSAI 8080 program which includes a telnet client and uses system calls to play the samples. The server could then be a separate Linux machine in a remote location. 6) Support multiple concurrent users / terminals connected to WOPR - possibly with multiple instances of IMSAI 8080 program using different TCP listener ports 7) Add another system for the "real" Protovision 8) Randomise / alternate connection speed and modem samples between 300 and 1200 baud for WOPR and indicate negitioated connection speed 9) Client only install (cool-retro-term, profile, script) 10) Stream audio for remote clients

Still to do: Requested 1) Subs and bombers on game scene, where David says blow them out of the water. Maybe those to start. [will investigate] 2) A rolling demo/screensaver that can change its path/outcome. [will investigate] 3) C: and D: drives for IMSAI 8080. [will investigate] 4) Add STATUS command to WOPR for sysadmins to show: Date, Time, Number of User Accounts, Defcon Status, Mail and Backdoor Status. [will investigate]

Requested: Deferred 1) allow users to run global thermonuclear war after login. [decided not to implement this as would require major re-sequencing in code] 2) maybe an area that shows war room current screen with stats or projections. [quite complicated to code this, and would probably work better with a dedicated display output on server]

If you want to try it out for yourself, here are the steps:

Pre-requisites:

Installation:

Running the Software (Local Mode):

Running the Software (Client/Server Mode):

NOTE: If you would prefer to have all the computer systems from the wargames movie running using unique TCP listeners, then:

OR: The computer systems can be started individually using the following:

Connecting using IMSAI8080esp:

WARNING: