Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6357553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:11:14+00:00 2026-05-24T23:11:14+00:00

In my game (that is also written in C#) I want to include some

  • 0

In my game (that is also written in C#) I want to include some kind of customization support.
Speed is a great concern as I plan to offload major parts of the gameplay to scripts.
As a result I choose to use C# for scripting ingame events and stuff.
Users should also be able to write scripts and addons for the game in C#.
(I know that C# is NOT a scripting language btw.)

I will provide the users with a (static) class that contains all the functions needed to interact with the game.
The users will also be able to provide the code as source (the game will compile it in that case).
Compiled user “scripts” can / will also be transmitted to other players in some cases.
For example a user can build in scripted traps in his home or whatever.

Here are my questions:

  1. Security

    How can I ensure that the provided code is forced to ONLY call stuff of the provided API (class) ? To prevent cheating with scripts, malicious activities…

    Is there a way to maybe run the compiled code(s) in a sort of VM or low-trust environment ??

  2. Speed

    Will this approach be fast enough ? (Calling functions from up to 100 custom assemblys every or every second frame).
    Any tips on this?

    Maybe it’s possible to get a speed advantage by compiling all user content into one big assembly or whatever ??

  3. Size

    How can I make the compiled code small in size (besides compressing it) ?
    Because players might need to download tens of scripts…

    Is there a way to strip stuff that isn’t absolute necessary ? Like debug information or classnames and the likes…

Runtime compilation is fairly new to me (That’s why I ask here). So it would be nice to have some major beginner mistakes and / or security concerns pointed out.

Edit:

Just for clarification:
A user plugin/script or whatever you would like to call it will be a class (also written in C#) that has to implement specific functions like “GetAddonInfo”, “Init”, “Update” …
Just like a normal C# class that is derived from my abstract “Addon” class.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T23:11:17+00:00Added an answer on May 24, 2026 at 11:11 pm

    You want to take a look at this rework of an old Microsoft example project

    http://terrarium2.codeplex.com/

    It basically does everything you want.

    Compiles code into DLLs and runs them in the environemnt

    Checks for allowed API calls.

    etc.

    Version 2 was re-written to make use of web services and a number of other features. From your question it sounds like you might be more interested in Terrarium 1. However, I can’t seem to track it down so you may have to “settle” for the more complicated 2.0 release.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Problem Description: Multi-player Game that works over the some kind of network, in game
I've written a snake game in Java. What I also want to do is
I've got a medium scale project (a turn-based game) that's currently written in C/C++.
I've coded a little game, but now I realized that I should include all
I'm working on a game, written in PHP and that runs in a console.
I have written a checkers game model which has a Board object that holds
I'm currently writing an AI for a game that is written in c++. The
In a game for Android written in Scala, I have plenty of objects that
I am making a game that has its own level editor. The editor simply
I have a game that currently runs under Windows and Mac OS X and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.