MechWarrior99
Would a Declarative Reactive UI be too expensive?
Not 100% sure "reactive" is the right term. But frameworks like Flutter, where they rebuild sections of the UI with light weight objects when there is a state change. Would something like that work well in C#? Thinking of for like UI heavy games?
It feels like it would generate a lot of garbage so not really make sense to do. But I also see there is like MAUI Reactor. Which seems to do it. But seems like it wouldn't scale well. And doesn't seem like they are doing any pooling or anything.
It is one of those things that are a bit hard to setup a realistic MVP to profile myself.
39 replies
What's the right UI framework pattern?
I'm making a UI system (mostly for fun and to learn), and I'm trying to figure out the right pattern for it.
I want to use it for games and editors. So I was thinking some type of immediate mode GUI since in game UIs, it doesn't make sense to have events when states change, and it is pretty high performance, especially when moving position of elements a lot. And simple.
Immediate mode pattern has a few issues though, there isn't really a good way to have an editor for building the UI visually. And if there was some type of editor, doing bindings would require boxing for each value (at least I can't think of another way without boxing). It is difficult for extensions to modify the UI.
For retained mode patterns, if you do something like MVVM it is heavily event driven, which isn't great for game UIs and has lots of boilerplate, also rather complex to make. But is quite easy to do a visual UI editor/builder for.
Retained mode GUI also generally are less performant when moving elements and such.
I looked at like a MVU pattern from Uno, but that seems to have a lot of the same issues as MVVM had, with performance and events.
I feel like there are other patterns, one that would fit well with what I want. But I'm having trouble even finding different patterns to look in to.
To summarize what I am looking for:
- High performance updates.
- Mostly not event driven.
- Easily modifiable from third-party.
- Buildable from an editor.
Any suggestions?
59 replies
✅ How to make the compile treat a specific struct as a vector?
As I understand it, the compile has special handling for vector types, which allows them to have better performance than regular structs. Is there a way to get the compile to recognize a struct as a vector to get the same performance benefits?
Or have I misunderstood what it is doing and it doesn't have special handling?
12 replies
High performances way to access members?
Hello, I'm developing a API for visiting members of a object and reading their values, for using in serialization, data validation, etc.
I am trying to make it high performant (as reasonably possible), so I want to avoid boxing from reflection. So I've been using generics with MakeGenericMethod/Type with PropertyInfo and delegates to avoid it mostly. The issue is that it isn't well supported with Native AOT.
So an alterative I thought of was to mark every class/record/struct with an attribute, and use source generation to make a 'handler' for it. But that feels like it would really bloat the class count along with compile times.
Any recommendations, insights or alternatives?
14 replies
How to safely access parameters from Task (Porting from Unity IJob)
I am making a program for generating a 3D mesh from parameters.
The generation is done in some Tasks run with
Task.Run
. I'm struggling to grasp how to properly and safely access the parameters when generating.
I am porting the system over from Unity's IJob system, which I think is sort of 'boxing' my thinking in making it hard to get my head around what I need to do.
Do I make a class/struct that has all the parameters in it that I populate beforehand and use those values during generation? Sort of like Unity's Job system.
Thanks 🙂36 replies
❔ Cancel task on nested exception
I have a series of nested async methods, when a exception is thrown I want to cancel the task.
The main issue is that I need to do a
try cache
in a for
loop in a nested method, so that we can get more detailed telemetry about it. That means that the methods just keep going. I could pass the CTS to the tasks instead, or access it through other means, but that also feels a little messy.
Hope this makes sense.
3 replies
❔ Cross-platform 3D rendering library?
Hello, I am working on an application/tool to generate 3D models. I was wondering if there was a good library for 3D rendering, and showing that in a UI.
I know there is Silk.Net. But that seems a bit too low level for me (not a graphics/rendering guy at all).
And on the other end, I also know that Avalonia has trouble showing 3D renders.
Any suggestions to solve these issues? Would I be best to use a game engine like Godot, even if I would have to roll my own UI binding system, and don't need any of the other features a game engine has? Thanks!
7 replies