Pages: [1]
  Print  
Author Topic: Extension API  (Read 3387 times)
Offline (Unknown gender) luiscubal
Posted on: January 22, 2011, 05:34:42 PM
Member
Joined: Jun 2009
Posts: 452

View Profile Email
I propose an extension API for ENIGMA based on the following concepts:

1. Each extension will typically have a Java/LGM part and an "execution" part(C++/ENIGMA or whatever the backend is)
3. Each execution component has a part of it that describes its function. This might be in Java, XML or any other cross-platform language that LGM can understand.

-------------------------------------

Core Extension API

Code: [Select]
LGM.requestRestart(String msg); //If the extension requires a restart
LGM.installExtension(String path, Object params); //Install "with args"
LGM.installExtension(String path); //Same as installExtension(path, null)
LGM.uninstallExtension(Extension extension);

Code: [Select]
class Extension
public String getName()
public String getDescription()
public String[] getAuthors()
public java.awt.Image getIcon()
public boolean getEnabled()
public void setEnabled(boolean enabled);
public ExtensionContent load();

Code: [Select]
interface or class ExtensionContent
public void install();
public void load(); //Extension code and resources were loaded, now handle the load logic
public void enable(); //Enable the extension

This is the barebones, now the interesting part:

Code: [Select]
void LGM.registerResourceType(ResourceType resource);
void LGM.unregisterResourceType(ResourceType resource);
GameFolder LGM.createGameFolder(String folderName, ResourceType resource, boolean canRename);
void LGM.renameGameFolder(GameFolder folder);
void LGM.deleteGameFolder(GameFolder folder);

Code: [Select]
class or interface ResourceType
public String getName();
public Image getIcon();
public Designer createDesigner(Object resource);
//Missing is the serialization API for loading/saving. I don't think I can properly design this without also designing a file format, which is not within the scope of this topic, so someone else will have to do this part.

Code: [Select]
class Designer extends JPanel
//Stuff like designer window title, etc.

Now for the "execution" part:
Code: [Select]
LGM.registerExecutionPlugin(ExecutionPlugin plugin);

Code: [Select]
class or interface BackendInfo
public String getName(); //return "enigma";
public String getLanguage(); //return "cpp";
public boolean isDebugMode();
public String getFullInfo(); //something like "enigma/cpp debug windows+opengl+openal"
//Possibly more functions

Code: [Select]
class or interface ExecutionPlugin
public String getName();
public boolean acceptsBackend(BackendInfo info); //Whether the execution plugin was made for this backend
public Script[] getScripts(); //Creates GML scripts for the plugin, useful for pure GML plugins
//The rest would be backend-specific. For instance, ENIGMA could provide a EnigmaExecutionPlugin.
//Do note that even if a plugin was not EnigmaExecutionPlugin, ENIGMA would accept it based ONLY on the acceptsBackend function, in order to allow pure GML extensions.

I am not sure how to allow pure GML scripts to handle custom resources, though.

This is just a proposal. Feel free to use, modify and/or ignore it. I release this proposal under the WTFPL.
Logged
Offline (Male) RetroX
Reply #1 Posted on: January 22, 2011, 08:41:23 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
I think that we should have a separate resource type entirely for C++ scripts.  It would act like definitions, although, all concatenated.  This would allow people to sort their sources rather than dumping them all into one pile.

I think that an entire extensions system is kind of overkill.

Maybe we could allow LGM to import GML or C++ scripts from an archive?
« Last Edit: January 22, 2011, 08:43:37 PM by RetroX » Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Unknown gender) luiscubal
Reply #2 Posted on: January 22, 2011, 09:58:26 PM
Member
Joined: Jun 2009
Posts: 452

View Profile Email
Not enough. We're talking about entire resource types.
Josh mentioned a while back that he would like paths and alarms to be entirely extensions. What you describe can not possibly implement this properly.
Logged
Post made January 23, 2011, 07:04:08 AM was deleted at the author's request.
Offline (Unknown gender) luiscubal
Reply #4 Posted on: January 23, 2011, 11:39:54 AM
Member
Joined: Jun 2009
Posts: 452

View Profile Email
That would be up to Josh. I am, however, guessing that for C++ extensions at least the header files will be unprotected.
Logged
Offline (Male) Josh @ Dreamland
Reply #5 Posted on: January 23, 2011, 06:22:24 PM

Prince of all Goldfish
Developer
Location: Ohio, United States
Joined: Feb 2008
Posts: 2925

View Profile Email
He's proposing a solution to an issue from another thread, being allowing adding resources to LGM. Simple extensions or static parts of extensions could potentially be released as object files on a per-platform basis. That said, this system would be for users who are wise enough to stay open source. Hence, I doubt that this will be requested, but I don't mind allowing for it.

I can see how this would allow adding resources, but not how it would allow modifying existing ones. I'd like Ism's opinion on it.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Female) IsmAvatar
Reply #6 Posted on: January 23, 2011, 11:57:24 PM

LateralGM Developer
LGM Developer
Location: Pennsylvania/USA
Joined: Apr 2008
Posts: 886

View Profile Email
As I said in the other thread, I do like the idea, and was expecting it to come sooner or later. This is especially helpful for LGM, as it's very bundled currently, making it hard to modify/extend, so this is a welcome change. I'm not a fan of luis's proposal, but it kinda gives us an idea of where to start.

We could provide official extensions which will maintain the ENIGMA license so that users don't have to worry about "boohoo, all the good stuff forces me to go open source."

This seems already pretty much compatible with LGM's existing plugin system for the most part, which is another part of my concern with Luis's suggestion - it's not revolutionary enough to change the internals of LGM yet, which is what I'd really like to do. I'm sure as it evolves that will become more readily available.

Also, luis should consider joining the IRC from time to time.
« Last Edit: January 24, 2011, 12:14:40 AM by IsmAvatar » Logged
Post made January 24, 2011, 10:30:15 AM was deleted at the author's request.
Offline (Male) Josh @ Dreamland
Reply #8 Posted on: January 24, 2011, 09:33:31 PM

Prince of all Goldfish
Developer
Location: Ohio, United States
Joined: Feb 2008
Posts: 2925

View Profile Email
Making it easy for users to distribute compiled extensions on a per-platform basis is easily in our power and will probably be implemented. It will not be compatible with GM. It's also not relevant to this topic. This thread is basically dead; I'm considering closing it in favor of the other topic, but I'm generally opposed to closing things, so.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Unknown gender) MrGriggs
Reply #9 Posted on: March 30, 2011, 05:37:04 AM

Member
Joined: Dec 2010
Posts: 128

View Profile Email
Similar to what MultiMedia Fusion has?

I remember their MOO extension, lol.
Logged
Pages: [1]
  Print