Skip to main content

2023 Mar: File Transfer, Map Package!

Β· 12 min read
Gabriel T. Nardy

File Transfer, Map Package, Escape Menu and more!

Escape Menu Information​

The Escape menu in the game now displays server information such as name, description map, game mode, players connected, and a special area that can be customized with the new method Client.SetEscapeMenuText().

It supports using Rich Text tags such as <strong>, <h1>, <h2> and <h3> to format it!

<h1>Header 1!</>
<h2>Header 2!</>
<h3>Header 3!</>
<strong>Strong Text</>
Normal Text

New Package Type: Map​

A new package type, "map" has been introduced to completely replace all the old ways of loading Maps (and Maps Packages)! It is now a Package like any other, being able to contain scripts and run Lua code.

tip

Now the map asset path is configured inside it's Package.toml, so when this Map Package is loaded, it will load the Map asset it has configured inside!

Until now, Map Packages were configured by creating a new folder with the same name as the Map inside the Asset Pack, getting mixed with the other .uassets and cooked files, which was unsustainable and had several downsides.

With this new system, we will be able to make improvements to remove the need for the Server to have to download Asset Packs locally, because all Map Packages will no longer be contained inside the Assets!

As it is a Package just like any other, it can be uploaded to Vault as well, so all existing Maps can be selected in the New Game screen even if you don't have downloaded them! And you don't need to download them beforehand, as starting a server through New Game will automatically download all its dependencies!

Like the other Package Types, the Package.toml of a Map Package is slightly different, it contains the new properties: map_asset (the Asset in fact this Map is using), spawn_points (the list of spawn points) and custom_data section (generic data which can be accessed via Server.GetMapConfig()):

Package.toml
https://github.com/nanos-world/nanos-world-server/blob/main/_map.toml

Read more in Packages Guide page.

Vault Improvements​

The Vault tab in the menu has undergone several improvements!

New Tabs​

Now we got several tabs splitting each Package type and the Asset Packs, making it easier to navigate and search between different categories.

Also the category drop down filter is now only visible on Asset Packs tab.

Create Local Resources​

Now it's possible to create new local Asset Packs and Packages through the UI!

We added a button that opens a form to create the Resource!

In the future we will expand this feature to allow creating and uploading it to the Store as well! All through the UI!

Images Loading​

Now all Vault Images are loaded in a deferred way, avoiding some initial stutters when the Main Menu is loaded, as now the Header/Team images will be loaded on demand once they show up on screen, not to mention it is now much faster and more reliable.

Return Button​

The Return Button was moved from the bottom left to the top right, making it more intuitive to the overall UI usage:

New File Transfer System​

We had completely overhauled our File Transfer system! This new system is much more robust and aims to solve all problems we had with downloading files and loading screens before!

Sub Systems​

This new system works by splitting the work into three sub-systems/steps: Sockets, HTTP, and Vault Assets .zip.

Each sub-system/step has a different approach for downloading files and is aimed to a different occasion:

HTTP​

The HTTP File Transfer system is the most conventional way to send files through. The server starts a HTTP Server and the clients download the files through HTTP requests. It is outside the inline networking system and works in parallel.

This is really good for sending large files. But it does not work in P2P servers as usually the host doesn't have Ports Forwarded in the router, which is required for having the HTTP server public.

This system is used when the file is bigger than 512 KB, and the client only asks 16 files at a time to the server (values configurable through the Settings Advanced tab).

Sockets​

As HTTP requests require connecting to the server (establish connection, handshake, validation, etc) every time a file is requested, it adds a huge amount of time between each file download, which is bad if we have thousands of files. So for speeding up the whole download time, we also have the Sockets system.

The Sockets sub-system uses the inline networking system to send files, it is way faster as it appends all file data in the network wire and flushes all to the client. The downside is that the inline networking system is not aimed for sending files, as it bottlenecks the network and depending of the quality of the connection, many packet losses can happen, causing the whole transfer to become slow.

But this is really good for sending lots of small files, as it appends them all together in the wire and sends to the clients in a single stream.

This system is used in two cases: when the file is smaller than 512 KB (configurable through the Settings Advanced tab) or when the server is P2P.

info

P2P Servers use Steam Datagram Relay servers to handle the connections between players, without the need of them to forward ports in the router.

Because of that, all connection and networking transmission is made through Steam servers, which seems to have a hardcoded speed limitation of 1 MB/s, making the whole File Transfer system to be "hardcodedly" slow on P2P servers.

Vault Assets​

The last subsystem uses the Vault to download the required Asset Packs directly from our CDN servers, without needing to have them passing through the game server.

This is used when the server loads an Asset Pack which exists on Vault and is on the same version as it. Then the clients can download the Asset Pack directly from that instead from the Game Server!

Problems Fixed​

Besides all the reworked system, we had a special attention on the problems and errors that existed in the past and with that in mind we added several new layers of validations to make sure everything goes well. So if anything fails, or if it takes too much time to download a file, the player will be disconnected to prevent any further problem being caused by that.

Download Speed​

In the old system, we were only downloading 8 Socket files and 1 HTTP file at a time. But now we are downloading up to 128 Sockets files and 32 HTTP files! Because of that we got a huge boost on the download speed when connecting to servers!

tip

The following benchmark was made connecting to sandbox game-mode on the official server only using HTTP Transfer, for testing the HTTP File Transfer system only. As it is not making good use of Sockets optimizations, the real time may be way different.

FilesTimeBoost
102:35N/A
201:1898%
400:40287%
800:24545%
1600:19715%
3200:15903%

This table shows the amount of HTTP Files being downloaded simultaneously using the new File Transfer system and it's time (minutes) impact on final time taken to connect.

Server Async Handle​

Also, now the game server handles File Transfers asynchronously, meaning that every file transfer request is queued and handled from a separated thread, reducing stutters and high tick rates when players are joining the server.

Loading Screen Improvs​

The Loading Screen also passed through several improvements!

Detailed Progress​

Now it displays much more information regarding the download progress, including:

  • The total size being downloaded (summing all sub-systems, including Vault)
  • The current size already downloaded
  • The current download speed
  • The number of files being downloaded
  • The progress of the current step (downloading, installing...)

Server Startup Progress​

When starting a new game from the menu, now much more information about the local server is displayed, including progress when the server downloads Vault items!

It tells exactly each step and progress of the server initialization, giving a much better experience when starting games from the menu.

Also the whole New Game start-up process was improved by having better validations if something fails when starting a New Game!

Vehicle Unflipping System​

Unflipping rotated Vehicles is now more deterministic and with fewer physics bugs.

Now to unflip vehicles we must use the Steering input (e.g. A or S) to point to which side to rotate, instead of just accelerating as it was before.

Entity Network Size​

Further optimization has been made on the internal structure of entities that is sent through the network when syncing them with the clients. A great reduction was achieved by optimizing the usage of big structs such as Vectors and other numeric data that were unnecessarily large.

We got a reduction of up to 30% on their sizes!

EntityBeforeAfterReduction
Blueprint192 B136 B29.17%
Cable464 B312 B32.76%
Character392 B336 B14.29%
CharacterSimple416 B360 B13.46%
Light240 B184 B23.33%
Melee256 B184 B28.13%
Particle200 B144 B28.00%
Prop208 B152 B26.92%
StaticMesh192 B136 B29.17%
TextRender248 B192 B22.58%
Trigger240 B168 B30.00%
Vehicle360 B288 B20.00%
Weapon416 B312 B25.00%
note

Those are static sizes, but entities also have dynamic sizes such as strings and lists that increases the overall size of them dynamically!

Also, those values represent the network data being sent to clients when the entity is serialized, and not the memory usage.

Fixed Freezing Behavior​

The behavior of freezing when connecting to a server has been fixed! The "waiting" step has been moved to the end of the loading screen and now is handled asynchronously! This improves the usability in 1000x! πŸ₯³

Improvs & Bug Fixes​

The main menu has been updated with a new fade-in effect when showing up for the first time (game started of disconnecting from a server), which improves a lot the smoothness of its usage.

It's also worth mention we managed to fix several problems and crashes we were having in the main menu.

The User Experience is way smoother now!

Settings Tab: Advanced​

The game now has a new settings tab called "Advanced," where players can tweak File Transfer settings to help debugging problems.

Each setting has a special meaning that is explained when hovering them!

Melee Improvements​

The melee got significant improvements requested by the community (cof cof Timmy cof cof)!

Multiple Hits​

Melee now hits multiple actors per "action". This means that one slash will now be able to cut several enemies at once!

Attach Static Meshes​

Now the Melee makes use of the Attached Static Meshes when considering the collision primitives to calculate the damage! Contributing to the bounds of the hit detection!

Miscellaneous​

Other miscellaneous improvements.

Blueprint Parameters​

Additionally, the game now supports several new structs to be passed to Blueprints functions, including FQuat, FMargin, FVector4, nil.

And also it now supports passing the entities Canvas, WebUI, and SceneCapture, which are converted into Material Interface when received on Blueprints.

For the complete list, please check the Blueprint page.

--logo Command Line​

Now the server command line --logo downloads the URL in-memory to be displayed in the server list, it no longer downloads and overrides the Server.jpg file locally. Fixing problems when starting several servers with the same .exe.

File/Folders Casing​

Additionally, now creating the folders Server, Shared, Client or Index.lua with incorrect casing (lowercase, or all uppercase) will throw warnings.

This was a common problem we were experiencing when scripters were developing their packages on Windows, and then when trying to load it on Linux it was not working. We ended up figuring out that it was because of the case sensitivity of the files they created. As on Linux all files are case-sensitive.

Conclusion​

This last month as an awesome month for the overall stability of robustness of the nanos world "framework". Loading Screens, File Transfer System and Menus are way smoother now.

Those improvements and fixes make the game look much more professional. The problems we had with File Transfer that were very difficult to reproduce and we were only able to witness once we had big playtests were finally resolved!

The Map Package is another giant improvement! Although it's not a big deal in technical terms, this concludes several concerns we had to solve, as the need to download big unnecessarily assets on servers (soonβ„’), or the bad and ugly old map-package implementation we had, which caused a lot of bugs and problems.

I am always aiming at implementing at least one of the most voted and requests from our Feedback Hub. So please make sure you vote up or suggest what you want!

Thank you for another month! πŸ™πŸ™πŸ™