Unity3D高级手册0800:Web播放器流

2014-09-11 22:26:24|?次阅读|上传:huigezrx【已有?条评论】发表评论

关键词:Unity3D, 游戏, 虚拟现实|来源:唯设编程网

使第一级是短的而不是使用大量的资产。这样,第一级可以加载迅速,并保持玩家播放了两分钟,你可以肯定,所有剩余资产可以在后台下载完成它。为什么没有一个小教程水平,用户可以了解游戏的控制?没有高清晰度的纹理在这里或物体负载,或有所有你在第一级的敌人的原因。使用最低的聚数之一。是的,这意味着你可能要设计时考虑到网站的玩家体验游戏。

  1. There is no reason why all music must be available when the game starts. Externalize the music and load it via the WWW class. Unity compresses audio with the high quality codec, Ogg Vorbis. However even when compressed, audio takes up a lot of space, and if you have to fit things into 3 MB, if you have 5 minutes of music all the compression in the world won't save you. Sacrifices are needed. Load a very short track that you can loop until more music has been downloaded. Only load more music when the player is hooked on the first level.

没有任何理由将所有的音乐必须是可用的当游戏启动时。外部化的音乐装载通过WWW类。Unit使用高质量的编解码器,Ogg Vorbis来压缩音频。然而即使当压缩时,音频占用很大的空间,如果你要适应3 MB的事情,如果你有5分钟的音乐都在世界上的压缩不会拯救你。牺牲是必要的。装载很短的磁道,你可以循环,直到更多的音乐已被下载。当播放器在第一级挂钩时才装载更多的音乐。

  1. Optimize your textures using their Import Settings. After you externalize music, textures easily take up 90% of the game. Typical texture sizes are too big for web deployment. In a small browser window, sometimes big textures don't even increase the visual fidelity at all. Make sure you use textures that are only as big as they must be (and be ready for more sacrifices here). Halving the texture resolution actually makes the texture size a quarter of what it was. And of course all textures should be DXT compressed.

优化你的纹理使用他们的导入设置。在具体化音乐之后,纹理很容易地利用了90%的游戏。典型的纹理尺寸过大对于web的部署。在一个小的浏览器窗口,大纹理有时甚至不增加视觉保真度的。请确保你使用大的纹理是他们必须的(并准备在这里更多的牺牲)。减半的纹理决议实际上使纹理尺寸的四分之一。当然,所有的纹理应DXT压缩。

  1. Generally reduce the size of your web players. There is a manual page committed to the utilities Unity offers for optimizing file size here. Although Unity uses cutting edge LZMA-based compression which usually compresses game data to anywhere from one half to a third of the uncompressed size, you'll need to try everything you can.

一般来说减少你的web播放器的大小。有一个手册页致力于公用工程提供unity优化文件大小在这里。虽然Unity采用先进的压缩算法的压缩,通常从一个地方压缩一半游戏数据给一个未压缩规模的三分之一,你需要尝试一切。

  1. Try to avoid Resources.Load. While Resources.Load can be very handy, Unity will not be able to order your assets by when they are first used when you use Resources.Load, because any script could attempt to load the Resource. You can set which level will include all assets that can be loaded through Resources.Load in the Edit->Project Settings->Player using the First Streamed Level With Resources property. Obviously you want to move Resources.Load assets as late as possible into the game or not use the feature at all.

尽量避免Resources.Load。虽然Resources.Load可以非常方便的,Unity将无法整理第一次使用Resources.Load的资产,因为任何脚本可以尝试加载资源。你可以设置该级别将包括所有资产加载可以通过在e Edit->Project Settings->Player使用的资源级别流媒体的第一属性。显然,你要移动Resources.Load资产尽可能晚进入游戏或根本不使用该功能。

Publishing Streaming Web Players 发布流web播放器

Streaming in Unity is level based, and there is an easy workflow to set this up. Internally, Unity does all the dirty work of tracking assets and organizing them in the compressed data files optimally, ordering it by the first scene that uses them. You simply have to ensure that the first levels in the Build Settings use as few assets as possible. This comes naturally for a "menu level", but for a good web experience you really need make sure that the first actual game levels the player is going to play are small too.

在unity里的流是以级别为基础的,有一个简单的工作流程处理此问题。在内部,Unity完成所有的资产跟踪和组织数据文件压缩优化他们最佳的工作,排序它通过第一场景使用他们。你只需确保在生成设置使用第一个级别尽可能少的资产。这种顺其自然的“一级菜单”,但有一个良好的WEB体验,你真的需要确保第一个实际的游戏等级播放器将播放小。

In order to use streaming in Unity, you select Web Player Streamed in the Build Settings. Then the content automatically starts as soon as all assets used by the first level are loaded. Try to keep the "menu level" to something like 50-100 KB. The stream continues to load as fast as it can, and meanwhile live decompresses. When you look at the Console during/after a build, you can see how large

为了使用流在Unity里,你选择Web播放器进行播放在生成设置里。然后内容将自动启动,尽快由第一级使用的所有资产被加载。尽量保持“一级菜单”50-100 KB喜欢的东西。流继续加载的速度,因为它可以同时现场解压。当你看到控制台在后台编译过程中,你可以看到有多大。

You can query the progress of the stream by level, and once a level is available it can be loaded. Use GetStreamProgressForLevel for displaying a progress bar and CanStreamedLevelBeLoaded to check if all the data is available to load a specific level.

你可以通过级查询别流的处理,并且一旦一个级别是可以装载可用的。使用GetStreamProgressForLevel用于显示一个进度条和CanStreamedLevelBeLoaded检查是否所有数据都可以加载一个特定的级别。

This form of streaming is of course linear, which matches how games work in most cases. Sometimes that's not enough. Therefore Unity also provides you with API's to load a .unity3d file manually using the WWW class. Video and audio can be streamed as well, and can start playing almost immediately, without requiring the movie to be downloaded first. Finally Textures can easily be downloaded via the WWW class, as can any textual or binary data your game might depend on.

这种形式的流是当然的线性,以配合游戏如何在大多数情况下工作。有时那是不够的。因此,Unity还提供了API的加载。unity3d手动文件使用WWW类。视频和音频也可以被流化,几乎可以立即开始播放,而不需要电影,首先要下载电影。最后,纹理可以很容易地通过WWW类下载,这可以任何文本或二进制数据取决于你的游戏。

 

<12>
发表评论0条 】
网友评论(共?条评论)..
Unity3D高级手册0800:Web播放器流