News › Forums › RAIN › General Discussion and Troubleshooting › Idea of Expression Evaluator for .NET
This topic contains 8 replies, has 4 voices, and was last updated by prime 4 months, 2 weeks ago.
-
AuthorPosts
-
August 30, 2022 at 7:51 am #33060
One of the powerful features of RAIN is the “Expressions” that allow directly enter condition e.g. a > 100 || b == 1 , but it is also the main problem of performance hit.
There is some other .net expression evaluator project on the web, they might solve the performance problem and even provide more features that RAIN built-in expression.
1. Flee, It uses a custom compiler, strongly-typed expression language, and lightweight codegen to compile expressions directly to IL, https://flee.codeplex.com/
2. NCalc, can parse any expression and evaluate the result, including static or dynamic parameters and custom functions http://ncalc.codeplex.com/
3. Interpreter, https://github.com/hisystems/Interpreter
September 1, 2022 at 3:37 pm #33086Thanks for the ideas. We’ll look into the links.
Just to be clear though, we don’t see a “performance problem” with our expression evaluator. We’ve optimized the code and the use of memory allocations. Unity 4 uses a really old GC that has unavoidable issues. This was mentioned at Unite during one of the talks about Unity 5 and IL2CPP. Suffice it to say that Unity recognizes the issue and has a lot of related performance upgrades in Unity 5.
November 12, 2022 at 3:13 am #34097Hello, I noticed there is an expression built in function called position()
However I can not find it anywhere in the WIKI.
Is there any updated list of available expressions?
Thank youNovember 12, 2022 at 9:24 am #34100Here’s a list:
debug(“some message”)
random(min,max)
deltaTime()
currentTime()
clamp(val,min,max)
min(val1, val2)
max(val1, val2)
navigationtarget(“target name”)
waypoints(“waypoint route/network name”)
gameobject(“game object name”)
position(object)Note that we are considering a change to expressions that would support arbitrary functions in your code plus access to most Unity built-ins.
November 12, 2022 at 7:29 pm #34122That would be a great tool.
Thank you for your quick response.
- This reply was modified 8 months, 1 week ago by antoineguidi.
February 19, 2022 at 1:43 pm #36038I finally found this list after looking all over wiki and api.
I think you should consider adding the last four functions here:
http://rivaltheory.com/wiki/behaviortrees/expressions#built_in_functionsFebruary 19, 2022 at 3:37 pm #36060Good idea. Done.
March 8, 2022 at 6:46 am #36511any plan to add custom function in expressions ?
March 8, 2022 at 1:30 pm #36517At some point, yes. We plan to support direct access to static methods in code.
-
AuthorPosts
You must be logged in to reply to this topic.