Designing an Extension and Scripting System for CopperCube

Posted on:May 10 2013


The software I'm working most on, CopperCube, is a quite complicated beast. It is targeted at people who want to create 3D apps and games, but do not want or are unable to program. To make this possible, you can easily click your apps together in CopperCube by using a fixed set of 26 Actions and 18 Behaviors. Together, they offer (an estimated) amount of 300 parameters, so you can do quite much with this already. But still, for more complicated apps - and a computer game is probably the most complicated piece of software there is - this is not enough.
So instead of adding more and more actions and behaviors, implementing them for each of the 5 supported targets separately (Windows and Mac OS X in C++, WebGL in JavaScript, Android in Java and Flash in Actionscript), I decided to create an extension mechanism. So that everyone can create their own actions and behaviors, share them with other users, and of course: So that also I can use this myself, and do not have to implement new functionality for all targets separately.
I did some prototyping and testing during the last days, and managed to create a nicely working extension system already. The prototype already works partially on Windows .exe, Mac OS X .app and on the Flash .swf target, so I can continue working from there:


The above creates a 2D Jump'n'Run behavior, which is actually functional already in my test build. The system works like this: For using/creating/downloading a new Action or Behavior, you only need one single file, which is a standard JavaScript text file, which you only need to copy into a specific extension directory. You can edit and save it with your favourite editor, Notepad++ in my case. CopperCube automatically re-reads this file when creating your app everytime. This makes it very easy to use. The JavaScript file has a small embedded XML section in its top, so the editor knows how and what the user can select and change in the property window of the behavior or the action. You can define types and default values for each property (like 'string', 'int', 'texture', 'color', 'scene node' and similar), and so editing such a behavior is exactly like editing a native one:


New actions or behaviors are written once, and work on all targets. The language used for this is JavaScript. I chose it because it is very simple to learn, most people already know it, and (ab)useing its dynamic features is quite useful for quickly scripting new features like this. It doesn't have the best reputation regarding performance, but I've tested it, and for the needs in CopperCube, it's pretty ok. Just don't try to write a raytracing 3d engine with it :)
This new functionality also makes it possible to script all the target using one, single language, with one single API. Meaning CopperCube will probably be also become a lot more interesting for programmers. So I'm looking forward for it to be finished soon. It will take still a bit of time to be implemented fully, but the next update of CopperCube will already include a usable beta of it.





Comments:


I didn't understand half of this, but it sounds cool :-)
Halo
Quote
2013-05-11 09:31:00


This is a really awsome idea and Im really glad you are doing it!
This will open up a whole new dimension in game development, using Coppercube! :-)

Keep on the good work!
Micke
Quote
2013-05-12 12:45:00


why are you such a fan of XML? :) it seems to get used a lot in your projects.

what's the advantage over JSON? JSON looks a lot simpler and cleaner to me.

it's great that coppercube will get more interesting to programmers! :)
horace
Quote
2013-05-15 08:52:00


Well, XML is much easier to read than JSON, IMO. Also, I wrote a few xml parsers already in my life :)
niko
Quote
2013-05-16 08:15:00


good job ,go ahead
zyx
Quote
2013-05-21 03:59:00


i remembered 10-12 years ago, the reason Max became popular with gaming platform is because they provided a plugin mechanism not existing with other 3d packages.

hopefully this is the start of awesome future for coppercube
pots
Quote
2013-05-29 02:22:00


Add comment:


Posted by:


Enter the missing letter in: "I?ternational"


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons