How to send files to users?

Hello everybody :slight_smile: i have a newbie question.

Is there a way to send files(image sheets, lua files which hold image sheet information(width, height of each frame…) )…etc or any other files ) to the users?

In my game a user would make an in-app purchase, and then receive these files, which are essential for the game.

Is there a service on the web that could help me?
Any help would be greatly appreciated :slight_smile:

Just include them in the game and simply unlock via an IAP.

1 Like

@proV
If the files are large, you can follow @SGS’s advice, but instead unlock the ability to download them. Then have your app download the file(s) from a server.

You’ll need to set up a server for this purpose. If you’re experienced at this great, but if not you can easily do this at DigitalOcean or other providers. DO has lots of tutorials and help articles on setting up various kinds of servers.

Another good option for hosting the files is AWS. https://aws.amazon.com/s3/

I would NOT try to host files on Google Drive or GitHub (for free). I think in both cases you’ll cause yourself trouble if you do it.

2 Likes

Remote loading assets is fine but app stores don’t like loading of code from external sources. Lots of plugins just got blacklisted for doing that.

Imagesheets are not that big and can be zipped up in your apk. Just unzip them when the iap is unlocked.

2 Likes

You asked me some questions in PM, but I like to do my help in public, so here are the answers:

  • Assets in ‘resource directory’ - Correct, you cannot delete these, nor can you write to this area.
  • Assets in ‘documents directory’ - Correct, you can write here and delete files you have placed here.
  • What kind of server set up on Digital Ocean - Not a one line answer. Outline of steps below.

Digital Ocean Suggestions
Please note, I am not an expert at this stuff. I have done a little of this work but I prefer to let others handle the web-server, DLC-server side of the task.

That said, if you choose Digital Ocean, I’d do this (read all first):

Stage #1 - Standalone game FIRST
Write your game first, do every part of the game except:

  1. IAP code

  2. Download images code. Fake this up, but don’t actually connect to a server.

  3. Test, test test… - Make sure your ‘fake downloads’ work and you work out the kinks of showing new content from your ‘fake download area’. This can be a folder under resources for now.

Stage #2 - Create LAMP server
(See Tip at bottom of post on how to save time/money doing this.)

  • Create an account.
  • Create a Project
  • Add a droplet with these settings:
    • Select ‘Marketplace’
    • Select LAMP on Ubuntu 2.0.04
    • Plan: Basic Shared CPU
    • Lowest tier: $5/mo
    • Datacenter region: Choose one close to yourself (this will ease working on the droplet; later if you need to expand you will have several options to increase your ability to handle traffic. This is too broad a topic to go into now.)
      *Additional options: None.

Stage #3 - Write PHP code on your server
Write PHP code (on your new server) to handle requests for assets. i.e. This code handles requests from your game asking to download images/files.

Stage #4 - Write actual code in game to interface with PHP on server.
(This really overlaps with stage 3 since you will need to adjust both at the same time.)

  • Change your fake DL code and start working out the bugs in downloading content from your server.
    (Tip: I’d write a simple app with module designed to test connecting to the server and downloading content. Then, when you get the module working, copy it to your game and use it there. Never do this kind of development in game first. It is too messy.)

Stage #5 - IAP

  • Write the IAP code to unlock the ability to download puzzles or perhaps use consumables to buy puzzle packs.
  • Test test test.

Stage #6 - Publish

Tip: Regaring the LAMP server. If you have a decent computer, you can use virtualbox or vmware to set up a virtual server right on your own machine. Then, you can set up a LAMP server in the VM and write all the PHP code and test it there. This will be way cheaper and faster to test with since the downloads will be from the same physical hardware.

Once you have that all ironed out, you can deploy the PHP code to your DO server. i.e. Wait to set up the DO (or other) server till you really need it.

2 Likes

A great alternative to using PHP is to use one of the @Develephant products:

https://www.develephant.com/

Specifically Coronium Core (CC).

You can deploy CC on DigitalOcean, Amazon Lightsail, or Amazon EC2.

This product has a handy console and lets you write all the server side code in Lua. So you can skip learning PHP, and you can use the same language you’re using for Corona work. Perfect!

Reality Check
Regardless, anything involving servers and downloading content is not a newbie project, so if you’re really new to game dev you may want to focus on making the core game first, then worry about server stuff later.

2 Likes

Thank you very much for the detailed answer! You gave me a lot to think about.
Gotta learn some new stuff :smiley:
Thank you again!

I have to ask, is there a way of doing this without using servers?

I took a look at the Amazon S3, where you upload the files, that the users can then download. Would i need a server to use the S3?

@proV

Correct. You can use Amazon S3. That is a service (running on Amazon servers).

You can use that, but you’ll have to learn:

  • How to upload files to to a bucket (IIRC their name for storage).
  • How to secure it.
  • How to write Lua code to do the login and download.

These are all pretty straight forward if you have some experience.

Short answer, “Yes. You can make that work and it isn’t too hard.”

1 Like

Oh, you just made my day :smiley:
I already took a quick look at how the s3 works, and i think can handle that :smiley:

Last quiestion: i noticed that develophant has an amazon s3 plugin called S3 Lite.

you said: “you’ll have to learn how to write Lua code to do the login and download.”

Does the s3 lite plugin cover this part?

If you have a minute, could you just take a very quick look at the docs?
Here is a link to the very short instructions:

https://develephant.github.io/s3-lite-plugin-docs/api/

I would just like to be sure if this covers the lua code you mentioned before.

You have been incredibly helpful roaringgamer! Thank you so much!

I hope that @Develephant sees this and posts back, but …

I just made a tiny project and used this plugin to attach to one of my existing accounts. I was able to list my buckets, so I’ll assume the rest of his plugin is also working fine.

I should have said. In my experience @Develephant makes solid (and awesome) plugins and projects.

1 Like