Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Bundling assets on desktop builds
Started by XeduR @Spyric Jun 11 2019 05:49 PM

- - - - -
8 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 826 posts
  • Corona SDK

A friend of mine is developing a 2D visual novel and he was looking around for new potential engines. He asked me a few questions about Corona that I didn't have answers to, so I thought to forward them here.

His current (or soon to be previous) engine, Renpy, can apparently hide the game assets, e.g. images and audio, in distribution builds. Now, the files aren't protected or even well hidden by any means, so anyone with the know-how can get to them. However, he is quite adamant that he wants to bundle all of his game assets, amounting to hundreds of images, audio and text files, into a single location that a normal user won't accidentally open.

From what I remember, building for MacOS or Windows on Corona will create that just, a single large folder where all of the game's assets are freely accessible.

Question 1) Does anyone know of a method to bundle all game assets (on distribution builds) to a single location? The first idea that comes to my mind is creating a zip and then uncompressing it when the game is first loaded, but that creates the same problem in just a different location. Is there a way to open a zip, read its contents and load the files to cache from there without unpacking them to the hard drive?

Does someone have any alternative ideas (not including creating a single executable using a tool like Enigma Protector)? His intention is NOT to achieve any sort of protection or encryption for the files, but just to make the installation folder look more professional and less cluttered.

Question 2) Corona doesn't support videos on Windows, but are there some workarounds for this, like loading local videos via webview or something entirely different?

Question 3) How's Linux looking? Is it stable enough to build games for?



[TOPIC: post.html]
#2

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,586 posts
  • Corona SDK

Answer 1: Windows builds are packed up so it isn't straightforward to find and extract assets. You can probably do it, but it isn't obvious how.

 

 (Wrong!  I was thinking of HTML5 builds here;  See my response further down.)


Answer 2: You can show videos in Windows. I'll post back (probably tomorrow) how. I have an client who has being using this feature successfully for a year or so.

Answer 3: Linux support is pretty good. The same client is now migrating his game to Linux. He builds arcade consoles and I do the game development.
He has been using Windows but wants to move to a cheaper solution i.e. Linux. So far it works great.


Edited by roaminggamer, 15 June 2019 - 09:14 AM.

  • XeduR @Spyric likes this

[TOPIC: post.html]
#3

nick_sherman

[GLOBAL: userInfoPane.html]
nick_sherman
  • Corona Geek

  • 1,810 posts
  • Corona SDK

Is that accurate RG? My Windows builds have a Resources folder that contains all the assets freely accessible. 

 

I suppose you could zip everything up and unpack it to the app sandbox every time it's launched, and delete them again on exit, but I suspect that's really going to add to the startup time.



[TOPIC: post.html]
#4

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 826 posts
  • Corona SDK

Yeah, the Windows builds have all assets apart from .lua files exactly where they were in the project folder.

The zipping "as is" has two problems that I can see.
1) If you unzip the files to documents or temp directory, then the game will require double hard drive capacity during gameplay.
2) There's no guaranteed way of deleting the files on exit. Alt+F4, pressing the X on the window, crashes, etc. would all leave the files where they were unzipped. The only way these files would be removed is if the user starts the app again and this time let's the app delete the files or if the user navigates to the folder and deletes them manually.



[TOPIC: post.html]
#5

davebollinger

[GLOBAL: userInfoPane.html]
davebollinger
  • Corona Geek

  • 1,347 posts
  • Enterprise

There are only two ways to do it "right":

  native engine support for packaged data - doesn't exist in corona

  complete sandbox wrapper around accessing packaged virtual files - ruled out in op

a DIY unzip-delete is not a "real" solution (as already discussed)

So, um, Unity?


  • XeduR @Spyric likes this

[TOPIC: post.html]
#6

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 826 posts
  • Corona SDK

Thanks. I'll be letting my friend know that if he wants to tidy up / hide his game assets, then Corona won't be able to do it without the help of external software like the Enigma Protector.

I have to admit, I'd like something along the lines of native engine support for packaged data for my own future games as well. While I can personally settle for adding a license file with my graphics and encrypting my text files, etc. I'm not sure if I can legally add any 3rd party sounds or music into games without breaking their associated license agreements (most of which state that the end-user must not be able to access the files themselves and letting any user just have them would be in violation of that).



[TOPIC: post.html]
#7

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,586 posts
  • Corona SDK

Is that accurate RG? My Windows builds have a Resources folder that contains all the assets freely accessible. 
 
I suppose you could zip everything up and unpack it to the app sandbox every time it's launched, and delete them again on exit, but I suspect that's really going to add to the startup time.



@nick_sherman - Thanks for calling that out.  I did in fact make a mistake.  I was thinking about HTML5 builds and the way assets are stored.  For Windows builds, the assets are (in fact) in the 'Resources' folder and easily found.

 

PS - I'm still happy with Linux biulds and I still need to get back with a example of video under Windows.



[TOPIC: post.html]
#8

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,586 posts
  • Corona SDK

Hi again.  Here is the video sample I promised:  

 

https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2019/06/videoTest.zip

 

You should be able to build this for Win2, run the game, and see video.  

 

Note: I did not take a lot of care on resolution for this example, so you may want to play with that in:

- video file itself (adjust your video to be a suitable resolution using your favorite editor.

- localpage.html (change video display resolution here)

- build.settings - control app resolution and fullscreen or windowed mode here.


  • XeduR @Spyric likes this

[TOPIC: post.html]
#9

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 826 posts
  • Corona SDK

That's a neat workaround. Thanks for sharing it.




[topic_controls]
[/topic_controls]