Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript (or similar) gaming scripts for C# XNA

Tags:

javascript

c#

xna

Lately I am preparing myself to develop yet another game in XNA C#.

The last time I worked on a game in XNA C#, I ran into this problem of having to add maps and customizable data into the game. Each time I want to add in new content or change some values to the game character or something, I had to rebuild the whole game or what - which can take quite some time.

Is there any way which I can write gaming scripts to load the content that can be interpreted by my XNA C# game without having to compile? I am looking at hopefully Javascript.

I would hope that I can add in functions and other small API which can be called from the external gaming script to manipulate the game or load data so on. I am not concerned about the game being hacked since it's quite early yet - the development is of much priority.

Any help would be greatly appreciated.

like image 619
mauris Avatar asked Nov 27 '09 06:11

mauris


People also ask

Is C good for game dev?

C++ is a high performer when compared to other languages used for game development. Other popular game programming languages include Python, Java, C, and C#. While C is another low-level language used to program games, the focus of our comparison will be the higher-level languages in the running against C++.

Is JavaScript similar to C?

JavaScript compared with C JavaScript is interpreted and sometimes compiled at runtime with a just-in-time (JIT) compiler. C is statically typed. JavaScript is dynamically typed. C requires programmers to allocate and reclaim blocks of memory.

Can JavaScript be used for gaming?

JavaScript is a language with a wide spectrum of use. From web, mobile and desktop applications to backend servers and databases. In the middle of it all we can also include making games. In fact, both 2D and 3D libraries are available to join with JavaScript to create games for either browsers or external platforms.

Which is better JavaScript or C?

If you want to start a simple web application, then learning Javascript instead of C is a fine approach. If you want to learn to write a desktop app, then Javascript is absolutely the wrong way to go about this.


3 Answers

You can try Jint which is a open source Javascript interpreter written in C#

like image 90
zfedoran Avatar answered Sep 28 '22 20:09

zfedoran


The compact framework doesn't include System.Reflection.Emit, which means you can't use IronPython. I recommend LUA, and you can find an XNA interpreter implementation with open source here

like image 26
seraphym Avatar answered Sep 28 '22 20:09

seraphym


Would IronPython be more appropriate? That should work well on "full" framework - but it looks like it might not work (yet) on xbox 360 (which uses compact framework).

For an IronPython / xna example, see here.

like image 23
Marc Gravell Avatar answered Sep 28 '22 18:09

Marc Gravell