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?
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.
Posted: 25th Sep 2011 19:14
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.
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.
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
Posted: 25th Sep 2011 23:04
Especially since the PC write path is really long and esoteric.
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.
Posted: 25th Sep 2011 23:53
Yes unfortunately the new Lion and the forthcoming Windows Metro are "mobilising" themselves with file sandboxing
Posted: 26th Sep 2011 1: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...
Posted: 26th Sep 2011 3: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?
Posted: 26th Sep 2011 3: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.
Posted: 26th Sep 2011 4: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.
Posted: 26th Sep 2011 6:08


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.

+ Code Snippet
// write data to a file
OpenToWrite ( 1, "test\myfile.txt", 0 )
WriteLine(1, "THIS IS A TEST")
CloseFile ( 1 )

// reading from a file
OpenToRead ( 1, "test\myfile.txt" )

a$ = ReadLine ( 1 )
d$ = GetWritePath()

CloseFile ( 1 )

do
    Print("String : " + a$)
    Print("")
    Print("Your write path is:")

    ` this part will crash on an iPad, because the
    ` write path is returned as a null string
    f = 0
    for e = 1 to len(d$)
        if mid(d$, e, 1) = "\" OR mid(d$, e, 1) = "_"
            print(mid(d$, f, e - f + 1) + chr(13))
            f = e + 1
        endif
    next c
    sync()
loop


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.
Posted: 26th Sep 2011 9: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.
Posted: 27th Sep 2011 0: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.
Posted: 27th Sep 2011 8:44
on IOS data files go into your app directory, in a sub dir called DOCUMENTS which is standard iOS practice.
Posted: 28th Sep 2011 6: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.
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.
Posted: 28th Sep 2011 10:09
And if you implement InApp purchasing - beware of LOADSYS!!!!!
Posted: 2nd Oct 2011 8: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