Jump to content

File Compression


Vitaum

Recommended Posts

Hello, I need an explanation regarding compression of my server resources so that the client can download faster.
I looked around and the MTA has HTTP DOWNLOAD feature, but I don't understand how it works right.
I also read that the MTA reads files that are compressed in .ZIP, but I don't know if it is to compress only the folder that has the files or can compress subfolders as well.
About this external web server, how does it work? Do I need to upload my mods to external web too? Need to be compressed as .zip?
I would like to speed up the download of my players.
Could someone explain to me right what I have to do and how does HTTP DOWNLOAD really work?

 

Spoiler

Configuring an external web server

The built-in web server is also used to serve files that are required by resources running on your server to any player that is connected to your server. For example, if you are running a game script with a scripted graphical user interface, or custom models, these need to be transferred to every connected player in order to function properly. This is done by either the built-in web server, or an external web server (that is usually a bit faster) but needs to be set up separately.

For performance or consistency reasons during the game, you could choose to make use of such an external web server if you have one set up. The external web server needs to be accessible for the public, so any client will be able to download the necessary client-side files in order to join and play on your server.

To enable downloading off an external web server, you should configure the httpdownloadurl tag in your server configuration:


	
<httpdownloadurl>http://www.myserver.tld/directory/here</httpdownloadurl>

When you launch the server, the directory <SERVER>/mods/deathmatch/resource-cache/http-client-files will contain the correct client files for hosting on an external web server. If the web server is on the same machine, you can simply link the appropriate web server directory to http-client-files. If the web server is on a separate machine, ensure it has access to http-client-files via a network path, or maintain a remote copy using synchronization software.

Note 1: Please try to avoid any special characters (e.g. ~, !) in your download URLs.
Note 2: Please do not use a trailing slash in your download URL (e.g. http://www.myserver.tld/directory rather than http://www.myserver.tld/directory/)
Note 3: The web server must use 'ContentType: application/octet-stream' for Lua files. Most web servers will do this by default, or you can add the following line to the .htaccess file:


AddType application/octet-stream .Lua

Instructions on how to install and configure Nginx as an external web server for MTA is here: Installing and Configuring Nginx as an External Web Server

 

Edited by Vitaum
Link to comment
  • MTA Anti-Cheat Team

Unfortunately, resources being compressed (.zip or .rar) won't affect the total size players will download. The server will extract resources to then place it in the cache and send it.

The possibility of using archived resources besides folders exists for other reasons, not to decrease download size. There are other possibilities for that, like optimizing textures, images, sound files, and mods (custom models).

@Vitaum

Link to comment
8 hours ago, Dutchman101 said:

Unfortunately, resources being compressed (.zip or .rar) won't affect the total size players will download. The server will extract resources to then place it in the cache and send it.

The possibility of using archived resources besides folders exists for other reasons, not to decrease download size. There are other possibilities for that, like optimizing textures, images, sound files, and mods (custom models).

@Vitaum

how do i speed up the download of the players?
This optimization that you commented, how would you have to do?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...