Stormworks: Build and Rescue

Stormworks: Build and Rescue

136 ratings
The StormNet: The Internet of Stormworks
6
3
5
2
2
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
175.440 KB
5 Jan, 2023 @ 9:53am
12 Jan, 2023 @ 9:21am
20 Change Notes ( view )

Subscribe to download
The StormNet: The Internet of Stormworks

Description
Discord Nickname: "human41k"

!!!!! I have added image sending sample, check it right now! Scroll to the end to know more


The StormNet is system of data transfering between different vehicles. What can it do? It can parse any data to composite and send it by radio.
Why not to use common composites without any difficult algorithms? With the common composite you can send only
numbers and booleans (on/off values) in the limited amount.

Shortly about the Stormnet:
- Available data types: everything can be encoded to byte array
- Data transfer type: composite's number channels (1-32)
- Data transfer speed: 5400 bytes per second (on 60 TPS)
- Data max size: INFINITY
- Any glitches or mods used: no
- What do i need to install the Stormnet on my vehicle: to use the example version with text message sending, you can just copy microcontrollers from the vehicle and connect it. Nothing more.
- How to use the example: spawn twice this vehicle (should be in 2km range due to antennas maximum range), on first vehicle set any two free frequencies on keyboard, on the second set the same frequencies in reverse (1st veh. receive = 2nd veh. send). Write some text on keyboard and press 'snd' key.
- Can I use this on my vehicles: sure, it would be nice if you would mention me in the description of your craft. Don't be greedy, if somebody asks you who made this don't lie, just send them link to this page. (*^w^)
- The example is very simple, why do you call it Stormnet, like the internet?: Because my system can not only send small text messages, but it can send both 1) Any size messages 2) Any type messages (not only text)

In the example there is system sending short text messages. In the microcontrollers there are lua blocks. I hope the code in these blocks is well documented and described, using the functionality of the functions, you can send any data you want. You only need to encode your data to bytes in one side, and then decode bytes back to your data on another
side of connection.
Documentation and transfer protocol.
Further reading is required only if you want to know how does it work and improve it, or use it not only to send text.
The main task of this project is to transfer any data through the composite. So to do this you need effective multytick system that will work in digital mode. The composite contains such information:
1 number channel: this package index (0 when not sending, 1 - first package, 2 - second and so on)
2 number channel: this package size in bytes (in one number there can be fit up to 4 bytes of information, but the number type of stormworks is float 32, 24 bits are used for mantissa, and other are used for power and sign, the system can be improved to work with power and sign to, so you can fit 4 bytes into the one number, but in my opinion it is redundant, so i use only 3 bytes of mantissa). So this can contain number from 1 to 90. (and therefore transfer speed can be extra accelerated). As you see one package can contain up to 90 bytes of data, and one package can be sent per tick.
3-32 number channels: contain encoded data.
Now the main problem is to encode bytes into numbers and that's how i do it:
I encode 3 bytes into each number. The encoded number is firstByte*256^0+secondByte*256^1+thirdByte*256^2
This feature is implemented in send microcontroller in function bytesToNum(bytes). It encodes first BYTECOUNT bytes into the number, removing it from bytes array and returning encoded number
So to send some piece of data I can use sendPackage(bytes) function. It encodes first 30*BYTECOUNT bytes and sends it to the output channels. It uses described algorithm (1n.c. package index, 2n.c. package size, other channels - data).
But to send data amount larger than 30*BYTECOUNT bytes, you have to use more than 1 package. To do it you have to send packages some ticks in a row. To do it i implemented two functions: sendPackages() and startSendingData(data). sendPackages() function should be runned each tick. It splits data to packages and sends them one per tick. startSendingData(data) function should be runned ONCE to add data to queue. If sendPackages() function is being runned every tick, then after running startSendingData(data) the data will be sent soon automatically.
To encode text (strings) to bytes you can use my implementation encodeString(str) or write your own encoding algorithm. (I reccomend when sending datatypes with variable length write it on the first n bytes of encoded data, so when you decode these data you will know where this data piece ends and when the next value is starting).
Keyboard: keyboard is very simple and it can be extended, i won't describe how it works, it's not important in this context.
Receiving and decoding data.
First to do is find out how to decode number back to bytes. It looks simple but it isn't so. At least to decode number you gotta know not only the number, but the count of bytes it contain. (f.e. number 1 can contain either three variants of bytes: {01}, {01 00}, {01 00 00}, if we know that this number should contain 2 bytes, then we choose {01 00} variant). You can use implemented function numToBytes(number, bytes, explen) to do it, it uses symple algorithm or write your own function.
Next you should correctly receive the package from composite channel. It is very simple without any specific algorithms, and it's commented in code.
Now you have raw bytes array can be easily decoded. For text decoding you can use unparseString(bytes) function
or write your own decoding algorithm. NOTE: when not all string is receiving and data is still sending, the algorithm will add '#' symbol at the end of decoded string. (You can easily modify it and know where is data complete or not yet). Anyway i reccomend to wait until the package with 0 index is received (it means that transfer is finished, so data is complete).
Some recomendations when encoding and decoding data:
As i have already mentioned you should store variable length datatypes lengths to their bytes representations and use them to read instead of ALL received data length. Also I reccomend to make another function to decode whole data and some small functions that decode different datatypes (may be later i will add common implementations to this page). In the main decoding function you can copy data value to another array (to not lose this data) and then invoke other functions in the row they have been encoded (the same stuff i suggest to do when encoding). This way functions can remove used bytes from data array (so when the first function reads all bytes it needs, it removes it and then other functions can decode their data).
Howbeit how to encode and decode data is only your choise. My job is to invent the transfering protocol and describe it. Thanks for reading. <3


-Stepan Byhovtsov AKA human41k, 2023.
To contact me please join discord server https://discord.gg/gsx5KUhY (no auth needed) and ask in 'общение' channel for help (desirable on russian, no matter, my nickname on this server is 'Стёпа').
00 0F 68 61 70 70 79 20 6E 65 77 20 79 65 61 72 21 and welcome to the Network, Stormworkers!
64 Comments
Timon.Pokemon 8 Nov, 2023 @ 11:20am 
Лучшая постройка из всех что я видел.
MauseLoch9000 28 May, 2023 @ 5:04pm 
This is very cool. But the title is misleading. This is not really some sort of internet. It is a very efficient way of wireless data transfer between 2 antennas. If this was like the internet you wouldnt need to be in the range of your target, but instead could access DNS-Servers and send requests to connect to an IP-Adress (target) using a network of infrastructure placed across the map or a part of it.. Im currently finishing my work on exaclty that and it annoys me a bit that you already took the title "The Internet of Stormworks", but still, I like this creation very much! It can be very useful for many things.
UnKnow Member 28 May, 2023 @ 12:28pm 
okay, thanks :D
АНАЛЬНАЯ МУХОЛОВКА  [author] 28 May, 2023 @ 11:56am 
Use it as you wish, i am not currently developing stormnet, so it would be great if you will use my project.
UnKnow Member 28 May, 2023 @ 9:21am 
Hello! I am doing a project with the "StormNet" workshop item that you have made, my project is a fiber optic network chain, and it is very good for my microcontroler project that you have made. so if you assign the stromnet microcontroler to me, you will make a great contribution to my project. If you want details we can help you. thanks in advance :D
PapaPoilQc 15 Apr, 2023 @ 7:57am 
this is pure genius
firemint338 4 Mar, 2023 @ 7:33am 
uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuh
HLEB 20 Feb, 2023 @ 9:13am 
20 обновлений, интересно что за это время изменилось
АНАЛЬНАЯ МУХОЛОВКА  [author] 26 Jan, 2023 @ 11:08pm 
Отправил, вероятно ссылка на дс устарела. Если что я пулежорка