Saturday, January 6, 2018

xna - How might I script the creation of CLR objects?


I am looking for a method to script the creation of entities (arrays of components) for delivery through my entity factory, i.e scripted creation of .net objects.


I have looked into Lua but it seems dynamically creating CLR objects is a somewhat impractical.


Is there another method I could use to achieve this? Is there a general pattern / approach to take towards scriptiing out functionality in this context?


My factory provides an abstracted EntityComponent[] per request, so the scripting platform would need to be aware of and be able to construct the component types defined within the c# namespace.


I want to be able to define the components of an entity and the components relevant properties in some declarative form within a script. To give some background information, I was let onto this when I found deserializing entity definitions from XML was going to be very awkward. Reflection within C# is an option but if it is not my only option I would very much seek to avoid it.


EDIT: Turns out I was very wrong about Lua! It is unbelievably easy to achieve what I was describing once you get the LuaInterface DLL up and running, importing types from your C# application into Lua is simple and effective.




No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...