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 / OpenToWrite and windows complications

Author
Message
erebusman
13
Years of Service
User Offline
Joined: 23rd Jul 2011
Location: Sacramento, CA
Posted: 8th Oct 2012 07:31
Hello,

I'm having similar problems to the thread here : http://forum.thegamecreators.com/?m=forum_view&t=192913&b=41&msg=2299318

But did not want to hijack that thread, and I have additional questions.

My game works great on iOS - no problem. This is all about trying to build windows versions.

I have some configuration files for things like volume settings, language selected, whether music should play or not etc.

On windows I understand that if I try to use OpenToWrite its going to save this file within the My Documents hiearchy RATHER than in my \media\ sub folder?


So here's my questions:

1: Assuming when you launch the game for the first time you read the settings.dat file from the \media\ folder; but when you change a setting it saves it to the My Documents folder instead. Now when you launch the game the second time .. which file will it read? Is it going to constantly read the wrong file? Or does it presume the one in the My Documents takes precedence over the \media\ one?

2: I would like to protect some file by zipping/unzipping them between uses. I assume that the zipped file will be placed in the My Documents as noted above as well. If that assumption is true then yet again .. does every time my program launches I tell it to unzip the assets.pak file (just a different named zip) is it going to unzip the one from my \media\ folder or will it presume the one in the My Documents is the proper one?


I can not find in the documentation where it explains this behavior, yet threads like the one I linked seem to claim to understand it?


The reason all this is quite important ( above and beyond not making stupid mistakes from assuming which file will be in use) is I am trying to make my games packaged for distribution on gaming portals like Wildtangent or Big Fish Games.

I don't see why this should be overly problematic as there are already Windows based specific game center's supported (AppUp).

I'm really just wanted to understand how & where and the very specific rules about my assets and where they will be read/written from in what order of precedence.

Thanks for any help in advance.
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 8th Oct 2012 09:37
Quote: "Now when you launch the game the second time .. which file will it read?"

I believe AppGameKit checks for the file in My Documents/AGK/... and if it's not in there, then it reads it from /YourProject/media/...

You're a T2 programmer aren't you erebusman? You can use C++'s fstream library for reading and writing files in the project folder as well.

bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 8th Oct 2012 10:31
on T2 there should be AppGameKit commands to redirect file read/write to other directories
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 8th Oct 2012 15:14
It always checks My documents/AGK/<APP> first.

This is a requirement of Windows 7 and above, you cannot write files to the Program Files directory, it throws a permissions error.

But for deploying, you can put everything in one tidy folder structure. AppGameKit will move the files to My Docs as and when you edit them. You don't need to know where they are (except when developing and changing files externally of course).

Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 8th Oct 2012 17:37 Edited at: 8th Oct 2012 17:39
If you REALLY don't want the file to be in two places, you can put the file in /media/ with a temporary name, read it in, write it back out with the real name to the sandboxed docs folder, then delete or ignore the temp one. The next time your program runs, if the new file exists, have code to skip the read/write process.

PS, that's also a good way to check if the program has run at least once, when you have a "read this first" type of help or tutorial screen for the first time the program runs.

erebusman
13
Years of Service
User Offline
Joined: 23rd Jul 2011
Location: Sacramento, CA
Posted: 8th Oct 2012 22:27
Thanks guys great feedback!

@batvink good to know -I had observed that but didn't know why

@rich - I was entertaining similar ideas but wanted to get some confirmation of the order of precedence first

Thanks guys

Login to post a reply

Server time is: 2024-11-23 23:48:07
Your offset time is: 2024-11-23 23:48:07