4 ms·
> It'd have to be a situation like sklearn and numpy where all the actual functionality is implemented in c/c++ and you're just using it as a glue language to c
by lewispollard 3y ago
> It'd have to be a situation like sklearn and numpy where all the actual functionality is implemented in c/c++ and you're just using it as a glue language to coordinate those pieces
You've just described most game engines that use a "scripting language" - even those that use C# do it this way (barring maybe one exception I can think of)
- ensignavenger 3y agoSee also, Panda3D https://www.panda3d.org/ https://www.panda3d.org/
- barbariangrunge 3y agoDo you really want your designers to have to learn python though? If they're learning python, they may as well learn c# or c++ and go all the way into programming. Unless it's a visual novel I guess, where renpy is popular
- raincole 3y ago> If they're learning python, they may as well learn c# or c++ No? See: data scientists. And really any scientist whose daily job involves statistics.
- crustaceansoup 3y agoWhy does it have to be used by designers? Programmers can get benefit from the faster iteration time and level of abstraction from the engine code. It's also really nice for onboarding juniors. My first game dev job was as a junior gameplay programmer at EA working mostly in Lua on top of a C++ engine.
- raytopia 3y agoA lot of people who are designers and artists already know Python because of its heavy use in 3D pipelines. Honestly I'd argue it makes more sense to also let them do scripting in something they already know.
- reactordev 3y ago“even those that use C# do it this way” The only thing we do is P/Invoke native draw calls. OpenGL, DirectX, Vulkan, they expose C functions that we call with pinned memory. That’s about where it stops. Everything else is in C#. Events, actions, game logic, networking, file system, all in C#.
- lewispollard 3y agoWho's "we" in this case?
- reactordev 3y agoAuthors of C# game engines
- lewispollard 3y agoI can think of MonoGame and Stride as examples/exceptions, though I suppose there are more out there, including peoples' own engines. Most popular engines that expose a C# interface officially or unofficially take the other route. But I grant you that the oft-given reason for this - performance - isn't impossible to achieve with pure C#, it just takes a lot more skill and knowledge, and that performance via native calls to a C++ engine aren't always more performant anyway due to marshalling.
- westurner 3y agohttps://www.reddit.com/r/O3DE/comments/rdvxhx/why_python/ https://www.reddit.com/r/O3DE/comments/rdvxhx/why_python/ : > Python is used for scripting the editor only, not in-game behaviors. > For implementing entity behaviors the only out of box ways are C++, ScriptCanvas (visual scripting) or Lua. Python is currently not available for implementing game logic. C++, Lua, and Python all implement CFFI (C Foreign Function Interface) for remote function and method calls. "Using CFFI for embedding" https://cffi.readthedocs.io/en/latest/embedding.html https://cffi.readthedocs.io/en/latest/embedding.html : > You can use CFFI to generate C code which exports the API of your choice to any C application that wants to link with this C code. This API, which you define yourself, ends up as the API of a .so/.dll/.dylib library—or you can statically link it within a larger application. Apache Arrow already supports C, C++, Python, Rust, Go and has C GLib support Lua: https://github.com/apache/arrow/tree/main/c_glib/example/lua https://github.com/apache/arrow/tree/main/c_glib/example/lua : > Arrow Lua example: All example codes use LGI to use Arrow GLib based bindings pyarrow.from_numpy_dtype: https://arrow.apache.org/docs/python/generated/pyarrow.from_numpy_dtype.html https://arrow.apache.org/docs/python/generated/pyarrow.from_... https://github.com/scikit-learn-contrib/sklearn-pandas https://github.com/scikit-learn-contrib/sklearn-pandas : > Sklearn-pandas: This module provides a bridge between Scikit-Learn's machine learning methods and pandas-style Data Frames. In particular, it provides a way to map DataFrame columns to transformations, which are later recombined into features. Pandas docs > PyArrow > I/O https://pandas.pydata.org/docs/user_guide/pyarrow.html#i-o-reading https://pandas.pydata.org/docs/user_guide/pyarrow.html#i-o-r... : > By default, these functions and all other IO reader functions return NumPy-backed data. These readers can return PyArrow-backed data by specifying the parameter dtype_backend="pyarrow" > [...] Several non-IO reader functions can also use the dtype_backend argument to return PyArrow-backed data including: to_numeric() , DataFrame.convert_dtypes() , Series.convert_dtypes() df = pandas.read_csv(".csv", dtype_backend="pyarrow") sx = pandas.Series([1.0,2.0], dtype="float32[pyarrow]")
- andybak 3y agoIn Unity you often use C# for some fairly performance critical stuff. That's one of the reasons they bothered with the Burst compiler, the Jobs system and native arrays.
- lewispollard 3y agoWell, Unity is a good example of this, because most of their techniques involve transforming your C# code or assembly into something else that doesn't run on the .NET runtime, or else having you structure it so that it can be offloaded - directly into C++ code in IL2CPP, or using LLVM to turn the IL bytecode into machine code with Burst. I don't know much about the Jobs/DOTS stuff but I assume the restrictions around it and how you use it are either due to it being based on a strict call-out to C++ code, or else some underlying "unsafe" C# code that Unity is managing safety around via structure - from a little reading it sounds like probably both.