Sign in to follow this  

Unity Caching in Web Player, without WWW

This topic is 1763 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a game in unity+C# running on the web browser.  Map data resides on the server so that each player can get to it from any machine.

Map Data for some players is almost 50 megs (I'm aware of the 50 meg free caching cap) and each time the player logs in, it has to download all that content again.

 

I would like to use caching, but it looks like it only works through WWW, and only for Asset Bundles.  The server builds the map information for each player live, and is not a Unity machine, but just an MVC4 service coupled with a website to download binary map data.

 

I would like to simple execute code similar to this

 

byte[] contents = [binary map data];

save("player1.mapdata", contents);

 

As well as the ability to load from file name, and also check if the file exists locally.

 

 

does unity web player have a way to do this?

 

(I also have this question on the unity forums)

Share this post


Link to post
Share on other sites
I believe this is one of the ways that Unity starts making money from "real" uses of their web player. Last I checked into this (which was two years ago) there was no good way of loading game-like assets from non-Unity data; you had to convert to asset bundles on the server side, and you had to go through their caching layer, where you have to pay for more than 50 MB of local caching.
There is a WWW interface that allows you to issue a "GET" or "POST" but it's not quite to the level that you can trust a "streaming game experience" to it.

Again, this was about two years ago, so things may have changed since then. We ended up developing our platform on HTML5 + WebGL instead.

Share this post


Link to post
Share on other sites

Have you tried manually caching the data yourself, writing it to Application.temporaryCachePath?

 

If that's not good enough, consider whether you can reconstruct maps on-demand based on sending instructions, instead of sending the whole set of map data. If most of the building blocks are already on the player's machine (perhaps at all times), along with the code to assemble a map out of those blocks, then the data to describe a map can be very small.

Share this post


Link to post
Share on other sites

Have you tried manually caching the data yourself, writing it to Application.temporaryCachePath?

I have not,  I started to look into it, but your second idea works better for me.

you can reconstruct maps on-demand based on sending instructions, instead of sending the whole set of map data

After some reflection, I've found that this will be the most suitable for my game.  I'll focus on keeping the generation methods lightweight and split into areas of 32x32 or possibly smaller.  I don't think I'll have any buildings bigger than that, at least not as one model.

As long as the generation is lightweight, transferring the data will probably take longer than just generating it on the fly.  

http://blog.warpwarscity.com/2013/03/changing-mapping-plan-again.html

Share this post


Link to post
Share on other sites
Sign in to follow this