Ad-Hoc networks are useful when you just need a connection between a few machines with Wireless networking and no routers. It's an underused feature, but sometimes may be useful.
Setting up an Ad-Hoc network is pretty simple. In macOS, open the wireless panel in the menu bar and select "Create Network..."
After that, set your network name and choose any channel.
Your status bar should show this icon and you'll be connected to your Ad-Hoc network.
Let's also configure it in Ubuntu 18.04 using netplan and
/etc/netplan/20-adhoc.yaml: network: version: 2 renderer: networkd wifis: wlp5s0: access-points: "Ubuntu Machine": mode: adhoc password: password123
iw interface set type ibss ip link set interface up iw interface ibss join "Ubuntu Machine" 2442
In Windows 10, the command prompt has to be used to run the following commands:
netsh wlan set hostednetwork mode=allow ssid=Ahhh key=password123 netsh wlan start hostednetwork
From here on, you can connect other devices to the network the typical way.