You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 3, 2022. It is now read-only.
• Faster execution (5 times faster - benchmarks referenced from Scripting-Languages-Comparison, has the speed of compiled C#)
• Error checking and auto completion
• No required object conversions or registering functions for the script engine
• All of C# language features including inheritance
• Easy to use and understand
• Consistent language to the GameServer
• Ability to easily move sections of GameServer code to be hot-reloadable C# script with minimal changes
Cons:
• Slightly slower loading/hot re-loading (Lua loaded 1000 scripts in 1 seconds, C# loaded 1000 scripts in 1.5 seconds)
• 2 second startup time to prepare the C# script compiler (Only needs done once)
• All scripts must be hot re-loaded together in a single Assembly for best results
Script engine is already built and testable in scripting-engine-test. All Lua scripts have been converted to C#.
Script engine benchmark:
Prepare Compiler Elapsed(MS) = 1764.6604 - FPS: 0.566681271931982
Script Loading Elapsed(MS) = 47.7569 - FPS: 20.9393825813652
Compiled class Elapsed(MS) = 1171.9966 - FPS: 0.853244796102651
Loaded assembly Elapsed(MS) = 0.3413 - FPS: 2929.97363023733
Started casting from Ezreal EObject
Script Assembly Type Lookup Elapsed(MS) = 0.0566 - FPS: 17667.8445229682
Hello Benchmark from Ezreal's Q
Program Execution Time Elapsed(MS) = 3530.72 - FPS: 0.283228350024924
Noteworthy statistics: 1.1 second compiling time for all C# spell scripts
Script engine structure:
publicclassCSharpScriptEngine{publicCSharpScriptEngine();publicvoidprepareCompiler();publicvoidloadSubdirectoryScripts(Stringfolder);publicvoidload(List<string>scriptLocations);public T getStaticMethod<T>(StringscriptNamespace,StringscriptClass,StringscriptFunction);public T createObject<T>(StringscriptNamespace,StringscriptClass);publicstatic T getObjectMethod<T>(objectobj,StringscriptFunction);publicstaticobjectrunFunctionOnObject(objectobj,Stringmethod,paramsobject[] args);}
Example code: (Testable in scripting-engine-test)
staticvoidMain(string[]args){CSharpScriptEnginescriptingEngine=new CSharpScriptEngine();
scriptingEngine.prepareCompiler();//Recursively find and load all CS scripts in the directory
scriptingEngine.loadSubdirectoryScripts("LeagueSandbox-Default/");//Get and call static functionAction<double>ezrealQOnUpdate= scriptingEngine.getStaticMethod<Action<double>>("Ezreal","Q","onUpdate");
ezrealQOnUpdate(50.0);//Get and call static function with return valueFunc<double>ezrealQFakeFunction= scriptingEngine.getStaticMethod<Func<double>>("Ezreal","Q","fakeFunc");doublenumber= ezrealQFakeFunction();//Create object that has an Interface definition and call defined functionISpellScriptezrealEObject= scriptingEngine.createObject<ISpellScript>("Ezreal","EObject");
ezrealEObject.onStartCasting(null);//Create object without Interface definition and call function objectezrealEObjectGeneric= scriptingEngine.createObject<object>("Ezreal","EObject");
CSharpScriptEngine.runFunctionOnObject(ezrealEObjectGeneric,"onStartCasting",newobject[]{null});//Get function of an object without an interface definition as a delegate and call itAction<Champion>onObjectStartCasting= CSharpScriptEngine.getObjectMethod<Action<Champion>>(ezrealEObjectGeneric,"onStartCasting");
onObjectStartCasting(null);}
Pros:
• Faster execution (5 times faster - benchmarks referenced from Scripting-Languages-Comparison, has the speed of compiled C#)
• Error checking and auto completion
• No required object conversions or registering functions for the script engine
• All of C# language features including inheritance
• Easy to use and understand
• Consistent language to the GameServer
• Ability to easily move sections of GameServer code to be hot-reloadable C# script with minimal changes
Cons:
• Slightly slower loading/hot re-loading (Lua loaded 1000 scripts in 1 seconds, C# loaded 1000 scripts in 1.5 seconds)
• 2 second startup time to prepare the C# script compiler (Only needs done once)
• All scripts must be hot re-loaded together in a single Assembly for best results
Script engine is already built and testable in scripting-engine-test. All Lua scripts have been converted to C#.
Script engine benchmark:
Noteworthy statistics: 1.1 second compiling time for all C# spell scripts
Script engine structure:
Example code: (Testable in scripting-engine-test)
References:
• https://github.com/MatthewFrench/scripting-engine-test
• https://github.com/MatthewFrench/Scripting-Languages-Comparison
The text was updated successfully, but these errors were encountered: