0

I am using HTML5 for my game and would like to know how to program a download of the game assets. I get that the default asset package is basically locked up, so obviously I want the download to be in a specific storage space that can only be read by the game app but which is still separate from the app itself in order to accommodate this limitation. Note that I will be doing this using Xamarin, but I'm also willing to have Android Studio code so that I have an "either/or" case coverage as this will be shared with other users of my game content editor. Also, this has to be a method that works with API level 30 (for obvious reasons) so any download progress reports must be implemented accordingly.

  • Your question is pretty vague and broad. You are presumably using a WebView control to display locally stored content? And you want to display additional content that is downloaded at runtime? All of these things (displaying local content in a webview, downloading files, using the Android file system) are fairly well covered in the official docs and in numerous posts on SO and elsewhere on the web. Can you revise your question to be more specific about what you don't understand? – Jason Dec 29 '21 at 20:57
  • Sorry about that. What I mean is that the files for the game are on a server right now which I'm trying to use as a cloud host for the app (which loads from the server using a login/password combo for asset protection) however this is not working out real well so I want to download these files to a user's device instead. Unfortunately some of my assets are too big for Google Play's automation (more than the 1GB limit for VFX alone) so I can't store the download directly within the app asset files. However I still want the files to be downloaded and readable only by the game app. – Jeffrey Davis Dec 30 '21 at 01:24
  • Also, the editor that I use for map design is specifically targeted at HTML5, so I can't legally use any sort of intermediary such as Unity or Unreal. However I still want to have the full download interface (progress, current file etc.) and be able to unpack the data once downloaded. – Jeffrey Davis Dec 30 '21 at 01:30
  • Again, what is your question? I understand what you're trying to accomplish, but I'm not going to write a 10 page answer covering every aspect of it. Like I said earlier, there are plenty of existing docs and posts about how to do the individual elements of this. You need to narrow it down to one **specific** thing you're stuck on. – Jason Dec 30 '21 at 01:54
  • In that case, can you at least point me in the right direction with some examples? I'm basically looking for code examples regarding the basic download implementation with progress displayed, and with unpacking the files once downloaded, however I want it to be as up to date as possible (and while I have seen plenty of examples, most of what I've tried is either deprecated or no longer functional in the most recent API levels). – Jeffrey Davis Dec 30 '21 at 02:31
  • you download a file the way you do in any C# app - use HttpClient or WebClient. See https://www.google.com/search?q=c%23+download+file+progress+site:stackoverflow.com. As far as "unpacking" I have no idea what you mean by that. How are the files "packed"? Zip? RAR? Something else? – Jason Dec 30 '21 at 02:36
  • I think I'll probably go with ZIP since it's the most common. – Jeffrey Davis Dec 30 '21 at 02:40
  • one of the main benefits of Xamarin is that it gives you access to (most of) the things you can do with C# and the .NET Framework. Like dealing with zip files. See https://www.google.com/search?q=xamarin+unzip+site:stackoverflow.com – Jason Dec 30 '21 at 02:55
  • thanks. one last request: I'm declaring the webview control straight in the code (rather than using Xamarin forms) so I will require an HTML page or some other mechanism to show progress, and I also want to be sure that I'll have the necessary read/write permissions (meaning that I ask the player to approve the download through the standard "allow file access" interface if required for this to work). – Jeffrey Davis Dec 30 '21 at 03:03
  • https://stackoverflow.com/questions/48164058/how-to-show-progressbar-and-make-it-progressxamarin-android/53699411 – Jason Dec 30 '21 at 03:33
  • OK thanks, I'll take it from here. – Jeffrey Davis Dec 30 '21 at 04:33

0 Answers0