Questions tagged [metaprogramming]

Metaprogramming is a programming technique in which computer programs have the ability to treat programs as their data; this means that a program can be designed to read, generate, analyse or transform other programs, and even modify itself while running.

Filter by
Sorted by
Tagged with
3 votes
1 answer

Why are games using interpreted languages instead of compiling code into libraries and calling them at runtime?

Say I want to include a game mechanic where players are invited to code up some algorithm to control robots which would defeat the enemy and protect the tower efficiently. Most games I've seen to ...
  • 1,379
1 vote
1 answer

Modify a script at runtime

I am about to make a programming game for children, hence I will use blocks (like Scratch or Stencyl). My question is: Is there a way that you can modify a script (let's say, by adding a string ...
0 votes
2 answers

How to set HUD elements position and size depending of resolution [duplicate]

How can I set HUD elements' position and size when changing resolution and maintain the desired layout? All HUD elements (including menu items such as play button, setting button etc) need to get some ...
-1 votes
2 answers

Giving the update function a history

I am using Unity but this is an issue, that can be applied to every programming language. I only have one Update-Function. function Update () { } This function ...
5 votes
1 answer

Should I amortize scripting cost via bytecode analysis or multithreading?

I'm working on a game sort of thing where users can write arbitrary code for individual agents, and I'm trying to decide the best way to divide up computation time. The simplest option would be to ...
user avatar
0 votes
1 answer

How to go from Texture2DContent to Texture2D in a content processor?

I'm using reflection to create a manifest of all assets, strongly typed. It's working fine for my own types: I get the type of the asset, if a processor is ran on it I get the output type. Then I ...
17 votes
3 answers

How do I efficiently code both the client and server at the same time?

I'm coding my game using a client-server model. When playing on singleplayer, the game starts a local server, and interacts with it just like a remote server (multiplayer). I have done this to avoid ...
  • 1,256
4 votes
1 answer

How do I check if a key is down in XNA when I'm only given a string that has the key's name?

I'm trying to get access to the keyboard state in XNA from an embedded JavaScript runtime. I'd like to do something similar to the following, but I can't seem to figure out how to get from "Left" to ...