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 / TGC's AGK Tier 1 Android Tutorial for Windows [beta]

Author
Message
GasiusGames
12
Years of Service
User Offline
Joined: 8th Mar 2012
Location:
Posted: 15th May 2012 18:32
Woopee, thanks Lee, I cant wait.
payopepe
15
Years of Service
User Offline
Joined: 10th Aug 2008
Location: Spain
Posted: 16th May 2012 15:53
Hello, I upgraded to 1.0.7.4 but to make the process always compiles the AppGameKit PLAYER, not take the "bytecode" personalized.

I can not compile my own creations, always creates the AppGameKit PLAYER

Is there any change in the method described here to this latest version?

Thank you!
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 16th May 2012 16:04
Hi, you will need to make sure you add a MEDIA folder in your resources. We tried it without the media folder for T1 compilations, but this created inconsistency with the Windows method. It is also much cleaner to add the whole MEDIA folder in one go into your Resources area rather than all the individual media files which is a pain to extract. Your T1 interpreter app will then find the bytecode.byc file inside the Resources\Media\bytecode.byc.

I drink tea, and in my spare time I write software.
GasiusGames
12
Years of Service
User Offline
Joined: 8th Mar 2012
Location:
Posted: 16th May 2012 16:32
Hi Lee,
According to the documentation everything is supposed to be in the assets folder, there is no mention of creating a media folder.
It says take everythng from the media folder and place it into the assetts folder.
My Question... Are we supposed to also create a media folder as well?
payopepe
15
Years of Service
User Offline
Joined: 10th Aug 2008
Location: Spain
Posted: 16th May 2012 16:50
Hi Lee, thanks for your answer.

But I do it well, because so far everything worked OK until I updated to 1074, that I can not compile my projects, I always believe the AppGameKit PLAYER.

The problem must be the change in the "interpreter.cpp" when I remove the "//" to Ide_Android "strcpy ( g_pInterpreterByteCodeFile, "bytecode.byc" );"

The same process with version 1072 and 1073 works ok, but not the 1074. Are there any changes regarding the change in "interpreter.cpp"?

Thank you very much.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 16th May 2012 16:52 Edited at: 16th May 2012 16:53
1. For Android, it is the 'assets' directory
2. Did you edit the IDE/apps/interpreter/interpreter.cpp file to uncomment the strcpy line (search for IDE_ANDROID)?

That is the line for android that uses your bytecode.
3. Copy and rename the bytecode file (<yourapp>.byc) in the media project directory, something like this in the cygwin window:


Also remember to copy all the files from your media directory that your app uses (.png, .jpg, .txt, .wav, etc.).

Cheers,
Ancient Lady
payopepe
15
Years of Service
User Offline
Joined: 10th Aug 2008
Location: Spain
Posted: 16th May 2012 17:08
see attached picture where I do it well. In the other version works Ok, but since I updated to 1074 has stopped working.

Thank you.

Attachments

Login to view attachments
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 16th May 2012 17:25
What happens if you put the bytecode in assets/media/bytecode.byc
payopepe
15
Years of Service
User Offline
Joined: 10th Aug 2008
Location: Spain
Posted: 16th May 2012 17:28 Edited at: 16th May 2012 18:12
I've tried, I also thought that this could be the problem, but does not work.


EDIT:

Now I've deleted everything and started again with the previous version, 1073, to see if it works.

EDIT2:

Confirmed, I'm back to 1073 and everything works ok,

It is a problem with the 1074 version


EDIT3:

Now I copied the files from the version 1073 /AGK/IDE... in the / Android/AGK...

And it works OK.

I guess the version 1074 (AGK/IDE/...) should not copy it to /Android/AGK/... because if I do not work.



Thank you.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 16th May 2012 21:11 Edited at: 3rd Jun 2012 02:49
As a preface, my Windows setup is installed in C:\TGC\AGK and my Android NDK is installed in C:\Android\android-ndk, instead of the path described in the guides.

I ran these steps in cygwin after using the 1074 installer to update AGK:


And I edited the interpreter.cpp file to make it use the bytecode.byc file.

Then I cleaned and rebuilt my app, fired up Eclipse, refreshed the project and ran it on my Android device. Nice and clean and it worked.

EDIT: It turns out that I was wrong, it is necessary to put the media file under assets, as instructed.

Cheers,
Ancient Lady
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 17th May 2012 01:18
Hi Guys,

Bear in mind what we added for 1074 in interpreter.cpp:

void app::Begin( void )
{
// 110512 - build 1073 - Windows sets the MEDIA folder on winmain (T1 default)
// but IOS, MAC and other platforms have no internal MEDIA folder, which then
// creates a functional difference when you code SetCurrentDir("") : SetCurrentDir("media")
// so the T1 interpreter will Create and Enter a Media folder if one does not exist
// T1 BASIC uses a fixed MEDIA folder
#ifndef AGKWINDOWS
agk::MakeFolder ( "media" );
agk::SetCurrentDir ( "media" );
#endif

...

This means ALL interpreter platforms will now expect a media folder in order to find the bytecode.byc file and all the media files. It works out much cleaner across the various project scenarios, and it is consistent with the way the Windows platform works too. If you preferred the way it worked before, you simply have to comment out the above additions and recompile the interpreter player lib and then rebuild your Android package.

I drink tea, and in my spare time I write software.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 17th May 2012 01:45
Making iOS and Android use a 'media' folder now should probably be mentioned as a new thread stickied so that everyone will get the new information.

Cheers,
Ancient Lady
Impetus73
12
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 17th May 2012 12:15
I tried to compile an android project with a media folder instead of the assets folder, it did not work, only the player worked. What DID work however, was if I added the media folder inside the assets folder.

So to clarify, place all your media in a media folder inside the assets folder.

An example from my game:

C:\Android\AGK\IDE\apps\MidnightHorror\assets\media

Now it compiles and works right!

----------------
AGK user - novice
Did Amiga / AMOS programming in the 90's, just started programming again with AGK.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 17th May 2012 17:00 Edited at: 5th Jun 2012 18:49
I was able to get it working by just renaming my assets folder to media, cleaning, building, eclipse refresh and run.

EDIT: As mentioned in a later post, this does not work. You need to add the media directory under assets and put everything in that.

Cheers,
Ancient Lady
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 18th May 2012 22:06
That's a neat option, did not think of that

I drink tea, and in my spare time I write software.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 18th May 2012 22:48
I like simple solutions.

Cheers,
Ancient Lady
Uechi
17
Years of Service
User Offline
Joined: 2nd Sep 2006
Location:
Posted: 3rd Jun 2012 02:22
I had a problem when trying to run on my tablet. So I made a media folder as suggested etc. But now when I do the cygwin step typing in the command lines I don't get the compile steps, just the two install steps so I don't seem to get the new version. How do I get cygwin to compile again as it did the first time.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 3rd Jun 2012 02:49
Since my last post (and I should have edited it), I discovered that just renaming the assets file to media does NOT work.

You need to create a media directory under the assets one.

The compile should still work, as long as you make sure that you updated all the AppGameKit files in your android path to be the same as the version you use for your AppGameKit IDE.

Also, the bytecode file goes in the assets/media directory.

And, it helps to explicitly state the directory when loading files in it, like 'LoadImage("/media/myfile.png")'. The leading '/' makes sure that the correct directory is picked up. Even thought it is under the assets directory.

Did you do a make clean before recompiling?

And, if you updated the basic AppGameKit files, did you remember to re-edit IDE/apps/interpreter/interpreter.cpp to uncomment the line to use the bytecode file? Make sure to do the one after "#ifdef IDE_ANDROID", that is the only one that affects the build.

Cheers,
Ancient Lady
Uechi
17
Years of Service
User Offline
Joined: 2nd Sep 2006
Location:
Posted: 3rd Jun 2012 02:57 Edited at: 3rd Jun 2012 04:05
how and where do I do the make clean before recompiling. I think I have done all the other things I am supposed to do. I do have an assets/media folder with the bytecode in the media directory but the compile only showed install commands not compile commands - does the make clean take care of this? Thanks for the help.

I managed to do a clean then redid the compile and made the apk file which I copied to my tablet. I installed it and then ran it but all I got was the AppGameKit Player standby screen which I had deleted from the tablet earlier. I do have the standalone line edited taking out the // so I don't know why the player showed and my app didn't run.
Uechi
17
Years of Service
User Offline
Joined: 2nd Sep 2006
Location:
Posted: 4th Jun 2012 16:58
I was finally able to get my app to my tablet. Thanks to all who helped and for the excellent guide.
Uechi
17
Years of Service
User Offline
Joined: 2nd Sep 2006
Location:
Posted: 5th Jun 2012 18:00
I followed the same procedure for a second app as I did for my first successful one, but all I get is the app player when I try to run it on my tablet. I got a successful compile using cygwin and created a new apk with eclipse and I have the media and the bytecode.byc in the right folders. Is there any way I can get an idea what the problem is? It runs fine when I do a compile and broadcast in windows. I don't know where to go from here.
GasiusGames
12
Years of Service
User Offline
Joined: 8th Mar 2012
Location:
Posted: 5th Jun 2012 18:22
@Uechi - I have found the following and what works for me

If you are using the 1075 build, there is a bug in the engine if you are using the following line of code, regardless of the parameters you use.

SetOrientationAllowed(0,0,1,1)

Remove this line, compile your eclipse project and re-deploy.


@Lee - SetOrientationAllowed forces the app to exit after about 3 seconds

NB.
1. When you compile your app in the AppGameKit, be sure and run it as well, before copying your assets, or your bytecode will not reflect your changes
2. Your assets must be in the assets\media folder
3. Be sure and clean your project with a recompile inside ecplise
Uechi
17
Years of Service
User Offline
Joined: 2nd Sep 2006
Location:
Posted: 5th Jun 2012 18:33
@GasiusGames
I do not use that line of code
I did recompile and run before I moved media to assets
my assets are in the assets\media folder
I did a clean before the run inside eclipse

This is why I don't understand what is wrong- I would have at least liked some kind of error code or something instead of just the agk player showing
GasiusGames
12
Years of Service
User Offline
Joined: 8th Mar 2012
Location:
Posted: 5th Jun 2012 18:49
@Uechi, I know what you mean, its hard finding the specific problem.

Here's what I did, I compiled one of the standard samples and placed those assets and bytecode.byc file into my eclipse project, I then compiled and made sure it worked first. Once I got that working I took my game and started with small baby steps. Broke it down into pieces and compiled and ran until I found the line that was a problem.

I had the exact same problems as you, what I did notice is, I cleaned out the AppGameKit folder and installed the 1.06 version and then installed the lastest version of 1075 over it (I think there is 2, 1075 versions uploaded, get the latest), this made a difference. When I originally installed 1074, I had to remove the existing AppGameKit, and installing the 1075 by itself did not work.

My Advice, get a sample working and then take you game and break it down. Its seriously tiring but it worked for me.

Further to that (if SetOrientationAllowed is not working for you)
Iyou need to force your game to landscape use the following fix for now,
change this line in your AndroidManifest.xml file
from...
android:screenOrientation="fullSensor"
to...
android:screenOrientation="landscape"
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 5th Jun 2012 18:51 Edited at: 5th Jun 2012 18:53
Uechi, I just posted my updated scripts for making sure I have all the correct files in the correct places when I update/change AppGameKit versions. Also included are example of how to clean your app before you build it.
http://forum.thegamecreators.com/?m=forum_view&t=196649&b=41

AGK 1075 uses native bits to handle orientation. But we discovered that some devices don't behave quite the same. I worked with AGK's Developer Paul to fix the problem and it should show up in 1076. ( http://forum.thegamecreators.com/?m=forum_view&t=197143&b=41&p=1).

Cheers,
Ancient Lady
GasiusGames
12
Years of Service
User Offline
Joined: 8th Mar 2012
Location:
Posted: 5th Jun 2012 18:51
Sorry, I think I should mention SetOrientationAllowed problem is only on my Galaxy 10.1 and the Acer Icona, my HTC phone works fine.

I dont know if it affects any other devices.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 5th Jun 2012 18:56
GasiusGames, I just updated my post with a bit of information about Android orientation issues.

My Android device, a Vizio VTAB1008 reports itself to be a tablet, but the accelerometer acts like a phone.

Paul figured out what needed to be done to fix it (I was happy to test anything he suggested) and it should show up in 1076.

Sadly, I've discovered that 1075 has orientation stability issues with iOS. It flips when it shouldn't.

Cheers,
Ancient Lady
GasiusGames
12
Years of Service
User Offline
Joined: 8th Mar 2012
Location:
Posted: 5th Jun 2012 19:02
@Ancient Lady
Have you tried this setting
from...
android:screenOrientation="fullSensor"
to...
android:screenOrientation="lanscape"
or...
android:screenOrientation="portrait"

thos should stop your device from wanting to flip when the orientation flips?
GasiusGames
12
Years of Service
User Offline
Joined: 8th Mar 2012
Location:
Posted: 5th Jun 2012 19:03
opps, to fast there.

Do you have the equivalent options on IOS
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 5th Jun 2012 19:14
In Xcode, you can specify the allowed orientations explicitly. And I do.

And in 1074, those settings plus SetOrientationAllowed(0,0,1,0) worked just fine.

In 1075, which is now using native code for handling the orientation, it does not work.

I tried creating a simple Tier2 app to show the values for a function being called "agk::CanOrientationChange". Unfortunately, I cannot get any Tier2 stuff to compile in Xcode. I've posted this elsewhere.

Cheers,
Ancient Lady
GasiusGames
12
Years of Service
User Offline
Joined: 8th Mar 2012
Location:
Posted: 5th Jun 2012 19:18
Yip thats pretty much my findings as well.
I guess we need to wait for 1076, at least I can get it compiled and deployed now, I have been struggling since 1075 came out.
Uechi
17
Years of Service
User Offline
Joined: 2nd Sep 2006
Location:
Posted: 6th Jun 2012 03:52
I uninstalled everything and started all over. However, when I get to installing Eclipse step 1.4.19 in the guide says I will get a "Welcome to Android" screen when I do a 'restart now'. I don't get this and I don't know why not. I followed the guide up to that point. So this means I don't get to say to use the existing sdk - maybe this is causing a problem later. Any suggestions?
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 6th Jun 2012 06:24
Quote: "when I get to installing Eclipse step 1.4.19 in the guide"


What guide are you using that has these step numbers?

Cheers,
Ancient Lady
Uechi
17
Years of Service
User Offline
Joined: 2nd Sep 2006
Location:
Posted: 6th Jun 2012 06:32
the android tutorial guide for tier one
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 6th Jun 2012 17:26
Very strange, I see no step numbers or the phrase "Welcome to Android" in the AppGameKit Tier1 Android Guide found here: http://www.appgamekit.com/documentation/guides/33_android.htm

But it doesn't sound like a critical statement. I know when I did some Eclipse updates and it said I should restart, when I clicked the button, Eclipse closed but did not reopen. So I manually opened it and continued.

You probably did not need to uninstall/reinstall everything. Changes in AppGameKit have no impact on the Android and Eclipse setups, only on the AppGameKit specific directories/files.

Cheers,
Ancient Lady
Uechi
17
Years of Service
User Offline
Joined: 2nd Sep 2006
Location:
Posted: 6th Jun 2012 21:52
I am talking about the tutorial that is the subject of this thread.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 6th Jun 2012 23:33
Okay, I forgot what got the thread started.

When I did the installation, I never got the "Welcome to Android Development" message. And, as I said, when I did the restart, Eclipse didn't restart.

If you continue with the draft tutorial, when you get to step 3.2, you need to copy the media folder to a media folder under the assets folder. As of v107x, all platforms expect a media directory to contain the bytecode file and media files.

Cheers,
Ancient Lady
Uechi
17
Years of Service
User Offline
Joined: 2nd Sep 2006
Location:
Posted: 7th Jun 2012 03:33
I have re-installed everything,created the app player, then followed the directions for my new app. I can see that the .cpp file says to run standalone and I changed the .h file to add the define for standalone. I have changed my app to only be a text message of "Hello World" but when I run I get the AppGameKit Player and not the app. I don't know whatelse to do to get it to run standalone so I can add to my app. Sometimes when I compile using cgywin I don't see the interpreter-cpp file listed but I don't know if that means it isn't using it. I guess I am amazed that somehow I got my first app installed a couple days ago. Can anyone help?
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 7th Jun 2012 04:11
You made sure to put a media directory under the assets directory and that is where you put the bytecode.byc file (the renamed <yourapp>.byc built by the AppGameKit IDE).

Correct?

Cheers,
Ancient Lady
Uechi
17
Years of Service
User Offline
Joined: 2nd Sep 2006
Location:
Posted: 7th Jun 2012 05:30
@ancientlady. That is correct.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 7th Jun 2012 17:19
For android, adding '#define STANDALONE' does not do the trick.

You need to uncomment the line that uses the bytecode.byc file after the '#ifdef IDE_ANDROID'. You should find it at line 255.

Cheers,
Ancient Lady
Uechi
17
Years of Service
User Offline
Joined: 2nd Sep 2006
Location:
Posted: 7th Jun 2012 18:46
@Ancient Lady I did that as well
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 7th Jun 2012 19:27
Okay. I'm stumped.

I'd need to sit and look at your computer and code, etc. to try to figure it out.

Since that is unlikely to happen, I'm sorry, I can't offer any other suggestions right now.

I'll assume that you uninstall the app on your Android device in between tests.

Cheers,
Ancient Lady
GasiusGames
12
Years of Service
User Offline
Joined: 8th Mar 2012
Location:
Posted: 12th Jun 2012 21:06
1076 - Feedback
Compile AGK_Player - Fixed and working on Android and iPad
Wireless works on both, scaling on iPad sucks
SetOrientationAllowed - Fixed and working
assets\media - is the correct location for assets

Issues - maybe old, but still exists
SpriteAnimations do not scale correctly, image is replicated 2x2
and skips a frame, I will test some more
fallen one
17
Years of Service
User Offline
Joined: 7th Aug 2006
Location: My imagination!
Posted: 14th Jun 2012 23:22 Edited at: 15th Jun 2012 15:27
This had a video in the post thats vanished. Here it is again.
https://docs.google.com/file/d/0BxBsohXdxKEOZm9zcmw3Ui1DX1U/edit?pli=1
This video is better though, show dont tell. Though it was nice to learn what I was actually downloading and what it does with the official AppGameKit vid.
http://www.youtube.com/watch?v=3iJzC5uMfC4
The above is for mac, but you can see a lot of the steps. The TGC one is more of an overview, so watch that one first, then the one I post above, as that shows you. But ts not all the steps, so then look at the pdf.


GasiusGames
12
Years of Service
User Offline
Joined: 8th Mar 2012
Location:
Posted: 15th Jun 2012 11:44
1076 - Issues (Android)
AGKSplash.png must be in the assets folder and not in the assets/media folder

AnimatedSprite is still a problem, getting 4 images instead of 1
GasiusGames
12
Years of Service
User Offline
Joined: 8th Mar 2012
Location:
Posted: 15th Jun 2012 13:03
1076 - Issues (Android)
AnimatedSprite - Scaled the spritesheet to half its original size and then the animatedsprite plays fine, seems there maybe a limitation on the size of the in memory spritesheet

Login to post a reply

Server time is: 2024-04-28 14:45:38
Your offset time is: 2024-04-28 14:45:38