so im making a bomberman game where there is an extra textarea next to the game you can write code in that textarea and after you press on the submit button your next bomb willl execute that code if its valid
at least thats the theory
problem is that i have no idea how to convert whats written in the textarea to code and check wether its valid
so… any clues?
Create some sort of simplified scripting language, such as:
move 5,0
attack nearest_target
move 0,3
ability repair
and parse that from your textbox to create your behaviours instead of trying to compile C# at runtime.
You can also use a scripting language package like LUA. They’ve already solved the specific compilation / execution problem for you. I have used MoonSharp LUA under Unity and it behaved pretty well.