PocketMine-MP icon indicating copy to clipboard operation
PocketMine-MP copied to clipboard

Implement client-side support of downloading RP from CDN

Open alvin0319 opened this issue 9 months ago • 5 comments

Introduction

Implement client-side support of downloading Resource Pack from CDN.

Relevant issues

  • Alternative way to fix #3127

Changes

API changes

  • Added ResourcePackManager::getPackURLs(): Returns a map of uuid_version => cdn url

Behavioural changes

The server does not send ResourcePackChunkDataPacket since the client downloads the resource pack from CDN.

Backwards compatibility

There are no known BC breaking changes.

Follow-up

Tests

Test CDN server used with this test: https://github.com/alvin-pm-pl/ResourcePackCDN

Test Pack used with this test: https://mcpedl.com/legendary-bedrock-rtx-texture-pack/

https://github.com/pmmp/PocketMine-MP/assets/32565818/34a0fe98-a6e2-47d1-ae16-5d85fa14eabe

alvin0319 avatar Sep 21 '23 15:09 alvin0319

«However, the resource packs still need to be loaded into PocketMine.»

It should automatically download the pack from the url and cache the metadata, shouldn’t it? Like, why do users need to put it manually when PM can automatize the job

BrandPVP avatar Oct 02 '23 21:10 BrandPVP

«However, the resource packs still need to be loaded into PocketMine.»

It should automatically download the pack from the url and cache the metadata, shouldn’t it? Like, why do users need to put it manually when PM can automatize the job

I don't think it should be a PM's job. We should consider a offline environment.

alvin0319 avatar Oct 02 '23 21:10 alvin0319

In fact, I'm going back on my opinion because I hadn't realized the problem that has just been raised. Although you need to be in an offline environment, it can be interesting to enable automation.

ShockedPlot7560 avatar Oct 03 '23 10:10 ShockedPlot7560

Well, the problem is that:

  1. We can't download the resource packs from CDN every time we turn on the server.
  2. If we cache the downloaded resource pack, we have no way to detect whether resource pack content changed unless CDN provides a checksum or sha1 hash of the file.

The reason for requiring Resource Packs to be loaded into PM is that the client also expects info of remote resource packs in ResourcePacksInfoPacket. (after that, this isn't necessary since they download from external)

As an alternative way, we could let users write the UUID and version of the resource pack and optionally content key (which is the least information the client expects) in resource_packs.yml so that we don't let users load the resource pack into PM.

alvin0319 avatar Oct 03 '23 11:10 alvin0319

General sentiment in the dev community so far is that this feature is pretty useless for anyone who doesn't have a perfect connection (i.e. anywhere that isn't the US or Europe).

dktapps avatar Oct 05 '23 21:10 dktapps