People
Activity
David LeGare
@randomPoison
I've often wanted that sort of configurability over runtime warnings/errors in Unity, would be cool if Amethyst had it imo
Jacob Kiesel
@Xaeroxe
Could be cool, we'd just have to extremely thorough in making sure everyone uses our configurable framework for handling these things rather than the standard library functions
At that point it becomes so important it almost seems worthwhile to try and automate it
With CI
Paweł Grabarz
@Frizi
Excuse my ignorance, but what's the point? I feel like this is one of the least irritating problems ATM. Sure it would be cool, but it does seem like a thing where a sensible default would be good enough for very long. If anything, having a single feature flag for that would extend that "very long" period even further.
I might as well be totally wrong on this, If you see any crucial use-case for that, I'll happily learn about it :)
David LeGare
@randomPoison
Eh, I'm not sure I have a specific use-case. The general problem is how you balance verbosity for runtime errors. Just logging warnings/errors allows the developers to put off fixing those issues if doing so isn't critical at the moment, but means they can't turn those runtime warnings into hard errors (which is often desirable during testing to ensure you don't forget to cleanup warnings before release). Always panicking means developers can't forget to fix those issues, but also means that they may be disrupted from their current task to address an otherwise low-impact issue that might have been fine as a warning. I agree that having a single switch to flip to turn all logged errors/warnings into panicks would be a reasonable first step, but I expect that larger games will very quickly outgrow that solution and will want the ability to customize at a finer granularity
Especially if there are any warnings that are more about enforcing a specific style/structure in game code
Paweł Grabarz
@Frizi
Well, this is very project specific. If anything, you can turn any warning into a hard error in your CI and you can catch any error in the debugger by settimg a breakpoint. I'm not saying this is the best way you can have it, but there are many other things that prevent larger games from being created right now.
Zakarum
@omni-viral

Like you can crash the program with a simple typo

Yes. This seems unreasonable. It must be impossible to crash program by crafting special input.
Input must be checked before usage. Obviously incorrect values should be filtered by inspector.

If user-provided code add constraints to values then it must handle errors by itself.
Skipping processing an object in case of constraints not met might be the best option in most cases.
And I think it must log error! instead of warn!.

Paweł Grabarz
@Frizi
I was thinking about that and I agree to some degree, but the "incorrect values" are hard to define. For example the matrix in GlobalTransform is only invalid due to camera code that's specific to amethyst's default renderer. Should we treat that as a hard constraint? It doesn't really have to be used by the end user.

If user-provided code add constraints to values then it must handle errors by itself.

I think we should include "engine-provided user-facing code" to that group.

Zakarum
@omni-viral
What values of GlobalTransform don't work with camera code?
Paweł Grabarz
@Frizi
zeroes for example.
Any matrix that you can't invert
Zakarum
@omni-viral
Shouldn't valid transformation matrix be invertible in all cases?
Paweł Grabarz
@Frizi
Probably, but then this really becomes a special case
How about using Result in the render pass instead?
Zakarum
@omni-viral
If valid transofmation matrix must be invertible then construction of GlobalTransform with non-invertible matrix is an error
Result returned from renderpass will overcompicate stuff
Paweł Grabarz
@Frizi
If that can be baked into GlobalTransform's definition, then I'm fully OK with doing a special inspector for it that validates input.
Zakarum
@omni-viral
@Frizi of course such constraints must be checked by type construcion functions
Paweł Grabarz
@Frizi
Yes, but I'm currently just straight mutating it's values, so no validation has a chance to run.
Zakarum
@omni-viral
Inspector asks user to define a matrix, not GlobalTransform.
After that it should try to convert provided matrix into GlobalTransform. Which can return Err if matrix doesn't meet constraints
You can create a trait Inspectable with associated type that you will map onto UI to edit. And a function to convert associated type into Inspectable implementation
Paweł Grabarz
@Frizi
I'm talking about editing existing components right now, so it's a mutation. There actually is a GlobalTransformInspector in my code right now. It's mostly autogenerated, but it still exists.
Zakarum
@omni-viral
You generate code with derive?
Paweł Grabarz
@Frizi
right now with macro_rules
but derive is a next step
Problem with Inspectable is that you can't define that trait for foreign types, like a matrix from different math library.
So instead I'm creating new structs deriving Inspector that are able to work with specific types
Zakarum
@omni-viral
One trait or another. There is a room for associated type and conversion function :smile:
Paweł Grabarz
@Frizi
and currently you have to manually register inspectors for all types. The final inspector GUI shows you only the components that have at least one registered inspector (yes, you can have many and this allows overriding builtin ones).
Zakarum
@omni-viral
GlobalTransform gives you mutable access to the underlying matrix. This is where problem begins.
Paweł Grabarz
@Frizi
I'm going to get back to that later today, and I might share some code finally. I foresee that it will be rewriten completely after a review :P but it's still good as a first step
Well, how would you expect to inspect it otherwise? :D
Zakarum
@omni-viral
GlobalTransformInspector should not mutate GlobalTransform in place but try to convert a matrix into it.
Paweł Grabarz
@Frizi
o would have to clone the matrix, mutably inspect the clone, and then try to reapply it with validation.
Zakarum
@omni-viral
Yeah
Paweł Grabarz
@Frizi
I'm fine with it, but it will require writing inspectors manually for every case like that.
Derive won't work here.
Zakarum
@omni-viral
It can work with attributes
Paweł Grabarz
@Frizi
Also i would love to have a default derived inspector be auto-registered with the storage. Not sure yet how to accomplish that.
Currently you have to manually register every one of them in a setup somewhere.
(stacks of inspectors for given type is a resource, registering an inspector potentially creates this stack and pushes that inspector into it)
Zakarum
@omni-viral
#[derive(Inspectable)] will give you inspectable value with no checks.
Add #[inspectable(IntermediateTypeName)] where Self: TryFrom<IntermediateTypeName> and it will generate inspector with IntermediateTypeName being edited and converted into target type
Paweł Grabarz
@Frizi
nightly-only
Zakarum
@omni-viral
Make your own TryFrom mimicing std's
Switch to std after stabilization
Paweł Grabarz
@Frizi
I'll look into that later today, thanks