Home Tutorials Download Beta Store Forum Documentation KnowledgeBase Wiki Blog

ShiVa3D

Return to Plugins

Plugin Limitations?

ShiVa Plugin Development

Plugin Limitations?

Postby codinghero » 17 Oct 2011, 01:05

I've been developing a plugin and I started thinking that I might over engineering it since Shiva may not be capable of handling it. So far I've only seen utility style plugins that take and return data. What I was designing is basically a charater controller and finite state machine, and requires an object to persist the data in the class structure I'm building. Is that even possible with the plugin API or do I need to redesign it to just manipulate data and return the state changes?
james.signature("http://www.codinghero.com");
User avatar
codinghero
Expert Boarder
Expert Boarder
 
Posts: 118
Location: Behind a Keyboard, CA

Re: Plugin Limitations?

Postby Xdust » 17 Oct 2011, 01:32

codinghero wrote:I've been developing a plugin and I started thinking that I might over engineering it since Shiva may not be capable of handling it. So far I've only seen utility style plugins that take and return data. What I was designing is basically a charater controller and finite state machine, and requires an object to persist the data in the class structure I'm building. Is that even possible with the plugin API or do I need to redesign it to just manipulate data and return the state changes?


As far as I can tell, the data does persist the whole time Shiva is running. Which is good and bad.

Basically, it looks like the plugin is loaded when Shiva starts, and stays there till its finished.

However, I have only made an SQLite plugin, in a minimal way. So I was storing only a tiny few variables. I have not tested out classes or anything like that.

But it did compile and run 30K lines of SQL library source-code just fine. And god knows what was in there. With open source software, god only knows what is in there running.

And I can say it works perfectly for days on end.

Thats all I really know at this point.
Xdust
Gold Boarder
Gold Boarder
 
Posts: 194
Location: Columbia, PA, USA

Re: Plugin Limitations?

Postby codinghero » 17 Oct 2011, 05:02

As I understand it a plugin is just added to a project. You can't drop a plugin onto an object in a scene right? If that's the case then it would seem you couldn't have object-specific data and states, which would explain why I haven't seen anything other than utility functionality. Am I wrong or is it just that these types of plugins haven't been thought up yet?
james.signature("http://www.codinghero.com");
User avatar
codinghero
Expert Boarder
Expert Boarder
 
Posts: 118
Location: Behind a Keyboard, CA

Re: Plugin Limitations?

Postby Xdust » 17 Oct 2011, 05:11

codinghero wrote:As I understand it a plugin is just added to a project. You can't drop a plugin onto an object in a scene right? If that's the case then it would seem you couldn't have object-specific data and states, which would explain why I haven't seen anything other than utility functionality. Am I wrong or is it just that these types of plugins haven't been thought up yet?


Haha, um yea.

Im not sure. I think it might be possible. But as of now, I think people are just doing the basics.

And what you wrote is pretty much what I figure also.
Xdust
Gold Boarder
Gold Boarder
 
Posts: 194
Location: Columbia, PA, USA

Re: Plugin Limitations?

Postby giggsy » 17 Oct 2011, 11:14

I'm not aware of that you can add plugins to scenes or objects.
We do instanciate some classes filled with XML data though, which live the whole shiva lifecycle without trouble.

As current being, I see plugin usage for as you write utils and maybe complex data structures which would get somehow unmaintainable with normal user/object AIs.

I'm currently also doing some tests in my sparetime with porting our MASS to plugin, but this is again more of the "utils" type. You just often need functions in several AIs to be accessible (.isObjectHit, .hasInAppPurchase, etc) plus you can create more readable code, and that's what plugins are great for.

E.g. instead of
Code: Select all
user.sendEvent( this.getUser, "MASS", "onPerformProductPurchase", sId )

you can then write
Code: Select all
mass.performProductPurchase( sId )

which will/might will only call the event itself, but it's simply easier to use =)
User avatar
giggsy
Platinum Boarder
Platinum Boarder
 
Posts: 1105
Location: Austria

Re: Plugin Limitations?

Postby NiCoX » 17 Oct 2011, 11:56

You can have a look at the great "Bikini" plug-in (Bullet based physics engine replacement). The developer is using AIModels to just expose some properties in the IDE, and also flag the objects that must be handled by the plug-in, then all is done inside the plug-in. The sources are not available but looking at the sample and/or the doc, it's very simple to understand the mechanism.

http://www.stonetrip.com/developer/forum/viewtopic.php?f=76&t=24015&p=38199&hilit=bikini#p38199
User avatar
NiCoX
Platinum Boarder
Platinum Boarder
 
Posts: 5652
Location: France

Re: Plugin Limitations?

Postby codinghero » 17 Oct 2011, 23:52

Right, I'm familiar with the two bullet plugins and such, but again those are basically utility plugins as opposed to per-object-based. No biggy. I've already begun refactoring my plugin to work per-system. It'll just take a little more time and planning. Thanks for the infos.
james.signature("http://www.codinghero.com");
User avatar
codinghero
Expert Boarder
Expert Boarder
 
Posts: 118
Location: Behind a Keyboard, CA

Re: Plugin Limitations?

Postby Xdust » 18 Oct 2011, 01:27

codinghero wrote:Right, I'm familiar with the two bullet plugins and such, but again those are basically utility plugins as opposed to per-object-based. No biggy. I've already begun refactoring my plugin to work per-system. It'll just take a little more time and planning. Thanks for the infos.


Have you tried to pass an object tag to the plugin.

And then get that object inside the plugin using the tag. I haven't tried it, But im able access all sorts of shiva functions inside the plugins.

If you can figure out the syntax, it seems possible.

Or maybe passing an object handle. The plugin seems to be able to access just about all of shivas features. IF you can figure out the syntax.
Xdust
Gold Boarder
Gold Boarder
 
Posts: 194
Location: Columbia, PA, USA

Re: Plugin Limitations?

Postby codinghero » 18 Oct 2011, 03:02

Well the idea was for the plugin to "live" on many objects. By having a single plugin manage many objects would take more work and probably be less efficient than just having it manage logic on demand. The new plan is to let the objects mange their own states and data. They'll pass this on to the state machine and it will return their new data and states.

I'm half tempted to port one of my older Unity apps over to Shiva entirely as a plugin. :p
james.signature("http://www.codinghero.com");
User avatar
codinghero
Expert Boarder
Expert Boarder
 
Posts: 118
Location: Behind a Keyboard, CA

Re: Plugin Limitations?

Postby Xdust » 18 Oct 2011, 03:12

codinghero wrote:Well the idea was for the plugin to "live" on many objects. By having a single plugin manage many objects would take more work and probably be less efficient than just having it manage logic on demand. The new plan is to let the objects mange their own states and data. They'll pass this on to the state machine and it will return their new data and states.

I'm half tempted to port one of my older Unity apps over to Shiva entirely as a plugin. :p


Know what? Try it.

So far, anything that can compile with Visual c++ has run perfectly. And considering that c++/clr is freely available, there is a TON it can do.

Check this out :
http://msdn.microsoft.com/en-us/library/0adb9zxe%28v=vs.80%29.aspx

You can turn on and off managed code in a c++ DLL. AKA Shiva3D Plugin

Im really wondering what you can link up using whats on this link.
Xdust
Gold Boarder
Gold Boarder
 
Posts: 194
Location: Columbia, PA, USA

Re: Plugin Limitations?

Postby codinghero » 19 Oct 2011, 04:32

Well I just compiled and ran my first (tester) plugin and I gotta say, damn nice. At this point I honestly can't think of anything I can do in Unity that I can't do in Shiva. Sure the Lua engine has its limitations, and sure it has it quirks. But C++ changes all that, or rather it makes those issues irrelevant. I think I actually am going to port one of my Unity apps as a plugin. This particular one was going to be a hassle with Lua tables, but now I can just use proper arrays and structs. Oh hell yeah, bitches, it's on now!
james.signature("http://www.codinghero.com");
User avatar
codinghero
Expert Boarder
Expert Boarder
 
Posts: 118
Location: Behind a Keyboard, CA


Return to Plugins