Pages: 1
Author Topic: Extension API  (67,254 Views)
Offline (Unknown gender) luiscubal

Member
Joined: Jun 2009
Posts: 452
View profile
Posted on: January 22, 2011, 10:34:42 PM
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


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);



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();



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:


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);



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.



class Designer extends JPanel
//Stuff like designer window title, etc.


Now for the "execution" part:

LGM.registerExecutionPlugin(ExecutionPlugin plugin);



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



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.
Offline (Unknown gender) RetroX

Master of all things Linux
Contributor
Joined: Apr 2008
Posts: 1,055
View profile
Reply #1 Posted on: January 23, 2011, 01:41:23 AM
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?
Offline (Unknown gender) luiscubal

Member
Joined: Jun 2009
Posts: 452
View profile
Reply #2 Posted on: January 23, 2011, 02:58:26 AM
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.
Post made January 23, 2011, 12:04:08 PM was deleted at the author's request.
Offline (Unknown gender) luiscubal

Member
Joined: Jun 2009
Posts: 452
View profile
Reply #4 Posted on: January 23, 2011, 04:39:54 PM
That would be up to Josh. I am, however, guessing that for C++ extensions at least the header files will be unprotected.
Offline (Unknown gender) Josh @ Dreamland

Prince of all Goldfish
Developer
Joined: Feb 2008
Posts: 2,950
View profile
Reply #5 Posted on: January 23, 2011, 11:22:24 PM
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.
Offline (Unknown gender) IsmAvatar

LateralGM Developer
LGM Developer
Joined: Apr 2008
Posts: 877
View profile
Reply #6 Posted on: January 24, 2011, 04:57:24 AM
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.
Post made January 24, 2011, 03:30:15 PM was deleted at the author's request.
Offline (Unknown gender) Josh @ Dreamland

Prince of all Goldfish
Developer
Joined: Feb 2008
Posts: 2,950
View profile
Reply #8 Posted on: January 25, 2011, 02:33:31 AM
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.
Offline (Unknown gender) MrGriggs

Member
Joined: Dec 2010
Posts: 128
View profile
Reply #9 Posted on: March 30, 2011, 10:37:04 AM
Similar to what MultiMedia Fusion has?

I remember their MOO extension, lol.
Pages: 1