Skip to main content

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
426 views

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 ...
user1306322's user avatar
  • 1,399
1 vote
1 answer
1k views

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 ...
LifGwaethrakindo's user avatar
0 votes
2 answers
368 views

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 ...
user2597689's user avatar
-1 votes
2 answers
143 views

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 ...
Zurechtweiser's user avatar
5 votes
1 answer
263 views

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
422 views

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 ...
George Duckett's user avatar
17 votes
3 answers
5k views

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 ...
liamzebedee's user avatar
  • 1,256
4 votes
1 answer
487 views

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 ...
Daniel X Moore's user avatar