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 / AGK player problem !

Author
Message
Captain Ouais
20
Years of Service
User Offline
Joined: 12th Dec 2003
Location: France
Posted: 4th Nov 2013 12:27
hello,
I made a little game level
level with the load function: opentoread
but with my android tablet, it is not loaded and the game runs without data!
How can that data be loaded?
thank you

I do what i do !!!
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 4th Nov 2013 12:29 Edited at: 4th Nov 2013 12:31
maybe upper/lower case in filename different from the opentoread function.
the level should be in app/media path or below.

AGK 108 B19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
Captain Ouais
20
Years of Service
User Offline
Joined: 12th Dec 2003
Location: France
Posted: 4th Nov 2013 12:35
it's in the correct folder,
the game works with windows !

I do what i do !!!
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 4th Nov 2013 12:49
did you check the filename?

at Windows is A=a
at Android is A<>a

AGK 108 B19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
Captain Ouais
20
Years of Service
User Offline
Joined: 12th Dec 2003
Location: France
Posted: 4th Nov 2013 12:56
the folder's names is : levels and the filename is 1.txt

I do what i do !!!
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 4th Nov 2013 13:05
hmmm
so you open with "levels/1.txt" true?
did you use setfolder?
what said GetFileExists or getfolder?

AGK 108 B19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
Captain Ouais
20
Years of Service
User Offline
Joined: 12th Dec 2003
Location: France
Posted: 4th Nov 2013 13:32
I do not use GetFolder !!
I have an error on my tablet back : file 0 does not exist


I tried in the media folder at the root, like, he does not find it!

I do what i do !!!
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 4th Nov 2013 14:22
i mean if you used setfolder before you can see
with print(getfolder()) where you are.
setfolder is part of filename, maybe is there a mix of upper/lowercase that don't fit.

can you show your source?

AGK 108 B19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
Captain Ouais
20
Years of Service
User Offline
Joined: 12th Dec 2003
Location: France
Posted: 4th Nov 2013 14:57 Edited at: 4th Nov 2013 14:59
I submitted the file to the root "media"
i tested print(getfolder()) : media

OpenToread ( 1, "1.txt" )
for i = 0 to 300
tablo [i ] =readInteger ( 1 )
next i
closefile (1)

I do what i do !!!
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 4th Nov 2013 15:27
Captain Ouais, is your file 1.txt a text file (human readable) or binary file?

If it is a text file, then you need to use Val(ReadLine(1)) instead of ReadInteger(1). The ReadInteger/Float/String commands are for binary files created using WriteInteger/Float/String commands. For a text file, you only have WriteLine and ReadLine.

I know this is not your main complaint, but, it is something that might be an issue.

If you, in fact, are using a binary file. How was it created?

Now, as for your main issue, are you sure that you are using the same version Player as your IDE? The current Player in the Google Play Store is v10819. If you are using a different version of the AppGameKit IDE, then they may not be talking properly.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Captain Ouais
20
Years of Service
User Offline
Joined: 12th Dec 2003
Location: France
Posted: 4th Nov 2013 15:46
I created my file opentowrite (I created a level editor for my game)
I have called 1.txt but before it was called "tablo.dat"

Everything works fine with windows! the level is loaded!
I use the latest versions of the player: V10819 agk and the last patch: 10819 beta



I do what i do !!!
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 4th Nov 2013 16:18
Those lobstery things are creepy looking. I assume they are 'bad'. The graphics look very nice.

I also created my own level editor for my WIP (it makes it sooo much easier) and store the playable levels as binary. The level editor reads a text version (so that I can copy/paste/edit little bits between files) and then outputs both the binary and text versions upon executing the file save.

What commands do you use to output to the file (the write ones)?

Try using "OpenToRead(1,'/media/levels/1.dat')". I now remember that I think I had a similar issue 'way back when' and adding that initial '/' fixed it.

I now always use fully qualified paths starting with '/media' for all open/load/read/write commands. And I avoid all the commands that change the default directory, I almost always encountered issues with them on one platform or another.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 4th Nov 2013 16:20
odd...
what happens if you use "a1.txt" or "a1.dat" ?

i know for android there exist a file extension filter but txt
should work!?

AGK 108 B19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
Captain Ouais
20
Years of Service
User Offline
Joined: 12th Dec 2003
Location: France
Posted: 4th Nov 2013 16:45
a.txt or a.dat or a1.dat, etc ... no one works !!

i tried :
OpenToread ( 1, "/media/levels/a.dat" ) : windows file not found
OpenToread ( 1, "//media/levels/a.dat" ): windows ok, not android ...

to save :
OpenToWrite ( 1, "a.dat", 0 )
for i = 0 to 300 :WriteInteger ( 1, tablo[i] ):next i
CloseFile ( 1 )

I do what i do !!!
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 4th Nov 2013 16:52 Edited at: 4th Nov 2013 16:54
i think you have a duplicate.
if you save from agk it is in user/documents/agk/app/media
not in the app path itself because user rights.

the path in user/documents/agk/app/media
is favoured
if there exits a file agk will use this and not the file
in app dir.

AGK 108 B19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 4th Nov 2013 16:53
Your OpenToWrite command is not specifying the same directory ('levels') as your OpenToRead. Is that just a 'typo' for demo code in your post?

I am surprised that you are having issues with the leading '/' like that.

Are you sure that your AppGameKit IDE and Player are both v10819? Did you install v10819 over an older version (not advisable) or did you create a fresh directory for it?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Captain Ouais
20
Years of Service
User Offline
Joined: 12th Dec 2003
Location: France
Posted: 4th Nov 2013 17:24
all my work is in the same folder: user/documents/agk/
precisely so that everything does not scatter everywhere

I just put everything in the folder C: \ Program Files (x86) \ The Game Creators \ AppGameKit \ Projects \ Basic \ tijeu
I changed all the paths in my program : ( 1, "//media/levels/a" )
I renamed the file "a" to be sure not to have any conflict or other
I just installed a version of the 10819 in a separate folder

in agk -> help -> about: build 107 Is this normal?


I think I have tried everything in all directions


I'm exhausted!

I do what i do !!!
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 4th Nov 2013 17:39
Quote: "in agk -> help -> about: build 107 Is this normal?"

Yes it is v10819 is not an 'official' release, being considered to be beta.

If you open the file named AGK.txt in your AppGameKit directory, it will state what build it is.

Now I am getting confused about where your files are. Assuming you are working in Tier 1, everything starts in the <appdir>/media directory. You can use other directories under <appdir> and change the current folder. But I have had too many issues with that and avoid it. You can add directories under <appdir>/media and use them.

You need to make sure that you are consistent in how you reference them. You earlier indicated that your files were in the media/levels directory and then used examples of somewhere else.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 4th Nov 2013 17:41 Edited at: 4th Nov 2013 17:44
the user/documents path did not belongs the app.
you must move this contens to the app/media/ folder (this with bytecode file)
or your setup will be incompleate.

the docu path is private.

you can give a config template file with your app
but if the app save it, it makes a (modified)copy at docu path
and this will used. means the setup still exists original.

for easier understanding the original setup files are write protected.

AGK 108 B19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
Captain Ouais
20
Years of Service
User Offline
Joined: 12th Dec 2003
Location: France
Posted: 4th Nov 2013 17:55
I made my cut and paste a little faster
but in my program everything is consistent, otherwise it would not work with windows

Initially the file was saved in: user / documents / agk / app / media
I did not ask until I test on my tablet
Then I tried to repatriated in my file: app / media / folder
without success!
my tablet always told me: 0 error, file not found!

to test, I put the file anywhere, it does not work tjrs!

I do what i do !!!
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 4th Nov 2013 18:12
@Captain Ouais
hmm, if you would zip your project and attach here as message
i can try with my android tablet and bring it to work.

AGK 108 B19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 4th Nov 2013 18:14
I just ran a very simple set of tests using a verified version AppGameKit v10819 for both IDE and Player.

The code looks like this (the ball1.png file can be found in <agkdir>\Projects\Basic\Examples\Benchmarking\media):


I tried it with "ball1.png" and "/media/ball1.png" and it worked perfectly in all environments (direct on Windows, and via Players on Android and iOS). I only had a problem when I tried "media/ball1.png" (without the leading '/'). Then nothing liked it.

See if the test above works for you. If it doesn't, then there is probably something wrong with your installation.

Make sure that the ball1.png file is in the <appdir>/media directory under your AppGameKit setup and not in the User\Documents one.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Captain Ouais
20
Years of Service
User Offline
Joined: 12th Dec 2003
Location: France
Posted: 4th Nov 2013 18:25
your mail works ?

I do what i do !!!
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 4th Nov 2013 18:37
Quote: "your mail works ?"

To whom is this question directed?

If it is me, I prefer to not accept emails from the forum.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Captain Ouais
20
Years of Service
User Offline
Joined: 12th Dec 2003
Location: France
Posted: 4th Nov 2013 19:11
Quote: "To whom is this question directed?"

no it was for Markus !!

I tested games like SnakeSnacker and spaceshooter my tablet

my game also works on the tablet graphics are loaded, but the level data are not loaded then platforms and monsters do not appear!

I do what i do !!!
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 4th Nov 2013 19:19
It sounds like your app is looking for the file in a place that is not accessible to it.

Assuming you are using a separate program to create the level files (and it is an AppGameKit one), it will read and write in a different path than the actual app.

Manually copy your data file to your <agkapp>/media directory for the actual app. This should be in the main project directory, the one you have your app project in, not in the Documents path.

Presumably, everyone will start with the same file. So it should be in the executables media directory. If/when the app rewrites the file, it will store it in the application 'sandbox' area and will NOT overwrite the original file. Each platform has a different 'sandbox' area.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Captain Ouais
20
Years of Service
User Offline
Joined: 12th Dec 2003
Location: France
Posted: 4th Nov 2013 19:58
when the game is launched, the user folder / documents / agk / app / media appear temporary files generated by the tablet I think.
So it has access!
I copy paste the file level data everywhere! No improvement, I cut my anti virus, not better either!
I'll try with another pc...

I do what i do !!!
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 4th Nov 2013 20:18
I know the documents directory gets created when you run an app. But that is not where the app will look first for files and you should sort of treat it as if it doesn't exist.

Just program with the (incorrect) assumption that everything is in the <appexedir>/media directory (and you can use subdirectories under that). Even though your app might write or update files and they will end up in the documents related directory (this is the 'sandbox' area for Windows), if you let yourself just ignore that and 'assume' they are in the <appexedir>/media (and any subdirectories under that), then the code will be consistent.

Can you show the exact code you are using to open the file that is not getting read? And then look in the same path in the command you are using in that code and check to see if the file is there with exactly the same spelling, including case. If the file is in the <appexedir>/media directory, you should be able to access as 'file.whatever' or '/media/file.whatever'. If it is in a sub directory named 'levels', than either 'levels/file.whatever' or '/media/levels/file.whatever' should work.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 4th Nov 2013 20:24
you should also try clearing the cache for your Player on your Android device. That is done by opening the settings app, navigate to 'apps' or 'application manager' (different on different devices). Then find 'AGK Player' in the list (probably under 'downloaded' or something like that, also varies across devices). Click on it and then click on the 'clear data' and/or 'clear cache' buttons. It also doesn't hurt to 'Force Stop' it. This resets everything for the Player very nicely.

The Player can accumulate a lot of garbage files over time. It does NOT clear any files loaded by apps broadcast to it. This means that it also doesn't remove any directories created with the app is broadcast to it. So, it is not impossible that there are old files that the Player is reading instead of the one you think it is.

There have been requests made to change this behavior and I think it might happen, eventually.

By the way, what version of Android is on the device (which is a what?) that you are testing on?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Captain Ouais
20
Years of Service
User Offline
Joined: 12th Dec 2003
Location: France
Posted: 4th Nov 2013 20:52 Edited at: 5th Nov 2013 09:52
link erased

my cellphone : htc desire android 2.3.3
my tablet : polaroid midc 409 android 4.0.4

I do what i do !!!
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 4th Nov 2013 21:10
I did not mean for you to upload the entire project. And I would recommend that you edit your post to remove the link (and remove the uploaded file). There is nothing that stops a web crawler from grabbing that file and exposing your code and graphics.

I only want to see the lines where you open the file for reading. I do not want to look at your (or anyone's) entire project (something I avoid at all costs because it takes up way more of my time than I can afford).

Are you seeing the same problem on both of your devices?

On Android 2.3 devices, even if you uninstall an app the data it creates/uses is left behind and usually needs to be manually cleared using a file manager app.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Captain Ouais
20
Years of Service
User Offline
Joined: 12th Dec 2003
Location: France
Posted: 4th Nov 2013 21:20
I checked and the cache is zero

load the level in game :

OpenToread ( 1, "a" )
for i = 0 to 300
tablo[i]=readInteger ( 1 )
next i
closefile (1)

load the level in editor :
OpenToread ( 1, "a" )
for i = 0 to 300
tablo[i]=readInteger ( 1 )
next i
closefile (1)

save the level in editor :
OpenToWrite ( 1, "a", 0 )
for i = 0 to 300 :WriteInteger ( 1, tablo[i] ):next i
CloseFile ( 1 )

the pb is the same on both of my device !

I do what i do !!!
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 4th Nov 2013 21:33
The code you post doesn't look like it does anything function with the read data. And the one that writes looks like it is writing the same value 300 times.

So I would have to guess that is not the actual code in your app.

I can't help you with this. Can't you simply copy the one line that you use from your actual code that shows the name and path being used to open the file?

And, again, since your level editor would be storing the files in its Documents\AGK\<leveleditor\media directory, unless you manually copy those to the media directory under the game app, it won't see them.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 4th Nov 2013 21:36
@Captain Ouais
yes, my mail adress works. you can send.

AGK 108 B19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
Captain Ouais
20
Years of Service
User Offline
Joined: 12th Dec 2003
Location: France
Posted: 4th Nov 2013 21:46
this is actually my code!!
It works well under Windows!

https://www.youtube.com/watch?v=ea56o_ATJiY

ah ok, i see,the post has been changed automatically
the [] have been erased

save the level in editor :
OpenToWrite ( 1, "a", 0 )
for i = 0 to 300 :WriteInteger ( 1, tablo[ i ] ):next i
CloseFile ( 1 )

I do what i do !!!
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 4th Nov 2013 22:08
ignore windows,the agk player/interpreter core useing
other source code for this android os.

if you save a level at android you should load it from there
because you will save the data in a user docu path (similar windows) and
at loading it is not part of setup (.apk) the load command
will look at this user docu path and use this file.
for binary data i use .dat as extension.

in my game that also have a level editor that i use only under windows
i save the level with file = OpenToWrite("level.dat",0)
move the level file then from user/docu/app/game/media
to the agk/project/game/media
load it then as file = OpenToRead("level.dat")
thats all.
i do not use setfolder somewhere.

AGK 108 B19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
Captain Ouais
20
Years of Service
User Offline
Joined: 12th Dec 2003
Location: France
Posted: 4th Nov 2013 22:34
this is exactly what I do !!
i use my editor under windows
I copy the file in the media folder of the game from the doc...

but android don't found the file !

I do what i do !!!
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 4th Nov 2013 23:28 Edited at: 4th Nov 2013 23:40
@Captain Ouais
i can't get your rar it was 404 as i come back to home and got no mail.
sometimes 4 eyes see more than two,trust me.
why it not work for you can have thousand reasons.

Quote: "in agk -> help -> about: build 107 Is this normal?"

no, i see 108 for beta 19
maybe you start the wrong ide.
just open path for agk at windows kontext menĂ¼/information at link.



AGK 108 B19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670

Attachments

Login to view attachments
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 5th Nov 2013 00:05
Okay. I should have figured it was the dropped [ and ] when I saw the display was partially in italics.

I just tested a very simple bit of code and verified that Android and iOS are both totally cool with opening a file with no extension. So that isn't the problem.

But I recently found out that AppGameKit as built under Xcode 5 will not recognize a file for input if it has a '.bin' extension. I had to change my code (both level editor and game) to use '.dat' instead and then rename all the existing files before the app, that had worked perfectly when built in Xcode 4, would work with Xcode 5.

The only thing I can think of is that your Player version is not the same as your AppGameKit IDE version.

Have you verified (by looking at the AGK.txt file in your AppGameKit directory) that you are using v10819? And have you tried uninstalling the Player and redownloading it from the Google Play Store to make sure that you have the most recent version?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Captain Ouais
20
Years of Service
User Offline
Joined: 12th Dec 2003
Location: France
Posted: 5th Nov 2013 09:16
Hello,

I'm so sorry, it was actually a problem version
I had not seen the latest version of October 2013
I'll dig a hole and throw me in for some time !
thank you very much for your help both of you!


good day!!!!

I do what i do !!!
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 5th Nov 2013 10:15
ok,that's fine.
have a nice day too

AGK 108 B19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 5th Nov 2013 15:07
I am just glad you worked it out.

Happy Programming!

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Captain Ouais
20
Years of Service
User Offline
Joined: 12th Dec 2003
Location: France
Posted: 5th Nov 2013 22:38
thx

I do what i do !!!

Login to post a reply

Server time is: 2024-11-24 21:38:31
Your offset time is: 2024-11-24 21:38:31