Stormworks: Build and Rescue

Stormworks: Build and Rescue

Not enough ratings
Pony Net (Supporting Pony OS)
   
Award
Favorite
Favorited
Unfavorite
Tags: v1.1.12
File Size
Posted
Updated
7.402 MB
25 Jul, 2020 @ 2:41am
13 Mar, 2021 @ 7:15am
3 Change Notes ( view )

Subscribe to download
Pony Net (Supporting Pony OS)

In 1 collection by CrazyFluffyPony
Pony Net
3 items
Description
Special thanks to "Daddy Daddy Do!"
He was interested in the project, and has fixed some bugs (see latest update).

Content
Pony Net
  1. How packets work (ports, MAC)
  2. Switches
  3. IPs and nets
  4. Routers
  5. Ports
  6. Cellular network
  7. Multiplayer warnings

Pony OS

Pony OS
You can create your own apps for Pony OS.
Please look at the description over here


Pony Net
Pony Net is the system that allows communication between multiple devices.
It is based on the IPv4 internet we all know or use. Some parts are a little bit different though.


EACH INDIVIDUAL PART OF THE SYSTEM INCLDUING A MANUAL WILL BE UPLOADED SOON

How packets work
A packet is a complete composite signal, for one tick. So one package includes 32 numbers (the 32 booleans are ignored).
A packet contains information about the source of the packet (sender) and the destination (receiver). This information is called MAC adress.
It must be a unique identifier and can range from 1-65535. Only 1-65534 can be used by devices, 65535 is a special adress which means "broadcast to everyone in the network". -1 is also a special adress, it means "switch please look up the MAC for a specified IP" (more about that later). the MAC adress 65534 is used by the network testing device, you better do not use that MAC.

IMPORTANT NOTE: because of multiplayer sync, you are ONLY allowed to use MACs between 1-255 for devices!!!

Composite channel
32
sender MAC (source)
31
receiver MAC (destination)
1-30
data

Switches
Switches exchange data between multiple devices. Pony Net offers a 4 connection switch and a 5 connection switch. They behave exactly the same: to every connection you connect one device (a host, a switch or a router).
The switch contains one lua script for every connection (queues up incoming packets at the input) and a master script that controls which packets to pop from which queue and to which output it should be sent.
The master script keeps track of which devices are connected on which connection. All devices broadcats an empty packet from time to time, so those tables have up to date information on connected devices.
Switches can be chained, but please make sure you do not create a round about!

A switch will also function as an ARP table (in real life this is not the job of a switch). He is able to translate IPs into MACs. This is necessary when transfering packets between different networks (more on that later).

IPs and nets
An IP adress identifies a device (similar to a MAC) but it also identified a network. This allows to split up the internet into many seperated networks. Communication inside networks can happen without blocking bandwith for devices of a different network.
If you send a packet to a device in the same network, it will travel to the next switch and then to destination device. If the destination device is in a different network, you have to first send the packet to the "gateway" (=router) of your network, this happens by choosing the gateways MAC as receiver MAC. This gateway then forwards the packet to the destination network via routers (currently Pony Net only supports static routing). Once it reaches its final destination router, this one will replace the receiver MAC with -1 and forward it to the local switch. This switch has the ARP table and can replace the -1 with the MAC of the destination IP.

IP adresses are made of 3 bytes:
the first 2 bytes is the network adress (e.g. 1.2) the third byte is the host adress (e.g. 230).
Network adresses range from 0.1 to 255.255, host adresses range from 1 to 254. 255 is a special IP, it means broadcast to the full network (a router will replace the receiver MAC with a 65535 = broadcast MAC).
This means you can have a maximum of 65534 networks, and a maximum of 254 devices per network.

If the receiver IP is 0, the packet will be dropped by routers.

Composite channel
32
sender MAC (source)
31
receiver MAC (destination)
30
sender IP (source)
29
receiver IP (destination)
28
port (which app should receive the data)
1-30
data


Routers
Routers connect/split networks. Once they receiver a packet, they check if the receiver IP is in a different network. If that is the case, and the router knows a route to that network, he will send it to the connection that has that route, otherwise it drops the packet. They work the same as switches in terms of queuing incoming packets and controling outgoing packets.

Ports
A port defines more or less an application that you want to receive the packet. An application can be a system application (e.g. DHCP) or your own application (e.g. chat system).
The network manager of PonyOS filters incoming packets and forwards them to the apps, depending on the ports (more on that later).

Used ports:
  • 999 (network testing device)
  • 888 (cellular network)
  • 67 (DHCP)
  • 53 (reserved for DNS)




Cellular Network
A cellular network is replacing the cable connection between a device and a switch with radio antennas. Every base station has sends on the same frequency. A receiver cecks that frequency and will get the configuration for that base station. The configuration includes 3 frequencies: reqgister, uplink, downlink. These frequencies should be different for every base station. Once the receiver notices that he connected to a new base station, he will register himself in the cell. Multiple receivers can be connected to a single cell, the cell will tell the receivers when they are allowed to send packets via the uplink. The downlink is sent to all receivers and they need to filter the packets for ones that are meant to be received by them.

Downlink & Uplink Composite
Composite channel
32
sender MAC (source)
31
receiver MAC (destination)
30
sender IP (source)
29
receiver IP (destination)
28
port (which app should receive the data)
1-30
data

Info Composite
Composite channel
1
mac adress who should send now
2
cell id of base station
3
register frequency of base stations


Multiplayer warnings
The packets themselves work fine in multiplayer.
Configurations are also multiplayer proof.
When a new player joins a server, it will take a couple of seconds until "his internet" synchronized the configuration for switches, celullar etc.

Desync can still happen because of Pony OS (more on that later).
26 Comments
CrazyFluffyPony  [author] 8 Sep, 2023 @ 12:50pm 
You can create a network with world wide coverage if you want. All the required devices are prepared.
пися 6 Sep, 2023 @ 12:09pm 
Sorry for stupid question, is it internet with full map coverage, or simply lan and networks implementation example?
C-Corgi 3 Apr, 2022 @ 8:35am 
ok thanks
CrazyFluffyPony  [author] 3 Apr, 2022 @ 4:35am 
@SCP-173

Globally:
info frequency = 5000

And then for every cell (cellID starts at 1):
registration frequency = 5000 + cellID * 3
downlink frequency = 5001 + cellID * 3
uplink frequency = 5002 + cellID * 3






Example with one cell:
5000, 5003 - 5005

Example with two cells
5000, 5003 - 5008
C-Corgi 2 Apr, 2022 @ 9:40pm 
what radio channel do you use
CrazyFluffyPony  [author] 9 Mar, 2021 @ 10:48am 
"Local" just uses the ip network the computer is in (e.g. if the computer has the ip address 12.0.1 then it will broadcast the chat messags to all computers in the net 12.0.0).

If you want to chat with the computer of a different net, enter the net ip of that computer (e.g. if the other computer has the up 13.0.1, then you have to insert 13.0.0)
CrazyFluffyPony  [author] 4 Feb, 2021 @ 8:52am 
Hey, i am not playing the game anymore. But i might be able to help you. Just send me a private message on discord, that'll make it easier.
CrazyFluffyPony#0587
Kito 4 Feb, 2021 @ 3:45am 
hello, i am currently working on an communication system with your pony net but it seems that i need some help setting servers up, can you help?
CrazyFluffyPony  [author] 29 Nov, 2020 @ 12:37pm 
Take a look at the PC microcontroller. One of the lua scripts is the messaging app.
It takes the text, splits it up in characters and then sends 26 (or 25 or so?) characters per packet.
The same lua script (but running on other pcs) will receive those packets, and build the original string again.
Rad. Ballbearing 29 Nov, 2020 @ 1:52am 
Sorry for mistakes