Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!


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


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 Ollhax   Members   -  Reputation: 156

Like
0Likes
Like

Posted 04 February 2012 - 02:05 PM

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?

Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS