Is it possible ?

Previous topic - Next topic

ggindlesperger

Hello,

     I have been experimenting with trying to get a file or data over the internet onto the iPhone with GLBasic. The end goal is to have the high score list on a server on the Internet. In trying to figure it out I attempted getting a simple picture displayed that it pulled off the Internet. I used save_config$=PLATFORMINFO$("DOCUMENTS")+"/test.png" along with the code from the NetGetWeb sample code. I was able to put a small pic on the server called test.png and display it when I compile and run from GLBasic. How I did it was use the LOADSPRITE"save_config$",1 and then display the sprite. This worked fine and I thought I had it until I actually put it on an iPod. Then it did not work. Just a blank screen. What would be the best way to do this or can you even do it on the iPhone with GLBasic?

Thanks in advance..

Moebius

Personally, I'd try something using PHP.  You can use PHP to read and write to databases and you can pass values for it to write to the highscores list from GLBasic.  Then, to retrieve a high scores list you can use NETWEBGET (I think that's the one) to retrieve a PHP webpage which is just a list of the high scores.  Then, in GLBasic, you can break this up into an array of names and scores and display them using PRINTs.  Complicated, but probably a 'simple' way to do it using inbuilt web functions.  This will also work if you're using a web host.
Alternatively, if you are using your own server, you can run your own program on it which listens for requests from your app.  When your app sends high-score data to your server on a special socket/port that your server-program uses, it can write the info to a database-file.  Likewise, when the server-program receives a request it can send out the data to the device that sent the request.

I'd go with the first option because there would be less work involved, and you can use a web-host, without requiring your own server.

In terms of getting a domain name and hosting your website, if you want to do it for free I find 'co.cc' and '000webhost.com' to be a good combination.  You can get a subdomain of 'co.cc' for free (i.e. something like 'glrules.co.cc'), and you can host the website's data on 000webhost.com so that glrules.co.cc will point to your own website.

If most of what I just 'said' sounded like gibberish, let me know.  Good luck!
Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
- Random Shack Data Processing Dictionary

ggindlesperger

Thanks for your reply..

So that should work with the iPhone? I was afraid that it would not be able to use the WebGet function on the iPhone since it did not seem to work with the picture I tried it with. I was thinking maybe the iPhone would not let you save a file over the Internet due to how they like to keep the iPhone locked down.

Slydog

I noticed that you typed:

Code (glbasic) Select
LOADSPRITE"save_config$",1

instead of (no quotes):

Code (glbasic) Select
LOADSPRITE save_config$, 1

Was that just a typo converting to the forum post?
If not, that may be your problem.
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

ggindlesperger

I had the quotes in. It worked when I did compile and run in Windows so I thought I had it. Just did nothing on the iPod. I can try it without and see if it makes a difference.

Slydog

It would probably compile without errors, but it just wouldn't map to the "DOCUMENTS" folder as you intended, which would be required on the iPad / iPhone.  It would map to your default directory, with the file name "save_config$".
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

Moebius

Yes, I'm not sure about security in iOS, but from what I know I think each application is 'sandboxed' - i.e. they can only write files in their own app folder (I think).  Either way, the PlatformInfo call won't do much for your app on the iphone.
Slydog is probably right about the problem you're having with the image.  However, even if you do get this working, I'm not sure if it's the best approach.  You will need to get a server to create a highscores list image, which means you'll probably need to pay for your own servers etc. rather than the php option, which can be done on free website hosting servers.  Also, just to get a list of names and scores, you'll be downloading an entire image - although 320x480 isn't much :)
If you can get a server to generate a high-scores list image for you, it will save you from some coding for your app, but this would probably be difficult to do unless you can find a website that will do this for you.
Endless Loop: n., see Loop, Endless.
Loop, Endless: n., see Endless Loop.
- Random Shack Data Processing Dictionary

Moru

Does NETWEBGET$() work on iPhone? In that case it's simple to create a highscore if that is all you want. There are at least two examples on the boards how to do this, one is even in your /examples/ folder that comes with GLBasic. It's part of one of the games I believe.

Slydog

I've never used it (yet!), but doesn't OpenFeint handle iPhone high scores?
It may be overkill for what you want however.

Here's the thread for the GLBasic library:
http://www.glbasic.com/forum/index.php?topic=4146.0

But, using PHP would probably be the easiest method, if you can find a web host.
I think you would need two scripts, one to submit a score and verify if it is good enough to make it on the list, plus one to read the current high score list.  You may want to cache the latest list to the 'DOCUMENTS' folder to do a preliminary check so you don't try submitting scores that you know are at least not good enough since the last time you checked.

Data to track would be:
  game_id (if you plan on ever programming more games, so you can reuse this code)
  player_name (to identify the player, not sure what you want to do about multiple player's with the same name)
  level (level for which you are submitting / retrieving a high score)
  score (score to store / retrieve for that level)
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

ggindlesperger

Thanks for the replies guys. I think I am going to try the php route since I can run my own server. I was just experimenting with a png file to see if I could download one and display it. My end goal is to be able to download and submit highscores to a server. Openfeint is a little more than I want. I just wanted to try a simple top 5 scores and see if I could do it with my own server.

Thanks Again..People on here are so helpful.