Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Looking for files in the Media directory

Author
Message
JRNTexas
13
Years of Service
User Offline
Joined: 24th May 2011
Location: Austin, Texas
Posted: 25th Sep 2011 10:13
I noticed that when I read a file, it looks in the "media" directory. But when I write a file it writes it to a system directory (writing for iPad on Windows).

I would like to do a "dir" on the media directory. Is that possible?
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 25th Sep 2011 16:04
Would at least be good if it wrote everything in the same directory as the app.

Are working on my tile mapper and this buggs me alot.
Impetus73
13
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 25th Sep 2011 19:14 Edited at: 25th Sep 2011 19:15
Since AppGameKit is targeted to mobile devices, you can only write to folders that each device will allow writing to, this vary from OS to OS, so no, you can not write to the media folder. I guess you should read in a file from the media folder, then write it out again to the system given out folder, then you can edit the file as you like.

----------------
AGK user - novice
Did Amiga / AMOS programming in the 90's, just started programming again with AGK.
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 25th Sep 2011 21:31
Yes but there should be an mac and pc specific raw method to write to any folder you want.
Like with the mouse and specific keyboard commands.
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 25th Sep 2011 22:07
I agree that on pc/mac we should not be limited to write to My documents directory.
We should put this request in the Bugs repository site
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 25th Sep 2011 23:04
Especially since the PC write path is really long and esoteric.

MikeHart
AGK Bronze Backer
21
Years of Service
User Offline
Joined: 9th Jun 2003
Location:
Posted: 25th Sep 2011 23:14
Guys, on OSX there are some paths you should and should not write too. Same goes for the newer versions of windows. As a user I would be very confused if an app saves their crap all over the place.
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 25th Sep 2011 23:53
Yes unfortunately the new Lion and the forthcoming Windows Metro are "mobilising" themselves with file sandboxing
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 26th Sep 2011 01:30
It's interesting that the announced AppGameKit Placement Editor allows for exporting a text file that you can copy into your program. Will this work for Windows/mac only and not iOS/phones/tablets? And will you have to play "find the text file" to get the results?

I guess we'll see...

JRNTexas
13
Years of Service
User Offline
Joined: 24th May 2011
Location: Austin, Texas
Posted: 26th Sep 2011 03:32
I understand that the device development team has limited access for security and proprietary reasons.

However, shouldn't we be able to get to a certain set of directories for both writing and reading? After all, I'm a developer, not a user. I need consistent access to a consistent area, even if that is "off in the either" somewhere.

ALSO, DOES ANYONE KNOW IF THERE IS A "DIR" COMMAND OR A WORK AROUND SO I CAN AT LEAST LOOK TO SEE WHAT IS IN THE LOCAL DIRECTORY WHERE I DO HAVE ACCESS?
JRNTexas
13
Years of Service
User Offline
Joined: 24th May 2011
Location: Austin, Texas
Posted: 26th Sep 2011 03:38
I am writing a game that may be given away (or not). The game has additional game files that I would like for the user to purchase, after they have had a chance to "get hooked" on the game.

I need a method for telling my game that new files are available and specifically what the new files are. Having a "dir" command would easily solve the problem. That way, I could give the files a common designation and the game can show the user their options based on what the "dir" discovers.

Without a "dir", it becomes a lot more complicated.
JRNTexas
13
Years of Service
User Offline
Joined: 24th May 2011
Location: Austin, Texas
Posted: 26th Sep 2011 04:07
OK...It appears that I must read from one directory (media) and write to another (a system directory), "c:\users\owner\documents\.....etc."

When I use the GetWritePath() command to find the file I have written, I cannot use the return from GetWritePath() as the path where I can now read the file I have written. I get an error that reads, in part, "path must be relative".

It seems I can only write to one directory and read from another and I do not have access to see what may already be in either directory.

There must be an answer that I don't see.
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 26th Sep 2011 06:08 Edited at: 26th Sep 2011 06:24
Quote: "OK...It appears that I must read from one directory (media) and write to another (a system directory), "c:\users\owner\documents\.....etc."
"


You are laboring under a misconception. You do not need to write in one directory and read from another.

OpenToWrite() will always use the path returned by GetWritePath(), but you do not need to include the path in your OpenToRead() command.

Just use the file name in both cases. Both commands will look for the file in the media folder of your write path. If the file you are trying to open is not in the write path, AppGameKit will look for the file in its local media folder.

Notice that? It will look in both media folders, but the one in the write path takes precedence. If a file with the same name exists in both media folders, OpenToRead() will open the one in the write path.

So, really, just put the file name in there, and don't worry about the path. You MAY have sub-folders in the media folder if you wish.

This code illustrates how it works. Run the project and then look in the "test" sub-folder in the media folder of your write path. You will see the file there, it has been written there, and read from there, and it will not be in the project's media folder.



EDIT: note that this will not work correctly if you broadcast to an iPad, as the GetWritePath() is still messed up with iOS. It will write and read the file, even in a sub-folder, but it doesn't return a valid string for GetWritePath(), so my code that displays the write path broken into small bits will crash on an iPad. I think this bug is getting fixed for the next update.

bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 26th Sep 2011 09:41
JRNTexas, you don't need a DIR command.

InApp purchase system does not work like that.
You need to provide ALL the game data with your app.

When the user purchases the additional game levels, you put a flag in your main data file where you store game scores and other game details. So you only need to read/write data files in the GetWritePath() and not in the main game dir.
Zubby1970
AGK Backer
16
Years of Service
User Offline
Joined: 22nd May 2008
Playing: AGK Studio Always
Posted: 27th Sep 2011 00:07
guys ive already done this on the iphone my kickstart remake has a level designer it writes the files to your documents agk\ your project. on the ios Iphone i dont have a say where they go it places them somewhere on the phone all i need is the file name and hey presto my level is loaded in. but it does not write them to your app media it took me ages to find out what was going on ill try and post an example here using you tube at some point to show exactly what i mean.

There can only be one
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 27th Sep 2011 08:44
on IOS data files go into your app directory, in a sub dir called DOCUMENTS which is standard iOS practice.
JRNTexas
13
Years of Service
User Offline
Joined: 24th May 2011
Location: Austin, Texas
Posted: 28th Sep 2011 06:53
Thanks for all of the information...

Given my scenario, I want to give the game away but let players buy new game files, HOW do I detect that a new file is in the directory?

I could do a loop and look for all possible permutations but that's not too efficient and if the number of files get's very large, time consuming.

I actually don't understand what happens when someone "purchases" a new file. It gets loaded to their system and stored but what methods can I use to check for new files?

When they purchase a new game file, I don't see the possibility to "modify" another file as a part of the purchase process that indicates specifically what has been purchased. Especially considering that they can purchase any file and my have any set of files on their system.

BTW - this is a great marketing approach for a game. The game is free, additional sets of files can be purchased.

A friend of mine plays a game with the same approach. So that game developer overcame the same problem.
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 28th Sep 2011 10:09
InApp purchase system does not work like that. No extra data file is downloaded.
You need to provide ALL the game data with your app.

When the user purchases the additional game levels, you put a flag in your main data file where you store game scores and other game details.
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 28th Sep 2011 10:09
And if you implement InApp purchasing - beware of LOADSYS!!!!!
JRNTexas
13
Years of Service
User Offline
Joined: 24th May 2011
Location: Austin, Texas
Posted: 2nd Oct 2011 08:05
bjadams,

I have a couple of questions for you about some of the information you've shared.

The first is about, "you put a flag in your main data file where you store game scores".

Are "additional game levels", installed - are you saying that I need write an executable to install the new files?

And tell me more about "LOADSYS!!!!!"

Thanks,

JRNTexas
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 2nd Oct 2011 20:12
For more info on Loadsys, check this out

http://news.cnet.com/8301-27076_3-20067706-248.html
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 2nd Oct 2011 20:15
JRNTexas, for iOS, ALL game levels of the game, the free ones, AND the paid ones have to be included in your app. You don't have to write any executables. You have to make some kind of INDICATOR in a data file, to allow access to the paid levels, when the user does the inapp purchase.
JRNTexas
13
Years of Service
User Offline
Joined: 24th May 2011
Location: Austin, Texas
Posted: 3rd Oct 2011 08:33
The LoadSys article is very interesting. Could throw a huge wrench in Apple's programming scheme.
JRNTexas
13
Years of Service
User Offline
Joined: 24th May 2011
Location: Austin, Texas
Posted: 3rd Oct 2011 08:43
I found this article about Apple and Loadsys:

http://www.applepatent.com/2011/06/lodsys-apple-motions-to-interveve.html

Apple intercedes.

Login to post a reply

Server time is: 2024-11-22 02:59:37
Your offset time is: 2024-11-22 02:59:37