So I big reason I am still considering using C# is that there is a tool out there to convert C#/XNA games to JavaScript. This seems like the best of both worlds - game can be maintained in readable JS and I can update code in the language I am most comfortable with. However, JSIL is open-source with zero documentation. Recording my lessons learned here:
Getting Started
Assumptions:
- You have Visual Studio 2010 and understand how to make .exe files for your programs
- You have a basic understanding of SCM systems
- You have programmed before, and are somewhat technical
Getting the source code:
- Download Git here. Don't worry - we just need the full source
- On installing, be sure to opt-in for the Command Line client (Windows)
- Open the command line client. create a folder for the project and navigate there (Linux commands 'cd', 'mkdir' etc. work here)
- Clone the JSIL repo recursively, including sub-modules:
git clone --recursive https://github.com/kevingadd/JSIL.git
- Congratulations! You have the source!
Generating the JSIL .exe file
- Open the JSIL.sln solution file
- Rght-click on the solution file in the Solution Explorer
- Select "build all"
- the JSILc.exe file will be placed in the bin directory of the project
Using the .exe file to convert C# to JavaScript
- The JSILc.exe file needs to be run from the bin directory - i.e. you can't move it around (seemingly)
- Open a command window in this directory
- Go back one directory, hold shift and right click the folder. You should see an option to open a command window there
- You will have to run this .exe from the command window.
- Bring your .exe file that you want to convert into the bin directory
- "apply" JSILc.exe to your .exe. In the command prompt, type the following (remove the <> signs):
- JSILc.exe <yourexe.exe> --out=<destination directory>
- Congrats! You have converted source.
This is where I'm stuck - I get errors when I try to run the .js files that I can't resolve:
'JSIL is undefined'
I also don't really know which .js file to "run" - manifest.js? There isn't much help here.
Things to avoid
- Do not assume you can download the source from GitHub - you need to do a full recursive clone using Git to get all the right references for JSIL
- Do not move JSILc.exe around - it seems to fail outside of the build output directory.