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.

Newcomers AppGameKit Corner / [SOLVED] where do save files save to when testing using agk?

Author
Message
dandrews
2
Years of Service
User Offline
Joined: 26th Jun 2020
Location:
Posted: 23rd Jul 2022 20:42
when testing an app through AppGameKit where does it save the data to when its saves your in app data? i thought it would save to the media folder of my app but it doesnt seem to.

The author of this post has marked a post as an answer.

Go to answer

Virtual Nomad
Moderator
16
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 23rd Jul 2022 23:19 Edited at: 23rd Jul 2022 23:29
This post has been marked by the post author as the answer.
Quote: "i thought it would save to the media folder of my app"

it does and it doesn't

by default (for me) the Write folders are in C:\Users\YourUserName\AppData\Local\AGKApps\... followed by the app folder/media (you'll find ALL of your AppGameKit project Write folders there) but i generally include:

...somewhere in a given project as a shortcut when testing "save" data/stuff like this.

otherwise, the media folder you're expecting to find "Write" stuff in is the "Read" folder (under the project folder holding the exe).

for more on the subject, see HERE.
dandrews
2
Years of Service
User Offline
Joined: 26th Jun 2020
Location:
Posted: 23rd Jul 2022 23:30
yes! thank you
dandrews
2
Years of Service
User Offline
Joined: 26th Jun 2020
Location:
Posted: 24th Jul 2022 00:14
i do have another question and didnt know if i should make a new thread but i wanted to check if a save exists and if not load some defaults and getfileexists doesnt seem to be helping lol
Virtual Nomad
Moderator
16
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 24th Jul 2022 00:34 Edited at: 24th Jul 2022 00:59
Quote: "getfileexists doesnt seem to be helping"

it does work (see ***caveat at the end where the following is in re: Windows builds).

i'm using it in the jam game i submitted today. ie:

looks for the rocks datafile and creates and positions ~150 rocks accordingly or, if it's not present, generates their positions, rotation, and then saves that data so you don't have to generate them again (which takes ~30 secs IIRC? it's all bullet physics based, so...).

so, what i did was run the game and let it save the data to the write folder (default) then copy the dat file into the read media folder so anyone who runs what i published wont have to generate their own data.

the same goes for game settings except, when you first run the app, you're using MY settings (in the Read/Media folder) but if you should change any of them, YOUR settings get saved in the Write location, right?

then, don't forget:
Quote: "when you attempt to open or load a file, AppGameKit will first look in the write folder before looking in the read folder."
so YOUR settings will be read first and MINE ignored the next time you run the game.

hope that makes sense?

without seeing what all you're doing (and how you might be doing it), i can't know why "getfileexists doesnt help" for you.

***with that, if you're publishing as HTML or something outside of a desktop environment, you'll need to save stuff differently... perhaps as cookies/Shared Variables?

then, from that "On HTML the apps must be hosted on the same domain, the values are stored as cookies." is not entirely true...
dandrews
2
Years of Service
User Offline
Joined: 26th Jun 2020
Location:
Posted: 24th Jul 2022 06:00
im sorry for wasting your time on that one it was my own error that was causing it to not work i am having trouble working out saving some data though. i have a "gunchest" in my game that can store any number of weapons and stats for those. with not know exactly how many lines i would need to save. i believe with "Writeline" you cant have any spaces or itll mess it up but im unsure on how to do it.

Virtual Nomad
Moderator
16
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 24th Jul 2022 17:06 Edited at: 24th Jul 2022 17:12
Quote: "im sorry for wasting your time"

you're not. i can use the exercise. if i'm not up for a given exercise, i just don't

otherwise, i tend to use a single line to hold all info for a given item/dataype and if "you cant have any spaces" means "blank" lines in a given datafile, just account for it.

as far as "not knowing how many lines", take advantage of dynamic arrays so that it doesn't matter.

the following generates an array of various guns that can be "picked up" or added to inventory (said GunChest), the ability to select which gun in the chest is currently active, remove it, etc. and (manually via [space key]) save the current inventory while marking which one is current, if any.


when you run it the first time, it will add a starter pistol to the chest and save the data. pick up/discard/set active guns however you want then [space] to save. [F12] to view it outside of the app.


it's a slightly different approach to what you're currently doing but hopefully there's something in there to help achieve what you're looking for.

and, if you want to add more than the GunChest to a given Save file, you can add things to help with that. ie,

can be something like:

then, when loading the inventory file:

basically, something in a given line to tell your program what to do with the data that follows.

i hope this helps

Attachments

Login to view attachments
dandrews
2
Years of Service
User Offline
Joined: 26th Jun 2020
Location:
Posted: 24th Jul 2022 22:40 Edited at: 24th Jul 2022 22:50
when i run this through appgamekit on the pc it works but when i broadcast it to my android phone it comes up as array index out of bounds, index 83, array leangth 82 at line 3121

edit: turns out it was because i had a save file on my phone already for my game something i should keep in mind for when its released

Login to post a reply

Server time is: 2022-10-03 02:15:42
Your offset time is: 2022-10-03 02:15:42