System.Numerics or Stride.Math #2210
Replies: 10 comments 5 replies
-
Adding comments from Eideren that went over this already but they are getting lost in the discord.
|
Beta Was this translation helpful? Give feedback.
-
Another comment from Ethereal to keep in mind
|
Beta Was this translation helpful? Give feedback.
-
final thing I found that we should keep in mind is Silks ongoing work for 3.0. They are apparently dealing with this exact issue. |
Beta Was this translation helpful? Give feedback.
-
Yes there was a big one. Those types just didn't exist when the engine was first being worked on. And after they were introduced they had at first slightly worse performance. |
Beta Was this translation helpful? Give feedback.
-
With regard to what Eideren said, I think it would be beneficial in many places to replace some implementations in One thing I recommend is marking the overloads with By marking the obsoletions with some specific diagnostic ID, subsequently suppressing that warning in each project, people can go about their business without getting swamped with warnings while some issue tracks removing the suppression on a per-project basis, starting with the most specific projects and working backwards to the core Stride projects. |
Beta Was this translation helpful? Give feedback.
-
Another discussion found thanks to Eideren that will need to be considered for matrices #291 |
Beta Was this translation helpful? Give feedback.
-
Another natural occurrence of system.Numerics ideas #2238 (comment) I would wonder if FieldOffset could also be used as a conversion between the Stride Matrix and |
Beta Was this translation helpful? Give feedback.
-
For what it's worth, I'd like to provide some feedback, as this is something I'd really like to see implemented (using System.Numerics where possible). I feel it would be an overall benefit to the project in the long term. Of course, I'm not a game engine programmer, and I'm aware that there are limitations to System.Numerics, but overall I think the benefits outweigh the drawbacks. Backwards compatibility: The issue of not controlling the types, vs the custom types in the engine: Implicit Conversions: Math types that don't currently exist in System.Numerics: Consolidating math utils under one MathUtils static class: tannergooding's comment on public fields: |
Beta Was this translation helpful? Give feedback.
-
Just to chime in and add my two cents. I am pretty heavily against switching to System.Numerics, for a couple of reasons. Having math types spread across multiple namespaces causes confusion, especially for newer users. And it can be hard to remember which namespace a type is in. Of course this can be mitigated with default or global namespace. But to me it just looks worse (very subjective of course). And also doesn't solve the issue where some math types and methods would be in Stride's documentation while others would not, seemingly at 'random'. More niche types, like line, ray, bounds, etc. may be (and are) added to System.Numerics, but may not function as we want or need. Which would result in multiple types with similar names and uses. Or having to change Stride to fit. Again, adding potential for confusion. And if they are added later on to System.Numerics (I know they are planning on adding some), there will be naming conflics requiring us to change our code and cause issues for users. Not controlling the type means we cannot add or change methods as needed. This results in either making extension methods (which are different than the normal static method pattern), or have a seperate additional class for them, like The math for Stride's types are different from the System math. Around handling of NaN, and infinite values. And especially around the matrix/matrix4x4. The numerics matrix4x4x also has some methods that are not very relevent for Stride, again, adding potential confusion. There are some benefits of course. Being able to more easily work with other libraries is great, and in some cases we can see decent performance increases without having to do any extra work. It isn't like you can't work around any of these things of course. But to me, the trade offs in usability, and extensability out weigh the benefits. And I can't help but feel that giving up control of the math types will come back to bite us in the end. But that is just my opinion, thanks for opening this discussion on the topic! |
Beta Was this translation helpful? Give feedback.
-
Just want to throw in my own friendly feedback: I am, and have been for some time, VERY strongly in favor of .net frameworks, libraries, and game engines standardizing on using One argument against standardizing stems from the worry that it may be confusing it is for developers to use types in Another argument is with potential conflicts and potential breaking changes when Although this may result in a new compilation error if a C# file has using statements for both namespaces, I think this exactly the type of issue that namespaces are meant to solve. And, it should be said, this is not exactly a new problem, or indeed unique to Speaking of the BCL, I can't help but notice that most of the arguments against standardizing on As for my own suggestions, I would council the following:
I would like to understand better the mentioned differences in semantics between |
Beta Was this translation helpful? Give feedback.
-
I wanted to open a tracked discussion on using System.Numerics instead of Strides created types.
As far as I understand it the only breaking change would be that users would need to add an extra using statement to their existing projects for .NETs math libraries.
Beta Was this translation helpful? Give feedback.
All reactions