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 and LLVM?

Author
Message
kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 7th Aug 2013 15:09 Edited at: 7th Aug 2013 17:44
Hi everyone,

The biggest blocker for me working with AppGameKit is the difficulty to create plugins in C++ and use them in both Tier 1 and Tier 2. I would like to propose a potential solution to this to the AppGameKit developers and get some feedback from the community

The difficulty with C++ plugins is that when C++ is compiled, usually it will only run on one platform and to run it on multiple platforms you usually have to build it individually for each one

A solution to this is to compile C++ code into a special instruction set called LLVM IR. LLVM IR can be converted into another architectures machine code at runtime, eliminating the need to recompile for every platform

Another advantage of LLVM is that you can add your own languages to it so the AppGameKit basic compiler can just use LLVM. This should improve speed greatly as LLVM will automatically optimise the code and convert it to machine code

Compiling both AppGameKit basic and C++ to LLVM IR gives another advantage which is the ability to easily mix the two so you can develop part of your game in Tier 1 and other parts in Tier 2 and they will work together. You would even be able to create plugins using basic and use them in Tier 2!

The biggest advantage of LLVM is its free, open source and can be embedded in commercial products for free. It is used in Emscripten to compile C++ code into javascript so it can be run on the web. It is also what PNaCl uses to get the same code running on different architectures at native speed. And LLVM is the standard C++ compiler used in XCode for compiling to Mac OS X/iOS so techinically, you are already using it!

Heres some links:
http://llvm.org/
http://en.wikipedia.org/wiki/LLVM
http://www.drdobbs.com/architecture-and-design/the-design-of-llvm/240001128
http://llvm.org/docs/tutorial/index.html

kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 7th Aug 2013 16:32 Edited at: 7th Aug 2013 16:35
To help describe my idea. I quickly whipped up a couple of flow charts to show how games (fig 1) and plugins (fig 2) could be compiled with LLVM then linked together to make a final game binary in LLVM IR. This game binary would then be converted into the target architecture and linked with a platform specific runtime library to create the app

I have highlighted all the bits that the AppGameKit developers would have to write in yellow

As you can see, the AppGameKit library (the bit that gives you all your commands) could be implemented as a set of plugins!


Thats all I'm going to say about this idea now. It'll probably get thrown away for some reason but at least I tried!

Attachments

Login to view attachments
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 7th Aug 2013 16:59
This looks interesting, do you know of any resources about using LLVM code to access Apple or Android APIs? As one purpose of plugins would be to provide device functionality that may not be in the core AppGameKit library.
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 8th Aug 2013 09:07
Embarcadero are using LLVM for the iOS compiler for Delphi/C++ XE4

That enables the compilation of executables without needing XCode. It's certainly a VERY interesting route.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
Hockeykid
DBPro Tool Maker
17
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 9th Aug 2013 07:02
Quote: "That enables the compilation of executables without needing XCode. It's certainly a VERY interesting rout"


That would be quite cool.

Sean

kamac
13
Years of Service
User Offline
Joined: 30th Nov 2010
Location: Poland
Posted: 10th Aug 2013 14:20
Nifty, LLVM is a wonderful thing. I hope that this idea can go through.

Follow me on twitter! @MotionStruct
Motion Struct blog
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 10th Aug 2013 14:45
Actually, XCode is needed for provisioning and publication. Nothing is effortless.

Video here of setting up XE4 for Mac and iOS development:

http://www.youtube.com/watch?v=0HnPgQgb6Ao

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
kamac
13
Years of Service
User Offline
Joined: 30th Nov 2010
Location: Poland
Posted: 10th Aug 2013 15:34
Oh, it seems that you might then try to get to run LLVM bytecode on the web, by using emscripten. Might be possible, but I've got no idea, actually.

Follow me on twitter! @MotionStruct
Motion Struct blog
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 10th Aug 2013 16:48
Compiling's not a problem. Uploading to Apple's anally-retentive ecosystem is!

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL

Login to post a reply

Server time is: 2024-11-24 17:44:27
Your offset time is: 2024-11-24 17:44:27