Jump to content

Python API


photo

Python API  

28 members have voted

  1. 1. Do you need Python API for UNIGINE?

    • Yes (please explain in comments, what for)
      12
    • No
      16


Recommended Posts

Please share your ideas on Python API in UNIGINE. Specific technical cases would be preferred: integration with some useful libs, etc.

We heard that some Machine Learning folks would really love to use Unigine+Python. But this is a lot of work on our end and also not-so-great performance in the runtime, so we would love to hear the specific use cases.

Link to comment

We are currently already using Python in some of our projects, although we do not communicate directly with the Unigine API. We only communicate between Python and our custom plugins using a RPC framework. We mainly use this for client specific scripting, things that are so specific for one client that we do not want to bake it into the main software and often need to be tweaked on site so we prefer not to use a language that needs to be compiled.

One of our use cases is hardware control input. Control hardware is often client specific for us, both in the physical hardware and the way the software needs to react to it. Hardware is typically wired to an Arduino and then a Python script will perform basic logic like whether steering is enabled or then the input is forwarded to our vehicle dynamics module which in turn will control the physics in Unigine.

So while right now all communication happens between Python and our vehicle dynamics plugin, but our code was written from before the components system was introduced. If we would have build this on top of components the Python script would have written directly to a custom components as input for the vehicle dynamics system. Such functionality, reading and writing the data from a component from Python, could be provided by the engine I guess.

Link to comment

Hi

We would love a python API that our customers can use to extend or to customize our product.

We would also be able to offer our customers user-defined scripted animated objects, without the need for a rigged mesh. For instance if they have a mesh for a wind turbin and a mesh for the blades, they could easily have a node file that assembles the meshes and a script to rotate the blades, or if they have road beacons, they could easily add flashing lights, without ever needing C++/C# plugins or components. The users could also customize or create their own HUD.

Generally user-defined scripted behaviour is a big functionality for us, and a python API would be very well received, and not just by us, but also by our customers, who are not necessarily programmers by trade or education (python for them is less frightening that C++/C#).

Hot reload would be super easy: write the python code in a text file, load it, see the result, modifiy the text, reload it, etc. No need to recompile a DLL/SO plugin. It's live coding with Unigine :)

Besides, the current, Unigine-less (in-house engine) version of our product uses an old, outdated script language... "This is our most desperate hour. Help me, Obi-Wan Keno-python you're my only hope" ;D

Edited by gr7.76
Link to comment

We currently frown upon using the Unigine Script language, because it's marked deprecated. This means there is a huuuuuge need for a script language replacement. Python would be a good candidate, but Lua could be a challenger too. In our current product line, we use both Python scripts and Lua tools, so we would be at ease with both.

The usage would be for quick prototyping of course, from inside the Editor, and at runtime also (user provided scripts). Being able to create, edit and run from *inside* the Editor is an absolute must have, and a script gives us the additional benefit to be able to do that *without* restarting the final application for each test.

This would also be very useful to tune SFX (the kind of things that is very tedious to tune, and currently requires a full recompilation+restart).

And bonus point, writing Editor automation scripts could be a breeze (a la Blender). This means a Python Console should also be integrated.

The drawback is Python is notorious for being rather slow for heavy operation, so not everything will be possible but that is OK, you'll just have to highlight the limitations so users know them.

So to sum up:

  • tight integration within the Editor:
    • Editor automation scripts
    • creating Component as Python
    • GUI
    • Expression node
    • Material Expression
  • integrate with IG API

 

  • Like 1
Link to comment
2 hours ago, Amerio.Stephane said:

We currently frown upon using the Unigine Script language, because it's marked deprecated. This means there is a huuuuuge need for a script language replacement. Python would be a good candidate, but Lua could be a challenger too. In our current product line, we use both Python scripts and Lua tools, so we would be at ease with both.

Can C# be an option for you?

Link to comment

C# is not widely used here (mostly because we don't have many C# coders), and we have to maintain both Windows and Linux with the same feature set.

Do you mean there would be a way to use C# as a script language, directly from within the Editor, with restarting the full final app?

Link to comment
10 hours ago, Amerio.Stephane said:

C# is not widely used here (mostly because we don't have many C# coders), and we have to maintain both Windows and Linux with the same feature set.

Do you mean there would be a way to use C# as a script language, directly from within the Editor, with restarting the full final app?

C# in UNIGINE works on Windows and Linux, and it is popular among real-time 3D developers due to Unity.

Link to comment

Hi,

If C# is to consider over Cpp, we shouldn't have so much issue to migrate our code.
We have first to make sure our Linux distrib can get access / run .NET Core properly.
In the frame of AR / Unity 3D / HLs 2, we do already dev in C#.

Kind regards,
Charles

Link to comment

Multiple answers needed here:

  • can C# plugins be used with a C++ app?
  • can we run plugins both in C# and C++ at the same time?
  • can C# be used as a script language in the Editor (replacing UnigineScript)? Can we edit and run without stopping and restarting our app?
  • can an IG project be created in C# ? (it's not listed when creating a new IG project)

If yes, C# can suit us (not speaking for other customers of course!)

If no, then a UnigineScript replacement is indeed needed, and Python can fill the gap.

 

Edited by Amerio.Stephane
Link to comment
On 11/12/2020 at 5:56 PM, Amerio.Stephane said:

Multiple answers needed here:

  • can C# plugins be used with a C++ app?
  • can we run plugins both in C# and C++ at the same time?
  • can C# be used as a script language in the Editor (replacing UnigineScript)? Can we edit and run without stopping and restarting our app?
  • can an IG project be created in C# ? (it's not listed when creating a new IG project)

If yes, C# can suit us (not speaking for other customers of course!)

If no, then a UnigineScript replacement is indeed needed, and Python can fill the gap.

 

Theoretically, all this can be done. Not now, but we are moving in that direction. Most likely, it will be possible to call C# methods from C++ in a limited way (like in the case of UnigineScript from C++). But, it will be more convenient to call C++ methods from C#.

Link to comment

I think C# scripting would be one of the best scripting solutions

Ideally using Roslyn  runtime compilation like it's done here, you could achieve a performance comparable to using C# in Unigine

https://assetstore.unity.com/packages/tools/integration/roslyn-c-runtime-compiler-142753

 

this could also open Unigine to visual scripting using a tool like this which generates C# code using nodes (maybe contact developer ?)

https://assetstore.unity.com/packages/tools/visual-scripting/unode-visual-scripting-101176

 

Also this could be interesting for extending editor https://gitlab.com/ddobrev/QtSharp

thanks

Fred

 

 

 

 

 

Edited by fred.naar
Link to comment
  • 5 weeks later...

I would gladly welcome a Python API as most of the creation tool I use provide one (Qgis, FME, Cityengine (even with PYprt), Maya, Houdini, substance and other ML tools etc) this would unify and help building pipelines.

  • Like 2
Link to comment
×
×
  • Create New...