Previous Blog Next Blog
Prev/Next Blog
by date

Handy tricks you should already know

Handy tricks you should already know
Name:AcidFaucet 
Date Posted:Aug 21, 2007
Rating:4.7 out of 5
Public:YES
Comments:YES
RSS Feed:GarageGames Blog feedor Subscribe with .
Profile Page:View profile page for AcidFaucet

Blog post
It seems theres an awful lot of posts that ask questions that could be easily solved by using the compiler (VC2003 in this case) as a work horse.

Advice Item #1: Use doxygen, not compiler related but it makes research easier. Don't forget that you can open it up with an HTML editor like dreamweaver and add your own personal notes (assuming you used HTML output).

Advice Item #2: In VC when you right click on a term you get this handy dandy option "Go To Definition." There's also "Go To Declaration" but it's not as useful. Go to definition will take you to the root of the term (typically a class).



If there's more than one definition than it will display a dialog allowing you to chose which definition you'd like to check, and of course, it tells you the names of the files where the definition appears. With some logic there's no trouble.

Advice Item #3: Use "Find in Files" (it's the button that's highlighted and showing off a tooltip). Any compiler worth anything will have such a feature, so find it and use it. By the way the shortcut is CTRL+SHIFT+F.



If you highlight a term and then use Find in Files, the dialog box will already be loaded with the term.



And when you do search, you get a nice list in a persistent little search results window. Everywhere your term shows up you'll get the filename and the line number of each occurence.



Something to consider is that if you're looking at maybe making some considerable code changes do a couple of these searches and see just how many times a term comes up. It could be a useful consideration as to whether it is really worth making the change.

Advice Item #4: If you look in the above image where I've focused on "Go To Definition" you'll see that in the right click dialog box that there's an "Outlining" option. Collapsing all outlining is a handy way to view things. It'll let you skim the junk and get to the functions that you're after. Use it, it's great for general browsing.

Advice item #5: Search for header names. There's no easier way to tell if code from a header is used in a file than to look at the headers. Using the name of a header as a search term can be a big help in understanding what's going on in the engine just by file relationships.

Recent Blog Posts
List:09/16/07 - The Considerations of Development
08/21/07 - Handy tricks you should already know
08/19/06 - Free Plant Textures

Submit ResourceSubmit your own resources!

Peter Simard   (Aug 21, 2007 at 21:27 GMT)
Great advice. I wish I saw something like this when I was first starting out.

Christian S   (Aug 21, 2007 at 21:41 GMT)   Resource Rating: 4
Nice. Thumbs up ;)

Tom Eastman (Eastbeast314)   (Aug 21, 2007 at 21:47 GMT)
Darn it - I already knew them!

Nice blog though - tips and tricks blogs seem to be out of fashion recently.

Brian Richardson   (Aug 21, 2007 at 22:41 GMT)   Resource Rating: 5
Awesome blog! Here are some more tips in that vein:

Use C++ syntax to your advantage when doing searches.

To find out where a method is implemented, just prepend :: to the method name. Example "::getTransform()"

To find out where a method is used, prepend a -> to the method name. (Also, .method) to catch nonpointer cases.

Use codebase conventions as well.

A great example is Torque's console methods and functions. I can never remember how to generate a random number in script, but it's easy to find for if you use this regular expression "Console.*random".

I end up using these searches more than fancy languages refactoring things to get around quickly.

Matt Fairfax   (Aug 21, 2007 at 22:54 GMT)
Good stuff!

David Higgins   (Aug 22, 2007 at 05:58 GMT)   Resource Rating: 5
Goto Declaration also has a shortcut, F12 ... not sure about Definitions shortcut ... but I usually just 'Goto Definition' with F12, Ctrl Left, and F12 again ... pesky mice ... now where'd i put that mouse trap at?

These are so simplistic in nature, and almost all of us who already know them take them for granted ... every day.



Sean H.   (Aug 23, 2007 at 07:36 GMT)
dont forget the forward and back buttons. =)

if you go on a tangent researching a particular class you can always use them to navigate back to your initial starting point.

also, when you're researching classes sometimes it's better to do it by browsing the header file, rather than the implementation file. if you go straight to the implementation file, you may feel overwhelmed in a sea of never ending code. browsing through the header file allows you to get a feel for the general functionality a class provides.

Stephen Zepp   (Aug 23, 2007 at 20:36 GMT)   Resource Rating: 5
I want to reinforce Tip #1 very strongly: dOxygen is your friend--use it!

Most people either aren't aware of dOxygen at all, or use it for studying "stock code", but don't use the dOxygen commenting syntax in their own code development. Spending just a bit of time learning (and using) the dOxygen commenting syntax, and regenerating your documentation in a consistent periodic manner can make your project self-documenting in many ways, and is well worth the initial effort.

bank   (Aug 23, 2007 at 22:54 GMT)
agree with Stephen.
dOxygen is a "power" of YOUR engine, and YOUR power too in development.

Stephen Lujan   (Oct 11, 2007 at 08:49 GMT)
This would have been very helpful 6 years ago. Anyone who didn't know these things should not take them lightly.
Edited on Oct 11, 2007 08:50 GMT

You must be a member and be logged in to either append comments or rate this resource.