Glider configurations

I am interested in learning more about the configurations section of 1.9 Glider.  Is there document I can read that will explain some use cases and which goals the product attempts to achieve? I would like to scan those use cases to see if mine matches.

Below, are two examples of use cases I am faced with while building my game. 

Case 1 - Managing graphics assets for PAD and PHONE build configurations 

  1. I have a project that is a game that uses two basic sizes of artwork. PAD and PHONE sized artwork. 
  2. I want to be able to build my target configuration pushing out my artwork for the appropriate config. i.e. For phone, I want the phone artwork subdirectory tree, and for iPad, I want the pad geometry tree. I dont want to duplicate the artwork in the output directory by having both sets get copied out. I plan to support each separately. 
  3. I read on the forums you support scripting, but I cannot find any information about how this is done, or any examples to learn from. Nor can I find any examples of how the configurations feature is intended. Some clear examples would be super.
  4. All the code and graphics are checked into GIT. So everything - code - sound - graphics are in a project structure under my main directory.

Case 2 - Monetization requires different build.settings files for different configurations

  1. I want to monetize. So I have to build for Android and IOS. 
  2. The build.settings needs to be different for Android and IOS because for Android, I cannot have the iAds plugin in build.settings. It wont build if I call out that plugin. 
  3. So given the need for different build.settings files depending on which configuration I select, how can I make sure only my targeted build.settings file gets sent to the output directory?

Please advise on ways I could possibly achieve these two cases with Glider. In a pinch, I can just push my files to an output directory myself with a shell script, but it would be sweet to use the Glider configurations for this task to keep things integrated. I also push all my code to a remote repo, and then do my development on both PC and MAC. So a script solution may not play common for PC and MAC. 

Thanks!

Paul

TamaracApps

I would like to know more about this as well. Been using Glider for a while now but have not had much chance getting the most out of its advanced features. Its about time we get more documentation and updated tutorials. Thanks!!!

Hello Everyone,

Here is a working copy of the Glider documentation. 

www.mydevelopersgames.com/LuaGlider.pdf

It talks about project management, scripting, and targeted building.

Regards,

M.Y. Developers

Great!!! Thanks much for finding the time to do this. I am sure it will be most useful for all of us. 

Hi,

I have been experimenting with making my own behaviors in the plugins directory for glider, and I have a cross platform question. I am trying to build a simple directory listing tool that gets all the files from a local directory, and then scrapes the files I want out and copies them to the correct location. This is in effort to accomplish the CASE 1 listed above in the original post. 

I built this little code that seems to work pretty well for MAC, but I dont see how to get things working for a similar functionality on PC. In fact, I seem to have trouble getting anything file related to work with the PC plugin system. Here is my code that scans a directory passed in and returns a list of files but omits files beginning with a “.” period character. :

-- scan files finding all but files with . as first character function scandirMac(directory)     --print("scandir searching ",directory)     local i, t, popen = 0, {}, io.popen     for filename in popen('ls -a '..directory):lines() do         m = string.match(filename, '^[.\*]')         if  m==nil  then             i = i + 1             t[i] = filename         end     end     return t end

But the same type of code wont work on PC. I dont seem to be able to get popen to work, nor can I seem to get file related functions working with os.execute. I was wondering if you guys can give a few cross platform examples of file manipulation plugins that may show off some features you do have access to from LUA as Glider has it implemented. For example, I seem unable to require any of the common file manipulation libraries. So I guess without knowing what is available, I am a bit in the dark. Can you guys help with some example code for :

1.) directory listing  (MAC AND PC)

2.) file copy (MAC AND PC)

Thanks much,

Paul Christensen

Tamarac Apps

Hello Paul,

You could actually achieve everything you want without writing a Glider plugin. The asset manager is great for this kind of stuff and it was designed to handle it.  Please download the example project:

www.mydevelopersgames.com/asset_demo.zip

  1. Inside you will find a folder called “my_app.” Please open this folder inside Glider.

  2. Right click on the project in the projects view -> Set configuration-> customize

  3. the screen should look like this:

http://view.xscreenshot.com/3a2a5aa6c1b7f78aaaa550895361391b

  1. Click on the edit button to view a configuration

http://view.xscreenshot.com/3d632517941a54729639d6dc159e04d0

  1. Also check out the “Code Insertion” feature.

http://view.xscreenshot.com/7d183d7d00138292244867f37595a534

  1. Click the debug button. You will notice that even though the images are not in the my_app folder, the correct image still displays in the simulator.

Btw please keep in mind that everything you see in the configuration properties panel is tied to a specific configuration and you can keep things versioned this way. 

You can easily switch the configuration via step (1) and you can “build all” configurations with the build all button. This will create all your configurations in separate folders. Also please note that for all this to work you will have to refactor the changeable assets (ig artwork, sounds, icons) into separate folders. 

Regards,

M.Y. Developers

Hi M.Y.

I agree completely after looking over this information in more detail. I see better how to create configurations that will allow me to do all the things I need. 

I think the big thing was my project was not built with this type of structure in mind, and so I had to perform a reorganization of where my assets were. It turned out OK because I really had some messy structure that benefitted from doing this anyway. 

The missing link for me was the configurations doc just didn’t give enough info. Especially wrt. the way libraries can be placed in the target location but renamed to fit the target needs. This was a breakthrough for my use of the configurations. 

Thanks for the info and the samples.

PS: Can you provide any background on the plugins issue I was looking at in the above post? I would like to better understand how this capability works, and what is available to me as a plugin programmer. 

Regards,

Paul Christensen

Tamarac Apps

Hello Paul,

Great it is working for you. Are there any confusing terms that you feel might be clearer if we changed? “Configurations” might not have been the best word to describe what they actually are. 

Plugins are best used when you want to fire off a command line program during the build process. Function callbacks inside plugin.lua (eg preBuildRelease, preBuildDebug, postBuildRelease, etc) will be called when Glider is about to execute that phase of the build cycle. So when you click on the run or debug button these are the steps:

preBuildDebug -> postBuildDebug -> getLaunchCommandDebug -> postSDKLaunch -> SDKConnectionMade -> SDKClosing

The most basic Glider plugin looks something like this:

--plugin.lua function getPluginInfo() print(super) local response = { name = "CoronaExtension", version = 1.0, order = 500, options = { }, extends = "corona" --Important to get the simulator to launch } return response end function preBuildRelease(args) print("Corona Extension preBuildRelease") return { cmd = { "/path/to/command/executable", "arg1", "arg2" } } end --Other plugin callbacks here
  1. Help -> user directory

  2. Open the UserPlugins folder

  3. Create a folder called “myPlugin” (name does not matter) 

  4. Create a file called “plugin.lua” and paste the contents above into there

Next when you open up the options panel you should see your plugin present:

http://view.xscreenshot.com/7a54da4492588d0a7364ffcdc31dab35

Plugins can also have global options as well as configuration specific options. Please see the Marmalade plugin.lua to see how to do that.

You can activate plugins on a global level by setting it as default in the options panel above. Or you can use it in specific projects like this:

http://view.xscreenshot.com/99981bbb003fdc93ac66b42c523203e8

Please be aware that you should not do too much work inside the plugin.lua itself. Although it is a lua engine you may need to use lua java bindings to do things like file listings (b/c lua has no native file listing capability.) The plugin engine was really designed to be a springboard to launch other specialized command line tools. 

Here is an example taken from the marmalade plugin that finds a .mkb file in a given directory:

--- returns true of the string ends with a substring local function endsWith(String,End) return End=='' or string.sub(String,-string.len(End))==End end --- tries to find a .mkb file in a folder. This uses luajava bindings. local function scanFolderForMKB(folderPath) local folder = luajava.newInstance( "java.io.File", folderPath ) local files = folder:list() for i=1, files.length do local filename = files[i] if endsWith(filename,".mkb") then return folderPath .. "/" .. filename end end end

You should really write the plugin logic in any scripting language of your choice. You are given the plugin folder path in each function callback args so you can easily invoke a python script for example that does the heavy lifting. If you return a cmd table then Glider will execute the command and wait until the process finishes. 

Please let us know if you are considering using the plugin system, we can give you suggestions on the best way to put it together.

Regards,

M.Y. Developers

I would like to know more about this as well. Been using Glider for a while now but have not had much chance getting the most out of its advanced features. Its about time we get more documentation and updated tutorials. Thanks!!!

Hello Everyone,

Here is a working copy of the Glider documentation. 

www.mydevelopersgames.com/LuaGlider.pdf

It talks about project management, scripting, and targeted building.

Regards,

M.Y. Developers

Great!!! Thanks much for finding the time to do this. I am sure it will be most useful for all of us. 

Hi,

I have been experimenting with making my own behaviors in the plugins directory for glider, and I have a cross platform question. I am trying to build a simple directory listing tool that gets all the files from a local directory, and then scrapes the files I want out and copies them to the correct location. This is in effort to accomplish the CASE 1 listed above in the original post. 

I built this little code that seems to work pretty well for MAC, but I dont see how to get things working for a similar functionality on PC. In fact, I seem to have trouble getting anything file related to work with the PC plugin system. Here is my code that scans a directory passed in and returns a list of files but omits files beginning with a “.” period character. :

-- scan files finding all but files with . as first character function scandirMac(directory)     --print("scandir searching ",directory)     local i, t, popen = 0, {}, io.popen     for filename in popen('ls -a '..directory):lines() do         m = string.match(filename, '^[.\*]')         if  m==nil  then             i = i + 1             t[i] = filename         end     end     return t end

But the same type of code wont work on PC. I dont seem to be able to get popen to work, nor can I seem to get file related functions working with os.execute. I was wondering if you guys can give a few cross platform examples of file manipulation plugins that may show off some features you do have access to from LUA as Glider has it implemented. For example, I seem unable to require any of the common file manipulation libraries. So I guess without knowing what is available, I am a bit in the dark. Can you guys help with some example code for :

1.) directory listing  (MAC AND PC)

2.) file copy (MAC AND PC)

Thanks much,

Paul Christensen

Tamarac Apps

Hello Paul,

You could actually achieve everything you want without writing a Glider plugin. The asset manager is great for this kind of stuff and it was designed to handle it.  Please download the example project:

www.mydevelopersgames.com/asset_demo.zip

  1. Inside you will find a folder called “my_app.” Please open this folder inside Glider.

  2. Right click on the project in the projects view -> Set configuration-> customize

  3. the screen should look like this:

http://view.xscreenshot.com/3a2a5aa6c1b7f78aaaa550895361391b

  1. Click on the edit button to view a configuration

http://view.xscreenshot.com/3d632517941a54729639d6dc159e04d0

  1. Also check out the “Code Insertion” feature.

http://view.xscreenshot.com/7d183d7d00138292244867f37595a534

  1. Click the debug button. You will notice that even though the images are not in the my_app folder, the correct image still displays in the simulator.

Btw please keep in mind that everything you see in the configuration properties panel is tied to a specific configuration and you can keep things versioned this way. 

You can easily switch the configuration via step (1) and you can “build all” configurations with the build all button. This will create all your configurations in separate folders. Also please note that for all this to work you will have to refactor the changeable assets (ig artwork, sounds, icons) into separate folders. 

Regards,

M.Y. Developers

Hi M.Y.

I agree completely after looking over this information in more detail. I see better how to create configurations that will allow me to do all the things I need. 

I think the big thing was my project was not built with this type of structure in mind, and so I had to perform a reorganization of where my assets were. It turned out OK because I really had some messy structure that benefitted from doing this anyway. 

The missing link for me was the configurations doc just didn’t give enough info. Especially wrt. the way libraries can be placed in the target location but renamed to fit the target needs. This was a breakthrough for my use of the configurations. 

Thanks for the info and the samples.

PS: Can you provide any background on the plugins issue I was looking at in the above post? I would like to better understand how this capability works, and what is available to me as a plugin programmer. 

Regards,

Paul Christensen

Tamarac Apps

Hello Paul,

Great it is working for you. Are there any confusing terms that you feel might be clearer if we changed? “Configurations” might not have been the best word to describe what they actually are. 

Plugins are best used when you want to fire off a command line program during the build process. Function callbacks inside plugin.lua (eg preBuildRelease, preBuildDebug, postBuildRelease, etc) will be called when Glider is about to execute that phase of the build cycle. So when you click on the run or debug button these are the steps:

preBuildDebug -> postBuildDebug -> getLaunchCommandDebug -> postSDKLaunch -> SDKConnectionMade -> SDKClosing

The most basic Glider plugin looks something like this:

--plugin.lua function getPluginInfo() print(super) local response = { name = "CoronaExtension", version = 1.0, order = 500, options = { }, extends = "corona" --Important to get the simulator to launch } return response end function preBuildRelease(args) print("Corona Extension preBuildRelease") return { cmd = { "/path/to/command/executable", "arg1", "arg2" } } end --Other plugin callbacks here
  1. Help -> user directory

  2. Open the UserPlugins folder

  3. Create a folder called “myPlugin” (name does not matter) 

  4. Create a file called “plugin.lua” and paste the contents above into there

Next when you open up the options panel you should see your plugin present:

http://view.xscreenshot.com/7a54da4492588d0a7364ffcdc31dab35

Plugins can also have global options as well as configuration specific options. Please see the Marmalade plugin.lua to see how to do that.

You can activate plugins on a global level by setting it as default in the options panel above. Or you can use it in specific projects like this:

http://view.xscreenshot.com/99981bbb003fdc93ac66b42c523203e8

Please be aware that you should not do too much work inside the plugin.lua itself. Although it is a lua engine you may need to use lua java bindings to do things like file listings (b/c lua has no native file listing capability.) The plugin engine was really designed to be a springboard to launch other specialized command line tools. 

Here is an example taken from the marmalade plugin that finds a .mkb file in a given directory:

--- returns true of the string ends with a substring local function endsWith(String,End) return End=='' or string.sub(String,-string.len(End))==End end --- tries to find a .mkb file in a folder. This uses luajava bindings. local function scanFolderForMKB(folderPath) local folder = luajava.newInstance( "java.io.File", folderPath ) local files = folder:list() for i=1, files.length do local filename = files[i] if endsWith(filename,".mkb") then return folderPath .. "/" .. filename end end end

You should really write the plugin logic in any scripting language of your choice. You are given the plugin folder path in each function callback args so you can easily invoke a python script for example that does the heavy lifting. If you return a cmd table then Glider will execute the command and wait until the process finishes. 

Please let us know if you are considering using the plugin system, we can give you suggestions on the best way to put it together.

Regards,

M.Y. Developers