So, the site has a wonderful network. But in it, only a couple of lines are devoted to starting and configuring the server.
I will try to help users who would like to play on their local server with friends and with your own settings. In this short article, I will try to show the whole process: from installing the server to configuring it, including using mods.

1. The first thing we need is to switch to running Rust over the network and download archive containing all necessary tools, and unzip to any location.

2. Now let's move on to installation. Run the file Update-Rust-Server.bat from a folder SteamCMD and wait while our server is downloading. The servers will be loaded into the RustServer folder.

Everything, we have installed the server, proceed to the next steps.

3. Now we will start the server, customize it and invite friends. In order to connect to the created server, perform the following steps:

I go to the folder SteamCMD and run the file Run-Rust-Server.bat(It is him, not Rust_server). To start the experimental Rust server, run the file Run-Rust-Exp-Server.bat
- After starting, the command line will contain lines with information about the download, we are waiting for the moment when the inscription appears "server initialized".
- Everything, the server works.
- Now, in order to enter the server, we need to find out the address of our server. Classic version -
- Write down your ip somewhere in text file(not to forget).
- Next, start the game and press the F1 key (console) and enter the net.connect command there. Your ip: 28015 (where Your ip is your ip, which you learned in advance). In theory, it should also be 127.0.0.1.

If everything is done correctly, you will connect to your server. In order for friends to be able to connect to you, it is of course necessary that the server is running on your computer, and that your friends correctly enter the connection command that you tell them.
Now you can start playing. BUT! The correct execution of all actions in some cases cannot guarantee you success. Since there are a lot of reasons why you might not succeed. The solution to the most common problems is written in.

4. Well, now, if everything worked out for you, and you liked it, you can play around with server settings.
For example, in latest update developers added this interesting thing how the wear and tear of weapons (I immediately remembered a series dead island), as well as wear and tear of clothing and equipment.
This did not suit many, and here is the opportunity to disable this feature.

For this you need:
> Log in to the server with admin rights. To do this, open the console in the game with the F1 key and enter the command Rcon.login your password (your password is set in the server.cfg file and by default it looks like 123456). After entering, an inscription should appear (in the console) "logged as admin", which means you are logged in as an admin. Now enter the commands:
- To disable clothing wear: conditionloss.armorhealthmult "0.0"
- To disable weapon/inventory wear: conditionloss.damagemultiplier "0.0"

With the help of various mods, you can also disable or enable different things. For example, disable disintegration on the server or adjust the flight interval for airplanes. The network already has both affordable and not very affordable mods. I recommend using a free mod magma, due to its ease of customization and a large number of plugins.

Rust's game optimization is simply "worthless", which creates some difficulties during gameplay for some users. In some cases even powerful computer unable to cope with their direct duties, namely to provide an excellent picture without lags in the “rust” interface. Of course, thanks to some manipulations, you can slightly increase the fps in the game, but this is best done by entering various kinds of commands into the console line that disable specific effects. But how do you imagine it? Every time you connect to the server, enter about 30 commands into the console - this is how much time will be wasted ... But there is a way out and this is the config file for Rust, into which you can enter all these commands, and just put it in a special directory.

But where can I get this cfg for Rust? Actually there are two ways to get it. You can do the following...

Creating a config for the game Rust

1. Go to the root directory of the game.
2. Find the CFG folder there.
3. Find two files in it: client.cfg and config.cfg.
4. If there are none, then you just need to create new ones and name them accordingly.
5. Enter here the appropriate commands for , shadows, wind, and so on.

And you can do it differently.

Download cfg for the game

1. You can download the config for Rust already in finished form (with all the necessary commands) directly from our website, here.
2. Copy the two files in the archive to the appropriate directory (specified in the first method).
3. If these files are already there, then copy with replacement, if not, then just paste.

Basically, it doesn't matter which way you go. After that, only:

Login to the game
Click on the "Options" tab
Uncheck "Water Reflectins" and "VSync"
And pull the "Render Quality" slider all the way to the left

It should be noted that the Rust config is very positively affected, you can even say that the Rust config (of course, correctly configured) will bring much more benefit than the additional 512 MB of video memory.

In the previous articles of the series, a general overview of the Rust programming language was made, the basics of syntax were discussed: the simplest components (variables, simple data types, operators and extensions), control constructs and compound data structures, functions and destructors were described. Particular attention was paid to the memory model in general, the concept of object ownership, general principles memory management, use of own and managed blocks shared memory, as well as borrowed pointers. This article discusses the input/output facilities of the Rust language.

In any programming language, the I/O subsystem is important integral part. Some of the simplest standard output facilities have already been used in previous articles ( print , println ). These functions are intuitive and do not cause any difficulties in the process of their application. Therefore, now we will focus mainly on the means of receiving data entered by the user and on the tools for working with files.

1. The std::io module

In Rust, all I/O facilities are collected in a module io.

The Reader and Writer traits define a minimum set of the most simple methods input and output. The ReaderUtil and WriterUtil traits offer a wider choice of methods that give the user more control over input and output. For example, Reader only allows you to read a given number of bytes into a buffer, while ReaderUtil offers methods for reading a whole line, multiple lines, numeric values, and so on. In addition, there is an implementation (implementation) of ReaderUtil for , which allows access to all Reader methods.

A trait describes a set of methods that can be applied to a specific type or to multiple types. Traits will be considered in more detail in the following articles of this series.

As mentioned above, the most commonly used print() and println() functions are also defined in the module io, but you don't need to explicitly import them in most cases, as the compilation and linking system has already taken care of that.

In addition, very useful features stdin() , stdout() , and stderr() , which return pointers to the three standard file descriptors: standard input, standard output, and standard error, respectively.

2. Receiving data from the user

In any case, the most in a simple way receiving data from the user is to use the stdin() function, which creates a pointer to the @Reader object, which allows you to read data from the standard input stream (similar functions exist for the standard output stream - stdout() , as well as for the standard error stream - stderr() ). Once the @Reader pointer has been created, you can use the read_line() function to read the user's input, as shown in Listing 1.

Listing 1. Reading user input
fn main() ( let stdin = std::io::stdin(); print("What's your name?"); let name_str = stdin.read_line(); println(fmt!("Nice to meet you, %s\ n", name_str)); )

In the ReaderUtil trait, in addition to simple functions reading bytes and single lines also defines a rich set of tools for reading data under various conditions: reading bytes until an end-of-file sign is encountered - read_until() , reading a string written in C-style (with a null terminating character) - read_c_str() , reading the entire data stream - read_whole_stream() , reading all lines from the data stream - read_lines() , as well as a large set of functions that allow you to read numeric values, both integer and floating point.

3. Reading data from a file

All the necessary tools for working with files are also located in the module std::io. First of all, you should pay attention to the following functions:

fn FILE_reader(f: *libc::FILE, cleanup: bool) -> @Reader fn FILE_writer(f: *libc::FILE, cleanup: bool) -> @Writer fn file_reader(path: &Path) -> Result<@Reader, ~str>fn file_writer(path: &Path, flags: &) -> Result<@Writer, ~str>fn mk_file_writer(path: &Path, flags: &) -> Result<@Writer, ~str>

The FILE_* options read and write C-style files, while the file_* options are meant to be used in the Rust style. Since the first two functions obviously play the role of auxiliary tools for specific tasks, and besides, it is the Rust language that is being considered, Rust-style should be preferred. Therefore, only the file_reader and file_writer functions will be considered further. Both functions take a file path of type ~str as their first parameter, and both return a value of type Result . Thus, in order to understand file I/O in Rust, you also need to properly understand and evaluate the Result type.

3.1. Return type Result

This type serves as a tool in Rust to avoid runtime errors. Result is an enum containing the following values ​​(see src/libstd/result.rs):

pub enum result ( Ok(T), /// contains the value on successful return from the function Err(U) /// contains the value on return error from the function )

Values ​​of the Result type must be unpacked (destructured) before they can be used.

The example program will use the following function from the module std::result :

fn unwrap (res: Result ) -> T

If the result is Ok(T) , then the function returns the value T , extracted from Ok(T) , which can be used further in the program.

Of course, with this function, the library toolkit std::result is not limited. Descriptions of other functions can be found in the above documentation.

3.2. Example of reading data from a file

The source code for the example is shown in Listing 2. The example simply reads bytes from the given file, then converts the read result to a string and performs a pattern match. It is assumed that the program itself and the test file read.txt, from which data is read, are located in the same directory.

Listing 2. Reading data from a file byte by byte.
use std::io::*; use std::vec::*; use std::path::*; fn is_success(fpath: &PosixPath) ( let maybe_test_reader: Result<@Reader, ~str>= file_reader(fpath); let test_reader: @Reader = std::result::unwrap(maybe_test_reader); let mut bytes: ~ = ~; loop ( let byte: int = test_reader.read_byte(); if test_reader.eof() ( break; ) append_one(bytes, byte as u8); ) let sample: ~str = ~"success"; let maybe_success: ~str = std::str::from_bytes(bytes); if maybe_success == sample ( println("The file read operation succeeded"); ) ) fn main() ( let fpath: ~PosixPath = ~PosixPath("./read.txt"); is_success(fpath); )

In the example above, the is_success() test function creates a test_reader object using the file path passed to it. For clarity, the contents of the file are read one byte at a time, and the read byte is added to the bytes vector. Bytes are read as integer values ​​of type int , but when the next byte is inserted into the vector, a value of type u8 is expected. Therefore, for each inserted byte, an explicit as u8 conversion is performed. These operations continue until the end of the file (end of file) is encountered when reading.

The reader.eof() method returns true when the currently read byte contains the eof attribute. In this case, the value of this byte is -1 (which is the reason why reader.read_byte() returns an int and not u8) and does not need to be added to the vector. The condition is checked, and if EOF is found, the loop exits.

The validation of the read result relies on the fact that the bytes read are ASCII values ​​(and therefore match the corresponding part of the UTF8 encoding), that is, the characters that make up the word "success".

3.3. Why not a while loop

When considering the code in Listing 2, a reasonable question may arise: why is the loop exited by checking for eof in the loop body, and not using the more common condition test before the next iteration? The reason is how reader.eof() works. When using a while loop with a check for eof in the conditional expression, an EOF byte with the value -1 (255u8) is added to the target vector. So when you use while, you have to "pop" the most recent value out of the vector, as shown in Listing 3.

Listing 3. Snippet of reading bytes using a while loop
let mut bytes: ~ = ~; while !reader.eof() ( std::vec::append_one(bytes, reader.read_byte() as u8); ) std::vec::pop(bytes);

Of course, such a data processing option has the right to exist.

Conclusion

In Rust, almost all I / O is concentrated in the module std::io. For each elementary data type, tools are provided for its reading and presentation during output. The main components of the module std::io are the traits Reader , Writer , ReaderUtil and WriterUtil , which provide all the necessary control over input and output.


In this thread, I'll show you how to create your own Rust server Experimental with mods. Why is it necessary? Well, at least if you play Rust, then you have a lot of ideas that are much more convenient to test on your own server with endless resources and the ability to fly. And if you go further, then you can make your server popular and get real money for selling game goodies to players on your server.

So let's get started.
Part one - Server creation.
1. Download the Rust_server.zip archive from the official website using this
2. Unzip the archive to a folder convenient for you. For example, this one: C:\Games\Rust_Server\Server
Further I will give examples of the address with this folder.
3. Go to the C:\Games\Rust_Server\Server folder and run the update.bat file
A black window with a command line will open and the server files will be downloaded in it, the size is about 2.15 GB. When the download is complete, the window will close automatically.
4. Go to the folder C:\Games\Rust_Server\Server\rustds
Create Text Document in notepad, copy this text inside:
RustDedicated.exe -batchmode -server.hostname "My Server" -server.port 28015 -server.identity Hello_World -server.maxplayers 5 -server.seed 777 -server.worldsize 4000 -chat.serverlog 1 -server.netlog 1 -server .saveinterval 300 -spawn.max_rate 1 -spawn.max_density 1
Next, in notepad, click "Save as ..." and save the file with the name "start server.bat" extension "All files".
The appeared file "start server.bat" is the start file for your server. When you click on it, a black window will open again. command line and the creation of the map and the launch of the server will go. You can find out that the server is ready to work by looking at the fps counter at the bottom right of the window: when loading it will show 0 fps, and after the end it will appear digital value, for example, I have 262 fps.
5. Next, you need to find out your external IP address.
Let's say you went to one of the services for determining the IP address, and your address turned out to be 213.180.193.11
Open Rust and press the F1 button, in the console that opens, enter the command client.connect 213.180.193.11:28015

If everything is done correctly, then the connection will go and you will find yourself on your own server

P.S.: The folder with your server files (save, etc.) will be located at C:\Games\Rust_Server\Server\rustds\server\Hello_World

Part two: admin

1. To make yourself (or a friend) an admin on your server, you first need to know your Steam ID. To do this, go to your steam profile and on any free space- for example, to the left of your avatar, click right click mouse and select "Copy page address". We paste this address anywhere, for example, in a notepad or in a browser. Something like )