gerbilOFdoom Posted December 17, 2011 Report Share Posted December 17, 2011 (edited) 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/ExpressVisual Studio 2010 Visualization & Modeling Feature Pack (I know, not an IDE but would it even be useful?)Visual C++/C# (All Years) ExpressXNA Game Studio 3/4 (Probably not, but it's worth putting on the list!) Edited December 17, 2011 by gerbilOFdoom Quote Link to comment Share on other sites More sharing options...
historic_bruno Posted December 17, 2011 Report Share Posted December 17, 2011 Hi, on windows you'll need some version of Visual Studio/C++, and 2010 is recommended. I use the Express edition and it works fine, but the Pro editions have support for third-party plugins, included 64-bit compiler (not much use for us), and advanced debugging features, so that may be more useful if you have a choice. Quote Link to comment Share on other sites More sharing options...
gerbilOFdoom Posted December 20, 2011 Author Report Share Posted December 20, 2011 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). Quote Link to comment Share on other sites More sharing options...
historic_bruno Posted December 20, 2011 Report Share Posted December 20, 2011 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 wrongNot 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. Quote Link to comment Share on other sites More sharing options...
gerbilOFdoom Posted December 20, 2011 Author Report Share Posted December 20, 2011 (edited) 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 December 21, 2011 by gerbilOFdoom Quote Link to comment Share on other sites More sharing options...
vts Posted December 21, 2011 Report Share Posted December 21, 2011 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.oYou 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. Quote Link to comment Share on other sites More sharing options...
quantumstate Posted December 21, 2011 Report Share Posted December 21, 2011 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. Quote Link to comment Share on other sites More sharing options...
Almin Posted December 21, 2011 Report Share Posted December 21, 2011 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? Quote Link to comment Share on other sites More sharing options...
gerbilOFdoom Posted December 22, 2011 Author Report Share Posted December 22, 2011 (edited) 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? 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 December 22, 2011 by gerbilOFdoom Quote Link to comment Share on other sites More sharing options...
Ykkrosh Posted December 22, 2011 Report Share Posted December 22, 2011 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'). Quote Link to comment Share on other sites More sharing options...
Almin Posted December 23, 2011 Report Share Posted December 23, 2011 The answer you're looking for was above you the whole timeSorry, I don't know what came in my mind! Quote Link to comment Share on other sites More sharing options...
gerbilOFdoom Posted December 28, 2011 Author Report Share Posted December 28, 2011 Problem solved! Using Eclipse JS, "Javascript Resources" provides a list of all resources in the entire project. File search with "*.js" filter set for variables and functions shows every reference of the function, can also be found by right clicking a function/variable and hit "References -> Project". Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.