处理虚幻引擎生成的gzip压缩内容 [英] Handle gziped content generated by Unreal

查看:135
本文介绍了处理虚幻引擎生成的gzip压缩内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚打包了一个用虚幻引擎4制作的HTML5游戏.我获得了一些gzip压缩文件,需要上传这些文件才能在我的网站上正常工作,以便我可以测试该项目. 事实是,我对这种类型的内容不熟悉.我搜索了引擎文档,但没有找到有关如何在网站上上传和使用文件的任何信息.

I just finished to pack a game made in Unreal4 for HTML5. I obtained several gziped files that I need to upload to make it work on my website so I can test the project. The thing is, I'm new with this type of content. I've searched through the engine documentation but didn't found nothing about how to upload and use the files on a website.

有人可以阅读任何技巧或任何材料以开始实施吗?

Does anyone have any tip or any kind of material that I can read about it to start the implementation?

预先感谢您的帮助.

引擎生成的文件:

*****更新08/10/2017 *****

***** UPDATE 08/10/2017 *****

因此,我正在使用CloudFront在Amazon S3上实现此功能,这是我发现要使其正常运行所必需的:

So, I'm implementing this on Amazon S3 with CloudFront and this is what I found out that is needed to make it work:

1-如果要使用Amazon S3,则必须重命名所有生成的gzip文件.您需要做的是删除名称的"gz"部分.

1 - All the gziped files generated must be renamed if you're going to use Amazon S3. What you need to do is remove the "gz" part of the name.

2-在虚幻引擎生成的.html文件中,有一行显示:

2 - In the .html file generated by Unreal, there's a line that says:

return serveGzipped ? (name + 'gz') : name;

必须编辑为:

return serveGzipped ? (name) : name;

3-将.html文件重命名为index.html或创建一个新的index.html文件,该文件重定向到Unreal生成的.html.

3 - Rename the .html file to index.html or create a new index.html file that redirects to the .html generated by Unreal.

4-将所有文件作为静态网站上传到Amazon后,您需要打开包含文件的Amazon S3文件夹(在Amazon上称为Bucket),并将此信息添加到每个gziped文件的元数据中:

4 - After you upload all your files to Amazon as a Static Website, you'll need to open your Amazon S3 folder that contains the files (it's called Bucket on Amazon) and add this information to the metadata of each gziped file:

'content-encoding'  :  'gzip'

这将使Amazon S3在需要时识别文件已压缩.

This will make Amazon S3 recognize the file is gziped when needed.

5-授予对所有文件的读取操作的公共访问权限.

5 - Grant public access for reading operations to all the files.

6-授予对读取操作的公共访问权限,并为存储桶列出对象".另外,为存储桶实施以下策略:

6 - Grant public access for reading operations and to "list objects" for the bucket. Also, implement this policy for the bucket:

"Sid": "PublicReadForGetBucketObjects",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",

所有这些步骤将使Amazon识别gzip解压缩的文件并在需要时提供这些文件.这也解决了错误403和404的问题.

All these steps will make Amazon recognize gziped files and serve them when needed. This also solve the problems with error 403 and 404.

但是,尽管如此,我仍然面临着这个错误:

But still, after all this, I'm facing this error:

当我为Unreal使用新的Wasm文件生成时,会发生这种情况.

This happens when I use the new Wasm file generation for Unreal.

如果我使用旧版的Asm文件,则不会收到任何错误消息,但屏幕会保持黑色:

If I use the old Asm file generation, I receive no error message, but the screen keeps black:

有人知道如何解决这些问题(wasm克隆错误或asm黑屏)吗?

Does anyone knows how to solve any of these issues (the wasm clone error or the asm black screen)?

推荐答案

我假设您已经打包了这样的内容(来自

I'll assume you have packaged something like this (from UE4 AnswerHub):

首先,打包了一个"Readme.txt"文件,您应该进行阅读以了解如何将文件部署到Web服务器.

First of all, there is a "Readme.txt" file packaged, you should read-it to understand how your files can be deployed to a web-server.

基本上,您要做的是:

  1. 您需要适当地访问需要配置的Web服务器的文件夹
  1. You need to have appropriate access a folder of a Web server, that need to be configured
  1. 使用基本的"index.html"测试该部分是否正常工作

  • 将所有打包文件复制到此文件夹中

  • Copy all the packaged files into this folder

    1. 您可以将"XX-HTML5-Shipping.html"文件重命名为"index.html",
    2. 或创建具有HTTP重定向到原始文件名的"index.html"(便于更新后者)

  • 尤其是,有一个为Apache2 Web服务器制作的".htaccess"文件

  • In particular, there is a ".htaccess" file made for the Apache2 web server

    1. 您可能需要配置服务器的"http.conf"文件以授权".htaccess"覆盖
    2. 您可能需要对其进行编辑以添加"gz"文件的配置:

  • <files *.gz> AddType "text/javascript" .gz AddEncoding gzip .gz </files>

    <files *.gz> AddType "text/javascript" .gz AddEncoding gzip .gz </files>

    如果您有任何问题,请告诉我.

    Let me know if you have some any problem following this.

    这篇关于处理虚幻引擎生成的gzip压缩内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆