AgoraOS: a Unix-like OS and a tiny 2003 internet, simulated inside Godot 4.7

AgoraOS is a Unix-like operating system written in GDScript and designed to be embedded in games. It isn’t a desktop mockup with scripted replies. It has a kernel, processes, pipes, a shell and a real network stack. The demo world is a small internet from an evening in October 2003.

The system

  • Kernel: a virtual file system with users, permissions and symlinks; /proc, /dev and /sys; processes with signals, ttys and setuid. Everything is a file. Even programs in /bin can be copied, renamed or chmod-ed.
  • Processes are coroutines. A blocking read just awaits, and pipes behave like real ones, so yes | head stops on SIGPIPE. There are no threads, and long loops yield to the engine, so the game never freezes.
  • Shell: a recursive-descent sh with pipelines, if/while/for/case, functions, $(...), arithmetic, globs and history.
  • Init: pid 1 is swappable between systemd (units, journal) and sysvinit (inittab, rc scripts). If init dies, the kernel panics.
  • 80+ programs that match the Debian tools of the era in output and exit codes. A package manager, apkg, fetches packages from mirrors over HTTP or FTP.
  • GUI: an X11-style display server, a window manager and apps: a terminal, a file manager, the Kestrel web browser with its own HTML layout and GIF decoder, a mail client, an ICQ-style messenger and an IRC client.

The network

Nothing touches the real network. Machines find each other only by addresses and ports, through cables.

  • Ethernet and ARP with Linux neighbour states, IPv4 forwarding, ICMP, UDP, and TCP with sequence numbers, retransmission and Nagle.
  • netfilter with conntrack, NAT and iptables; DHCP, DNS (dnsmasq, dig, host) and tcpdump with pcap-style filters.
  • Physical layer: cables have length and timing, and a bad crimp causes bit errors that show up as CRC errors in ip -s link. Links negotiate speed and duplex and can mismatch. There are hubs with CSMA/CD and even 10BASE2 thin coax, where a missing terminator takes down the whole bus.

Boot and hardware

Every machine boots for real: an Award-style BIOS with POST and Setup, GRUB 0.97 with menu.lst, the kernel, init and a login prompt. The first time, you install the system from a CD with a text-mode installer.

In the 3D view the hardware sits on a desk and is live. LEDs follow traffic and disk activity, and the monitor shows the real screen. You can open the case, move the clear-CMOS jumper, pull the battery, or crimp your own cables from a cable box and check them with a tester.

The hardware side is still a work in progress. Today it mostly covers cables, network cards, disks and the firmware, and it doesn’t yet shape the OS as much as I have planned. The goal is for the parts inside the case to matter to the system as much as the cables already matter to the network.

The world

The world has an ISP called LanLink, with DHCP and DNS, and servers hosting sites of the era: the provider’s portal, a teenager’s homepage with <blink> and a webring, a Linux user group, a geek news site, an e-zine and a demoscene site with anonymous FTP. Ferret is a search engine whose crawler actually walks those sites over HTTP. The world also has a mail server, the Ping! messenger network, and IRC with bots.

Under the hood

The kernel is plain GDScript with no nodes, so it runs headless. The desktop is just one front end, and there’s also a console REPL. Adding a machine to your game:

var m := AgoraMachine.create("server", {
	"profile": "server", "root_password": "toor",
	"network": {"eth0": {"method": "static", "address": "10.0.0.7", "netmask": "255.255.255.0"}},
})

Worlds are .tres resources. A save stores disks, CMOS and clocks, and machines boot back up from their own /etc, like real ones after a power cut.

NConsole, the 8-bit console I posted earlier, started as a spin-off of this project. This is the “larger project” it came from.

Repository (MIT license): GitHub - uxerror/AgoraOS

The world already supports homes for several players on the same provider, each with their own PC, router and mailbox. Multiplayer is next, so this little internet can come alive. I’d love feedback, especially from people who ran networks or Linux boxes in the early 2000s: what would you want to see in a world like this?

2 Likes