Jump to content

Best Version of Visual Studio


Recommended Posts

I'm interested in improving my programming skills and I'd like to do so by contributing some small changes to this project. Before I start, I'd like to know which version of Visual Studio is suggested. As a student, I have have access to:

  • Visual Studio 2010 Ultimate/Premium/Professional/Express
  • Visual Studio 2010 Visualization & Modeling Feature Pack (I know, not an IDE but would it even be useful?)
  • Visual C++/C# (All Years) Express
  • XNA Game Studio 3/4 (Probably not, but it's worth putting on the list!)

Edited by gerbilOFdoom
Link to comment
Share on other sites

Does Visual Studio 2010 have a way to work with the javascript files in \binaries\data\mods\public? Specifically, I'd like to be able to trace the use of functions throughout all the files that use them. If I have file A.js and file B.js, and file A defines the function doThis() and B calls that function, I'd like to see a list that would show something like "doThis() - B.js line X".

If Visual Studio can't do this, I'll just set up an Eclipse project in that directory and disable the editor debugging (the game doesn't appear to use standard Javascript conventions, correct me if I'm wrong).

Link to comment
Share on other sites

Does Visual Studio 2010 have a way to work with the javascript files in \binaries\data\mods\public?

I'm not aware of any feature in Visual Studio for debugging JavaScript, I don't think it even syntax highlights the code when you open it. You'd be much better using *any* other editor :) I just use Notepad++ and debug by hand. There is some planned work on a script debugger but I don't know the current status, except that it's not finished.

the game doesn't appear to use standard Javascript conventions, correct me if I'm wrong

Not sure what you mean, we use a fairly standard JavaScript, the version provided by SpiderMonkey. Though we don't use it the way most developers do, and a generic JavaScript debugger wouldn't really have much value because the game has significant interaction between the C++ engine and the scripts, not to mention we use JIT optimizations.

Link to comment
Share on other sites

I use Notepad++ for any web development I do, including Javascript, but in this case I'd like to use an IDE because I don't know my way around the code base. I want to be able to trace the use of functions throughout the entire "public" directory tree so I can find where everything is implemented. So far, I've been placing the "warn()" function at certain points and seeing what actions in the game trigger my code (in Notepad++, nonetheless).

As for not working with standard conventions, the big thing that throws Eclipse for a loop is your implementation of "for each" loops. Usually, and according to Eclipse, a for each loop is implemented as "for(var x in array)" but in 0 A.D. it is implemented as "for each(var x in array)", which is why I'd turn off debugging in Eclipse... I don't want to be buggered with 300 error messages because of small things like that. Unless I have an outdated version of Eclipse and an outdated memory of Javascript syntax O.o

Edited by gerbilOFdoom
Link to comment
Share on other sites

As for not working with standard conventions, the big thing that throws Eclipse for a loop is your implementation of "for each" loops. Usually, and according to Eclipse, a for each loop is implemented as "for(var x in array)" but in 0 A.D. it is implemented as "for each(var x in array)", which is why I'd turn off debugging in Eclipse... I don't want to be buggered with 300 error messages because of small things like that. Unless I have an outdated version of Eclipse and an outdated memory of Javascript syntax O.o

You don't, it trips up my Eclipse instance as well. It's because the for each (var foo in bar) syntax is new in JavaScript 1.6. I suppose we'll just have to live with it until WTP gets updated to deal with JS 1.6.

Link to comment
Share on other sites

I haven't found an IDE which can cope with the javascript particularly well unfortunately. Geany works moderately, to the extent that you get a nice function list down the side so can quickly jump around. Eclipse works with the qBot code because I like using it. I don't think anything would be able to cope properly with the components code because the modules access each other using Engine.QueryInterface(data.target, IID_Identity); which is handled by some C++ code.

So I would recommend using Geany and living with the fact that you will have to manually look up code in different modules. Also keep stuff from the helpers folder open for reference. A good search tool is also very helpful.

Link to comment
Share on other sites

If you tried Eclipse, are you able to explain me, what plug-ins I need for JavaScript because my Eclipse seems to have trouble with for each loops? :unsure:

The answer you're looking for was above you the whole time:

...it trips up my Eclipse instance as well. It's because the for each (var foo in bar) syntax is new in JavaScript 1.6. I suppose we'll just have to live with it until WTP gets updated to deal with JS 1.6.

As for tracing my way through the code, I'm looking into writing my own static-trace. Here's hoping I can figure it out...

Edited by gerbilOFdoom
Link to comment
Share on other sites

Debugging into JS code requires lots of internal knowledge of the JS engine (which tends to change incompatibly every few months), so I don't think any C++ IDE has any kind of support for that. The closest thing is some GDB extensions for printing JS values, but there's nothing that lets you automatically step between C++ and JS transparently.

When I'm trying to debug C++/JS interaction, usually I just find what .js file contains the function being called (try asking on IRC if you need pointers for a particular case) and then put something like "warn(uneval(['someFunction', arg1, arg2]))" at the top of the function to make it dump the argument values whenever it's called, which is usually enough to help see what's going on.

It's because the for each (var foo in bar) syntax is new in JavaScript 1.6. I suppose we'll just have to live with it until WTP gets updated to deal with JS 1.6.

Or we could try to stop using 'for each', and replace it with "bar.forEach(function(foo) { ... })" (or sometimes "bar.forEach(function(foo) { ... }, this)" if you need to use the current 'this' inside the '...' - that's a bit irritating which is why I originally vaguely preferred 'for each').

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...