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 / AppGameKit for Java & Kotlin

Author
Message
Hockeykid
DBPro Tool Maker
16
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 3rd Jul 2018 22:41 Edited at: 3rd Jul 2018 22:44
App Game Kit for Java and Kotlin is here!

Now you can utilize the power of App Game Kit with the flexibility of Java or Kotlin. Java/Kotlin offer the perfect alternative to Tier 1 due to the simple yet very powerful and versatile syntax.

Here a just a few of the Benefits
Object Oriented Programming
Java & Kotlin are built around OOP using modern and well known concepts such as Classes, Interfaces, Inheritance, etc. These allow for clean, elegant, and organized code that is both reusable and extensible
Vast Libraries
Java & Kotlin have a wide range of both 1st party and 3rd party libraries that can add lots of functionality from basic Data Structures (Queues, Linked Lists, HashMaps, etc) all the way to libraries for Gesture Recognition, Digital Signal Processing, etc.
User Interface
Want to make a desktop tool in AppGameKit? Kotlin & Java have plenty of different libraries for UI like JavaFX, AWT, or Java Swing which will work alongside AGK.

Supported Platforms
Windows
Linux

Future Platforms
Mac OSX
Android

Getting Started
To use AppGameKit for Java or Kotlin you will need the following:
Java Development Kit
The latest version of the JDK can be downloaded here: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Your Favorite Java IDE
Java & Kotlin have tons of Integrated Development Environment (IDEs) avaliable and you can use whichever one you want

Below are two recommendations
Netbeans (Simple and full-featured Java IDE): https://netbeans.org/downloads/

Intellij (Best for Kotlin, works for Java too): https://www.jetbrains.com/idea/download/

Once you have downloaded and installed the JDK and your IDE of choice you can download the ZIP file attached to this post. The ZIP file contains mainly 3 things:
AGK for Java Examples
AGK for Java Template
AGK for Kotlin Template


Using The Templates
Once you have unzipped the provided ZIP file, there will be two folders: NetBeansProjects and IntelliJ projects (If you are using a different Java IDE then converting the templates should be simple). Each of these folders contain a "JavaTemplate" (the IntelliJ folder also includes "KotlinTemplate").

Open the JavaTemplate in either NetBeans or IntelliJ. Inside of the "src/main" folder you will find "AGKMain.java" This is where your code will go (ignore the "com/thegamecreators/agk" folder).

You should see the following methods:

public void begin()

This is where all the code to setup your app should go. Things like Loading images, creating sprites, sounds, resolution, etc

public void loop()

This is your main loop. Every frame, AppGameKit Java will call this loop() method and execute the code inside of it (which is why the template has AGKLib.Sync() in here).

public void complete()

This will be called when the application has been asked to close (user clicks the X on the window or maybe the OS asks the application to close). This is where you should cleanup all of your resources.

How to Call AppGameKit Functions
Calling AppGameKit functions is simple take any AppGameKit Function and prepend "AGKLib." to the front. For example AGKLib.CreateSprite(5) or AGKLib.LoadImage("Test.png") or AGKLib.CreateSprite(AGKLib.LoadImage(AGKLib.toAGKPath("Test.png"))) the only thing to note is that the case of the AppGameKit function does matter and must match the casing in the AppGameKit Documentation (https://www.appgamekit.com/documentation/search.html). Trying something like AGKLib.createsprite will not work.

The only caveat is when loading a resource file such as an image, sound, etc. You must call AGKLib.toAGKPath("myFile.png") first to convert the file path to one that will work with AGK. For example:

AGKLib.LoadImage(AGKLib.toAGKPath("Test.png"))

or

AGKLib.LoadSound(AGKLib.toAGKPath("chirp.wav"))


Testing the Template

Inside of the "loop()" method if you add: AGKLib.Print("Hello World") then go to the top of your IDE and hit "Run > Run Project" the project should run and you should see your "Hello World" message on the screen along with the "Screen FPS"


Example Code

Below is AGK's "3D-FirstPersonExample" converted to Java line by line (so not taking advantage of Java's powerful syntax):



Attachments

Login to view attachments
Tumira
8
Years of Service
User Offline
Joined: 28th Oct 2015
Location:
Posted: 4th Jul 2018 07:19
Can we use android studio and openjdk with this ? Without installing Java sdk?
Hockeykid
DBPro Tool Maker
16
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 4th Jul 2018 07:35
Quote: "Can we use android studio "


If you can setup a normal desktop Java project in Android Studio (I think you can) then yes, that will work. Or you could get IntelliJ if you want which is the IDE that Android Studio is based on.

Quote: "openjdk with this "


Yes, OpenJDK will work



Sean
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 4th Jul 2018 13:35
I'll check this out soon as I get a chance, probably with netbeans.

Why didn't you just call the begin() function main() instead? For java folks that just makes sense.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
krid
9
Years of Service
User Offline
Joined: 2nd Dec 2014
Location: Almaty / Kazakhstan
Posted: 4th Jul 2018 18:27
Guys! This is huge update! I was strugling with my UI lib, which is fully written in basic, and now you release this?! Awesome!

I have few questions:
1) Is everything works in a same way as if I wrote that code in basic? (I mean speed, bugs etc)
2) Is this kind *experiment release or it will be fully supported and I can switch to Java? (talking about longterm, bugs and news features , etc)
Hockeykid
DBPro Tool Maker
16
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 4th Jul 2018 19:36
Quote: "Why didn't you just call the begin() function main() instead? "


I was trying to keep consistent with Tier 2 naming (though "complete" is different)

Quote: "For java folks that just makes sense."


I wouldn't want AppGameKit Tier 1 users to try and write a persistent loop in the begin/main method.

Quote: "Is everything works in a same way as if I wrote that code in basic?"


Yes everything except speed. While I haven't done benchmarks, Java Virtual Machine is likely faster than AppGameKit Basic.

Quote: "s this kind *experiment release or it will be fully supported and I can switch to Java? "


It will be fully supported by me. But at the moment the agreement I have with TGC is that I use AppGameKit version 2018.06.22 so we are locked into that. Also keep in mind the supported platforms are different than AppGameKit Basic.


Sean
Hopelessdecoy
8
Years of Service
User Offline
Joined: 17th Apr 2016
Location:
Posted: 5th Jul 2018 01:57
Any way we could get an eclipse template version too? Not that I want to ask for too much more this is awesome!
KultiVator
9
Years of Service
User Offline
Joined: 2nd Jan 2015
Location: Sunny Northamptonshire
Posted: 5th Jul 2018 10:47 Edited at: 5th Jul 2018 10:58
Very interesting development... may I ask if we can use Kotlin to target Windows / Android / LLVM / etc from the same source code (e.g. in projects without any platform-specific stuff going on) ?

Best Regards,



Jon
( Aggravated > Constipated > Mutilated ) < KultiVated
Hockeykid
DBPro Tool Maker
16
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 6th Jul 2018 00:03
Update

Attached to the first post is a new ZIP with the correct libraries for Linux (accidentally included old non-functional Linux libraries).

Quote: "Any way we could get an eclipse template version too? Not that I want to ask for too much more this is awesome!"


I'm trying to avoid having a template for too many IDEs. It should be very simple to create an Eclipse template. Simply create a new Eclipse project, and then go into the Netbeans Template and copy the agk64.dll, libagk64.so (just updated the ZIP on the first post), the "src" folder, and the "media" folder into your new Eclipse project and it should all work.


Quote: "may I ask if we can use Kotlin to target Windows / Android / LLVM / etc from the same source code"


Yes, for all platforms you should be able to use the same source code. For all desktop targets you could even use all of Java's "platform" commands (like file access, Java FX, etc). Keep in mind this is Kotlin running under the JVM so you won't be able to target LLVM.


Sean
nonom
6
Years of Service
User Offline
Joined: 12th Nov 2017
Location: Picking mushrooms
Posted: 7th Jul 2018 11:49
Pretty interesting work congrats, It works for me

https://i.imgur.com/Nb51qxB.jpg
http://www.nyan.cat/pirate
Alebrije
10
Years of Service
User Offline
Joined: 27th May 2013
Location: Toluca
Posted: 8th Jul 2018 06:40
I successfully created the typical Hello World using Eclipse. I had to do minor changes but it works as expected. Great addition.
Classics games, modern wonders
rongzhilee
5
Years of Service
User Offline
Joined: 10th Jul 2018
Location:
Posted: 10th Jul 2018 23:57
Great!!!!!!!
ghostek
5
Years of Service
User Offline
Joined: 6th Jul 2018
Location:
Posted: 11th Jul 2018 09:26
So this is your c++ wrapper over API and exposed to java? If I am corret with this it will be possible to create c# wrapper using same technique, even calling methods from your library
Hockeykid
DBPro Tool Maker
16
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 12th Jul 2018 02:24
Quote: "If I am corret with this it will be possible to create c# wrapper using same technique,"


This already exists, MadBit created AGKSharp which you can find here: https://forum.thegamecreators.com/thread/222274
sarahjones
User Banned
Posted: 30th Jul 2018 20:58
I'm also looking foe AppGameKit for JAVA, but I couldn't find it when I searched it on Hotmail Support. If anybody has any suggestion, please let me know here.
THE_NOTORIOUS_PIGGY
7
Years of Service
User Offline
Joined: 17th Jun 2016
Location:
Posted: 31st Jul 2018 18:10
In college I am currently studying java, so this is an excellent alternative! Might switch from tier 1 to this java. Excellent work @hockeyKid, I hope that thegamecreators incorporate this as a full feature!
BenKenobi
5
Years of Service
User Offline
Joined: 11th Aug 2018
Location:
Posted: 12th Aug 2018 01:17 Edited at: 13th Aug 2018 19:17
First of all this is great, i started a new project in AppGameKit after hearing this got released and everything seems to running well, except that theres one problem, AGKLib.SetAntialiasMode( 1 ); doesn't seem to do anything.

This happened before with tier 2 C++ https://forum.thegamecreators.com/thread/217522. Unfortunately without anti aliasing 3D is of not much use to me. Im not sure how I am able to fix this with Java.

EDIT: found out the problem persists when compiling with C++

just needed to add the following line to 'cpp_library_folder/apps/template/Core.cpp'
glfwWindowHint(GLFW_SAMPLES,16);

you may want to recompile the library files with the anti aliasing enabled.
nickydemon
8
Years of Service
User Offline
Joined: 19th May 2015
Location:
Posted: 25th Aug 2018 14:00
Is it possible to export the game to android and IOS when write it in JAVA?
BlueGuardian
8
Years of Service
User Offline
Joined: 11th Jan 2016
Location:
Posted: 7th Oct 2018 13:31
Anyone have luck with porting this to run on Android device?
CodeTrasher
11
Years of Service
User Offline
Joined: 18th Jul 2012
Location: Tampere, Finland
Posted: 24th Oct 2018 11:02
Are those DLL and .so files created for this Java template particularly, or can they be used to build other bindings, as well? I may have interest to try and port AppGameKit to Go.
Mah machine: Intel Xeon E3-1231v3 4x3.40GHz | CM Hyper 212 Evo | ASRock H97 Pro4 | 240GB SanDisk SSD | Sapphire Radeon R9 270X Dual-X 2048MB | Seagate HDD 1000GB |
8GB Crucial Ballistix Sport DDR3-1600
Softwizz
14
Years of Service
User Offline
Joined: 14th May 2009
Location: U.K.
Posted: 23rd Nov 2018 18:18
32 bit version?
AlphaCeph
5
Years of Service
User Offline
Joined: 29th Sep 2018
Location:
Posted: 26th Nov 2018 15:08
When is the Android project coming ?
wasseydev
6
Years of Service
User Offline
Joined: 6th Dec 2017
Location:
Posted: 9th Jan 2019 18:21
Just want to give this project a thumbs up. Being able to use the same IDE across multiple platforms and having a powerful language (that isn't C++ lol) to complement the capabilities of AppGameKit is a blessing. Many thanks!
Jedive
21
Years of Service
User Offline
Joined: 24th Jan 2003
Location: Spain
Posted: 29th Jan 2019 09:43
This looks very interesting. Are there any examples on how to use it with JavaFX or other GUI toolkits?
== Jedive ==
MacBook Air Core 2 Duo 1.3Ghz, 4GB, 128GB SSD, HD Graphics 5000, Yosemite
Mac Mini Core 2 Duo 2.2Ghz, 4GB, 640GB HD, nVidia 9400, Yosemite, Win8.1 Pro
BlueGuardian
8
Years of Service
User Offline
Joined: 11th Jan 2016
Location:
Posted: 10th Apr 2019 02:35
With the release of AppGameKit Studio in the next couple of months - will this still be supported and will it be updated to include the latest fixes for AGK2?
Hockeykid
DBPro Tool Maker
16
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 16th Apr 2019 04:11
Quote: "With the release of AppGameKit Studio in the next couple of months - will this still be supported and will it be updated to include the latest fixes for AGK2?
"


I did play around with the idea of taking an AppGameKit Studio level and making a tool to convert it to Java. Haven't looked too much into it yet though.
Hopelessdecoy
8
Years of Service
User Offline
Joined: 17th Apr 2016
Location:
Posted: 20th Jun 2019 02:27
Is multi-threading possible with this? I'm getting a native method crash but a lot of solutions online are for JNI projects.
BlueGuardian
8
Years of Service
User Offline
Joined: 11th Jan 2016
Location:
Posted: 27th Aug 2019 21:54
Where does this project stand? Has it been updated to use the latest release/version of Classic AppGameKit or is it abandoned? It looks like only the Python extension gets regular releases. I'm working with Studio now, but would really like a Java Alternative outside of LIBGDX for true OOP.
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 12th Sep 2019 05:06
Would be nice, to see App Game Kit with C++, C#, Java, Kotlin, Python. So it gets even more spread and accessable.

Login to post a reply

Server time is: 2024-04-20 05:59:15
Your offset time is: 2024-04-20 05:59:15