I'm trying to make a game where the players could write their own script.
I don't want to use things such as CodeDOM for security reason, and I try to avoid 3rd-party components as much as possible.
So I managed to write my own parser to parse the script.
It's not pretty, but it get the job done.
But now comes the problem: Because the amount of user-made scripts is quite large, so it inevitably create the performance issue.
So I thought maybe I should turned the already-parsed-once script into some sort of method or delegate or something.
I had done some research on the subject of CreateDelegate
and Expression
, but it seems like not what I thought it was.
And to be honest, it's VERY complicated and advanced, and beyond my skills of understanding.
I mean, I could probably turn "each individual line" into method using this solution, but how about the "whole script"? And surely it's NOT a good way of doing things, is it!?
And I had also thought about making each individual line into a small class and "chain" all those classes together to make a smooth rundown of the script.
But, again, because the amount of scripts is not-so-little, it occupied most of my resources just for handling those classes.
So, could somebody PLEASE be so kind and help me out?
Much appreciated!