Tuesday, July 7, 2009

Visual Studio Add-In : OpenFiles

Finally...
Last year I was working on Flex Builder. This IDE had a very cool feature. Using this tool you can browse through files & resources in the project. I wanted this feature In Visual Studio badly. The reason being in my game engine I had more than 700 files. If I want to open a file I have to navigate through the solution file. Which is extrmely boring. If we have filetrs, this gets worse. So I decided to write one for me. Initially I thought of writing a MACRO. But MACRO`s in Visual Studio have certain limitation. A MACRO cannot have UI. So I started writing an Add-In. I call this Add-In as "OpenFiles".

What this Add-In does is, It Pop`s in a dialog box, Where in you can type the initial characters of the file you are looking for.
The list gets filled with the matching file(s) in the solution. Navigate through the files using Up & down arrow keys. Either hit Enter key or Double click to open the selected file.
Press CTRL + Click to select multiple files. Pretty Simple is`nt it...

Now lets see how to use this. The Add-In supports VS 2005 & VS 2008 IDE`s.
Download Installers : VS 2005, VS 2008.

When you run the installer, it will warn you for security iossues. Just click next, there is no rik in any way. If you are still not sure, click on "View files in Windows Explorer..." button. It will show you the file that are going to be installed.

Once you are done with the installation,
Start visual studio, Create/Open any project you want.
To use the Add-In, go to Tool. Here you will see a Smiley face Icon with the Text "OpenFiles".
Click on it, a dialog box will pop up, type in the first few characters of the file you are looking for.

If you are a kind of programmer who hates using mouse. I suggest you assign a short cut key for it.
To Assign a short cut key, do the following,
> Tools->Options->Environment->Keyboard.
> In the text box type : OpenFiles.
> In the list select : openFiles.Connect.OpenFiles.
> Choose any short cut key you want & click Assign.

I have set it to : Ctrl + Shift + Alt + O.

Hope you guys like it. Drop me a mail or write a comment if you have any suggestions.
Have fun Coding...

Note: Add-In are not supported by Express Editions.

Tuesday, June 30, 2009

Visual Studio Macro to open Partner files.

From past one year I have been working on Wii games. I was using CodeWarrior IDE. This IDE was not as good as Visual Studio, I used to hate it. But things changed. As I started using it more and more I got to see some really good features like. Pre-Processing a file by context menu. Class hierarchy diagram & few other features. Ofcourse we can Pre-Process a file in VS as well, but we have to go to project settings tab for that. Also, it Pre-Processes all files in the project. Another features which is "open the partner file". You can open c, cpp or cc file if you are in a header file and vice-verse. This small feature is really handy. So I wrote a MACRO for it.

Steps to add this MACRO to your VS IDE,
  • Open VS IDE.
  • Press Alt+F11 or go to Tools->Macros->Macros IDE.
  • Right click on MyMacros->Add->Add New Item.
  • Select Module in the dialog box and name it OpenPartnerFile.
  • Paste the following code.

Public Module OpenPartnerFile
' if this file is a .cpp then open up the .h

' or vice versa

Sub OpenPartnerFile()

Dim filename As String

Dim partnerFilename As String

filename = DTE.ActiveDocument.FullName

If (filename.EndsWith(".h")) Then

partnerFilename = filename.Substring(0, filename.Length() - 2) ' + ".cpp"

If System.IO.File.Exists(
partnerFilename + ".cpp") Then

partnerFilename += ".cpp"

End If

If System.IO.File.Exists(partnerFilename + ".cc") Then

partnerFilename += ".cc"

End If

If System.IO.File.Exists(partnerFilename + ".c") Then

partnerFilename += ".c"

End If



End If

If (filename.EndsWith(".cpp")) Then

partnerFilename = filename.Substring(0, filename.Length() - 4) + ".h"

End If

If (filename.EndsWith(".cc")) Then

partnerFilename = filename.Substring(0, filename.Length() - 3) + ".h"

End If

If (filename.EndsWith(".c")) Then

partnerFilename = filename.Substring(0, filename.Length() - 2) + ".h"

End If

'MsgBox(partnerFilename)


'See if the file exists & open it
If System.IO.File.Exists(partnerFilename) Then
DTE.ItemOperations.OpenFile(partnerFilename)
End If

End Sub

End Module


You are done with the MACRO now. Save and exit the Macro IDE. Now its the time to execute the macro on a keyboard shortcut. Steps are,
  1. Tools->Options->Environment->Keyboard.
  2. Select Visual C++ 6 in the first drop down list.
  3. In the next input box, type : OpenPartnerFile.
  4. You will get a Macro in the list box below, Click on it.
  5. Type a short cut of your choice & click assign. I feel "ctrl+` " more convenient.
Hope you guys like it.

Sunday, December 14, 2008

Visual Studio MACRO

I have been using Visual Studio IDE`s from a long time. I just love Visual Studio IDE. It is the best thing from MS.

I just love tools. I create tools to make my work faster. This MACRO that I have written will help you google your doubts just by right clicking in the IDE. is`nt it easy

Follow the following steps to add this MACRO to your VS IDE,
  • Open VS IDE.
  • Press Alt+F11 or go to Tools->Macros->Macros IDE.
  • Right click on MyMacros->Add->Add New Item.
  • Select Module in the dialog box and name it WebLookUp.
  • Paste the following code between
Public Module WebLookUp
// Code goes here
End Module

  • Once you are done, your MACRO code should look like this,
Public Module WebLookUp
Sub LookUpOnTheWeb()
Dim selectedText As TextSelection = DTE.ActiveDocument.Selection
If selectedText.Text.Length = 0 Then
Return
End If
Dim args As String = """http://www.google.com/search?q=" + selectedText.Text + """"
Dim commandString = "c:\Program Files\Mozilla Firefox\firefox.exe -url " + args
Shell(commandString, AppWinStyle.MaximizedFocus, True, 100)
End Sub
End Module

This MACRO use firefox as the web browser. If you need to use some other browser just replace firefox with path for your loved browser.

Once you are done with the MACRO, now is the time to add it to the Context Menu,
to do this follow these links, Link1, Link2, Link3

Hope you guys like it. Have fun googling :)

Saturday, January 26, 2008

Knight Hopper







Last month I was in my home town (Dharwad) to attend my sisters wedding. I was playing chess with my younger brothers, then suddenly an idea struck my head. During my engineering days I use to play a small puzzle game like chess. Wherein one has to move like the knight on a 8x8 board. Objective is to fill as many blocks as you can.

I was soooooo desperate to make this game. I was just dying to come to Hyderabad. The day I came to Hyderabad, I discussed this idea with my room mate Sandeep, Who is a 3D modeler by profession. We sat down together & discussed the game play & layout. We were thinking which game engine to use. Since I am more comfortable with Torque Game Engine, We decide to go for

Torque Game Builder. After working for 6 days in a row we were able to complete the game. This game is at its bare. Since it was our first game on our own, We decided to keep it simple.

Features:

  • Three difficulty levels. Each difficulty level has time limit & undo functionality.
  • In Easy mode you get 6 minutes & 20 Undo`s to solve the puzzle.
  • In Intermediate mode you get 4 minutes & 10 Undo`s to solve the puzzle.
  • In Hard mode you get 2 minutes & zero Undo`s to solve the puzzle.
  • You can change the theme to suite your taste. There are two themes for now Classic & Mint.
Click here to paly it online
click here to see the same post in googlepages

Tuesday, December 18, 2007

video

In the previous post I showed you how my Vehicle Physics Editor Tool will help to tweak the vehicle physics at run time. After 4 days of work I have added some more functionality to it. In the earlier build one could modify only a handful of properties & there was no save option. In the new build I have added all possible properties in the editor. You can play around with any property you want. When you are done save it back to a file. Next time when you load the game, The vehicle will have all the properties that you specified.

One thing to remember is to put all the dataBlocks in one single file & do not put any game play related stuff in that file. Because when you save the properties back to disk, it truncates the file. It will write only dataBlocks. In case if you create a new file for your dataBlocks, dont forget to add it to the execution list in ~data/server/scripts/game.cs file.

Friday, December 14, 2007

Vehicle Physics Editor for TGE/TGEA

This is my first video demo with narration. So kindly adjust :).
This tool is used to tweak the vehicle physics while playing the game.
Even with he use of Torque scripting language, It`s a time cumbersome process to tweak the vehicle physics. This tool development is still in progress. For Demonstration purpose I have added two cars with unique datablock, The reason for choosing two unique datablocks is to show how it handles individual objects.
video

Features:
  • Vehicle Selection.
  • Dumping Tweaked values back to console.
Advantages:
  • Saves time.
  • No need of programmer to tweak the physics. Level designer or an artist can tweak the physics as desired. (As per current progress, The tweaked values are not saved to the file, Instead the values are dumped to the console).
  • Affects all the vehicles using the given dataBlock.
  • All the tweaked properties reflect changes dynamically. No need to restart the game.

Thursday, December 13, 2007

Search Objects in Torque Game Engine (TGE/TGEA)

I have been using Torque Game Engine from almost 2 years. In-fact I started my carrier as a game programmer using TGE 1.3. In one of my recent projects using TGEA, the world was so huge that the art team was facing problems searching objects in the game world. So I decided to make a tool for it. And here's the out put... I wish I could narrate in the video, so that I don't have to write about it here, But I don't have right tools to do that :(

video

Features:
  • Filter objects by their type. i.e, DTS or DIF types.
  • Filter objects by their group name.
  • By clicking on the object, Camera snaps to the object.
  • Dynamic filtering of objects by their name.
  • Along with objects shape file name, Objects internal name is also shown. This helps in case of multiple instances.
Advantages:
  • Saves time.
  • Filtering objects by their type helps in keeping track of many objects of that type exist.
  • Filtering objects by type & name helps to check how many instances of one object exist in the game world.