Hi
I'm having issues adding smilenet.dll as plugin to Unity game engine
I'm using Unity 5.6.0 it should be as simple as just adding the file under the "..Assets" folder in unity or even and "..Assets.Plugins". But Unity says it cannot find the namespace "Smile".
I have used smilenet.dll with visual studio fine and there the namespace "smile" is found fine.
It seems it is just unity that has issues
Here is the unity guide on plugins.
https://docs.unity3d.com/Manual/Plugins.html
I hope you can help
Thanks
Smilenet & Unity
-
- Site Admin
- Posts: 1442
- Joined: Mon Nov 26, 2007 5:51 pm
Re: Smilenet & Unity
Unfortunately, none of us here has ever used Unity.I hope you can help
According to the article linked below, using mixed-mode assemblies like Smile.NET is not supported in Unity.
Re: Smilenet & Unity
is there a non-mixed version available?
-
- Site Admin
- Posts: 1442
- Joined: Mon Nov 26, 2007 5:51 pm
Re: Smilenet & Unity
No, because SMILE is written in native C++. Smile.NET is an assembly which contains both native SMILE code and the .NET classes in the Smile and Smile.Learning namespaces.is there a non-mixed version available?
Re: Smilenet & Unity
The reason I ask is that from version 5 unity should work fine with managed and native libraries, (e.g. C++ etc). I'm not after Smile Learn, I'm only using Smile, I don't particularly need a whole package of some sort.
I'm using this for my PhD project, I had it working in another environment that worked fine but I have since lost that environment and am being asked to show how my engine for games that uses Bayes nets can be used in an actual game.
The easy access to that is through Unity.
So really is there a DLL with just smile C++ in it or is it possible to compile it?
Really all I use is as follows:
[/code]
If it is possible to get this basic functionality as a native DLL file then Unity reads it in as a sort of object and allows me to use it in C# "scripts" by referencing as if it is a namespace.
It does not need to be compatible for .NET, unity is completely independent of .NET, it just uses C# as a scripting language. By this, I mean that in order to get a specific functionality for an object in the game, you just add a C# file to it and in the C# code you can call other objects in the game.
The unity engine patches it together.
I hope this helps explain what I need.
I also hope you can help with this as I need to rebuild/develop all of my engine in this new environment in order to satisfy examiners requests for my PhD dissertation.(when I say "need", I mean that the alternative of hacking my own UI in order to demonstrate the game applicability will be very time consuming etc and I have limited time and resources.)
I do aim for it to be part of a commercial game in the future which obviously would then mean the I would buy a licence from you guys :)
That is still only a hopeful intention though, one thing at a time.
I'm using this for my PhD project, I had it working in another environment that worked fine but I have since lost that environment and am being asked to show how my engine for games that uses Bayes nets can be used in an actual game.
The easy access to that is through Unity.
So really is there a DLL with just smile C++ in it or is it possible to compile it?
Really all I use is as follows:
Code: Select all
[code]
using Smile;
namespace Assets.Gamelogic.AI
{
public class Bayes : Smile.Network
{
.....
AddNode(...)
SetNodeName(...)
SetNodePosition(...)
AddOutcome(...)
SetNodeDefinition(...)
AddArc(..)
UpdateBeliefs()
etc.
...
If it is possible to get this basic functionality as a native DLL file then Unity reads it in as a sort of object and allows me to use it in C# "scripts" by referencing as if it is a namespace.
It does not need to be compatible for .NET, unity is completely independent of .NET, it just uses C# as a scripting language. By this, I mean that in order to get a specific functionality for an object in the game, you just add a C# file to it and in the C# code you can call other objects in the game.
The unity engine patches it together.
I hope this helps explain what I need.
I also hope you can help with this as I need to rebuild/develop all of my engine in this new environment in order to satisfy examiners requests for my PhD dissertation.(when I say "need", I mean that the alternative of hacking my own UI in order to demonstrate the game applicability will be very time consuming etc and I have limited time and resources.)
I do aim for it to be part of a commercial game in the future which obviously would then mean the I would buy a licence from you guys :)
That is still only a hopeful intention though, one thing at a time.
-
- Site Admin
- Posts: 1442
- Joined: Mon Nov 26, 2007 5:51 pm
Re: Smilenet & Unity
There's no DLL with SMILE that we offer. You'll need to download the static SMILE library for the compiler you have and create the DLL yourself.So really is there a DLL with just smile C++ in it or is it possible to compile it?
Unity's documentation simply says that you need to export the DLL functions as extern "C" without C++ name mangling.
https://docs.unity3d.com/Manual/NativePlugins.html
Re: Smilenet & Unity
I followed your advice and built an interface, i.e. my own dll using the .lib and h files.
That worked fine, Thanks.
Now I have actually switched to just using C++ for all the AI.
This is because of the server setup, that I'm using, is Spatial OS which is an operating system that provides a seamless virtual world that is running on multiple servers by preserving a centralised state and distribute processing across multiple servers. This is provided by company Improbable https://improbable.io/
This means that I can keep Unity and the AI in separately compiled applications called workers that share central persisted objects called Entities.
I'm currently only doing this for my PhD major revision, which I need to submit by May 2019.
There is no commercial or non-academic use at present.
I do intend to go commercial and I have read your licence conditions.
When (IF) I do manage to start converting this to an actual commercial product then I will start the conversation with you guys to get a commercial licence.
That worked fine, Thanks.
Now I have actually switched to just using C++ for all the AI.
This is because of the server setup, that I'm using, is Spatial OS which is an operating system that provides a seamless virtual world that is running on multiple servers by preserving a centralised state and distribute processing across multiple servers. This is provided by company Improbable https://improbable.io/
This means that I can keep Unity and the AI in separately compiled applications called workers that share central persisted objects called Entities.
I'm currently only doing this for my PhD major revision, which I need to submit by May 2019.
There is no commercial or non-academic use at present.
I do intend to go commercial and I have read your licence conditions.
When (IF) I do manage to start converting this to an actual commercial product then I will start the conversation with you guys to get a commercial licence.