🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

how to avoid discrepancy when we have both unity package bundles and web service?

Started by
1 comment, last by Shaarigan 2 years, 7 months ago

hi. there are many questions.

there is a web service for browsers that downloads some json config and download images and movies based on those json configs. i want to make a unity client for that service. as we experienced, in unity, downloading objects is very slow and unity is not good for such a pipeline. unity has its own pipeline, using asset bundles or addressable that downloads and caches a bundle and then uses it through gameplay or…

Q1) is it good to use unity same as browser client and send many requests at same time to get data?

Q1) Back-end team looks for a system that changes content on the server and changes all contents on all types of clients. so with bundles, every time they change content or image I have to import the content in unity and make a new bundle and upload it again. what is the best solution for me?

Q3) what is the best approach to have updates without making players download the same bundle again and again? do I need to make a new bundle or group of bundles for new assets?

Advertisement

What goals do you try to achieve?

In general, Asset Bundles and content services like often used in web development have totally different approaches, while one is for splitting the game up into packages, the other is for on-demand resource loading. Think of a mobile game which has a limited size of for example APK files on Android and your game is much larger than the 3GB limit or you want to provide DLCs for your game. Both is the case when Asset Bundles enter the playroom, you simply split your game up into smaller parts and provide them as needed. Another usecase of them might also be splitting the project up into Art Assets and game code, so you don't have to sync the entire project all the time but I never tried this.

On the other hand, if Assets are subject to change frequently or you want to have some kind of on-demand delivery, a download service might be your path of choice. However, this has a lot of downsides. Performance might be a braking factor as downloading files from the web is much slower than getting them from disk and they might take up a lot more of memory because they haven't been optimized from Unity in beforehand. It is possible to create on-demand Assets in the final release but you rarely want to do that except for a very specific reason. Providing something like this might not be that complicated as it sounds, send a checksum or hash from your Unity client and the server then knows if the Assets already present has changed.

If this is all a production side request, then you might want to use a build server. You artists and other content creators could then just upload the assets into a version control system and you can trigger a build, either by a fixed time (e.g. at the end of a business day) or on-demand if you have collected enough changes for a patch. Such automation is a common practice in software development. If you don't want to path the entire game every time, you could instead implement a clever update management into Unity. This needs to look at the existing Asset Bundles and generate a hash from every bundle to send those to the server. The server then knows which version the bundle is and can send a delta package which just contains the changes. There are algorithms for that which handle those delta generation properly.

https://en.wikipedia.org/wiki/Delta_encoding

You can however combine this with for example LZ4 compression (we do use this as our preferred compression technique) to make the patch even smaller. You then just have to load the Asset Bundles as usual when the game starts and don't bother the player too much with updates. If you're clever, you can even do this in the background while a loading screen is running. I know that Unity is loading Asset Bundles on-demand when it uses an Asset from it

This topic is closed to new replies.

Advertisement