Jump to content
  • Advertisement
Sign in to follow this  

Custom Vector, Matrix, etc classes in XNA - A dilemma

This topic is 2812 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm having trouble deciding how to solve a tricky situation, and I'm hoping for some input. Perhaps I'm missing something.

My situation is that I'm implementing script support in my game through C# code being compiled on the fly. The scripts are not to be trusted, so I'm sandboxing them in a separate AppDomain. The problem is, this AppDomain cannot access the XNA assemblies since XNA demands full trust, and I need at least Vectors, Matrixes and a few other base classes from XNA.

So, I clearly need my own versions of these classes, and no worries there. I'm just not sure how far to use these classes.

My first idea was to get rid of all XNA's versions of the classes and use my own over my whole code base. The idea is sound, and the main benefit is that I may use my math libs, helper functions etc in the scripts too. I'd get rid of some annoying dependencies to XNA. However, there is one big caveat: I need to convert them into their XNA counterparts every time i use XNA's functionality. This comes as a small performance cost, and a (IMO) huge ugliness cost.

The other version is to use the custom Vector, Matrix, etc only for the script and convert to XNA counterparts as soon as I get back the script output. There's the ugliness here too, but contained closely around the interface around the sandbox. I'd have to duplicate any helper functions that I've created - which is in a way nice, since I'd keep the things exposed to the script very strictly separated.

Méh. Any takes on this?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!