Forum GameFS Accessing files from the Server Game

Discussion and help relating to the PlayerIO game asset hosting and CDN solution, GameFS.

Accessing files from the Server Game

Postby ggibellato » July 11th, 2013, 3:49 pm

Hi

I'm new on PLAYER.IO and I thought be possible to use the GameFS to store all the images I will use on the game.

The idea is store the images on GameFS and when necessary send them to clients.

I though that there was some API under the GameFS that could allowed me to get the file, but what I read drive me to think that I use the GameFS API to get the file path and have to do a FTP connection to retrieve the file.

Is that right? Did I missed something?


Thank you in advance.
ggibellato
 
Posts: 8
Joined: July 1st, 2013, 12:11 pm

Re: Accessing files from the Server Game

Postby jbrettob » July 11th, 2013, 9:52 pm

Hey ggibellato,

So far I can read from the documentation is that:

1) You have to upload your files on GameFS via the admin-panel.
2) Once uploaded, you can retrieve the file via the following function:

ActionScript 3:
Code: Select all
var url:String = PlayerIO.gameFS("game-id").getURL("image.png");


This returns the url on PlayerIO GameFS. That means that after this step, you have to use the load url function of the SDK you are using.

3) Example in ActionScript 3:
Code: Select all
var url:String = PlayerIO.gameFS("game-id").getURL("image.png");
var loader:Loader = new Loader();
var urlRequest:URLRequest = new URLRequest(url);
loader.load(urlRequest);
this.addChild(loader);



I hope this helps, with what you are trying to achieve.
Game Designer & Developer | Flash | AS3 | Unity3D | C#
w: jbrettob.com | blog: blog.jbrettob.com | @jbrettob
User avatar
jbrettob
 
Posts: 19
Joined: April 9th, 2012, 3:51 pm
Location: The Netherlands, Europe

Re: Accessing files from the Server Game

Postby ggibellato » July 12th, 2013, 7:45 am

Nice, that was what I though.

On the Player.io itself there is no API to load therefore after get the URL I have to open a FTP connections and download the files.

I think that can be a problem on the server side even if is allowed.

Any thoughts?
ggibellato
 
Posts: 8
Joined: July 1st, 2013, 12:11 pm

Re: Accessing files from the Server Game

Postby Henrik » July 12th, 2013, 10:39 am

No no, load all images client-side. When you use the GameFS client api, you get back an HTTP url to the image through a content-delivery network, which is the fastest way for your user to get it.

There's absolutely no reason to load an asset server-side.
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Accessing files from the Server Game

Postby ggibellato » July 12th, 2013, 11:34 am

That is great... so should a use c# API to post the http get or should use httpresponse api from playerio....

Maybe I'm going on the wrong direction...

Thank you
ggibellato
 
Posts: 8
Joined: July 1st, 2013, 12:11 pm

Re: Accessing files from the Server Game

Postby Henrik » July 12th, 2013, 12:45 pm

What type of game client are you making? Flash? Unity? Something else?
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Accessing files from the Server Game

Postby ggibellato » July 12th, 2013, 1:12 pm

Unity
ggibellato
 
Posts: 8
Joined: July 1st, 2013, 12:11 pm


Return to GameFS