HOWTO: debug taspring 0.40b2 source distribution

HOWTO: debug taspring 0.40b2 source distribution

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

adeveloper.clan-sy
Posts: 24
Joined: 28 Apr 2005, 00:26

HOWTO: debug taspring 0.40b2 source distribution

Post by adeveloper.clan-sy »

Well it took some time messing around, but I think I've got a procedure which should allow you to run TaSpring in the MSVC++ .NET 2003 debugger. After you follow this procedure, you should be able to make code changes and simply hit F5 to run TaSpring and debug your code changes immediately.


1) Download the TASpring 0.40b2 binary-only distribution and install into "C:\program files\taspring"

2) Download the TASpring 0.40b2 source and extract to "C:\taspring_0.40b2_src"

3.1) Open the lesson2.sln solution file in MSVC++ .NET 2003

3.2) To make sure that the UnitSync.sln will link correctly, you will need to open HpiHandler.cpp and comment out line 56, change it to:

//info->AddLine("No hpi files found, enabling backup unit");

3.3)To make sure you can actually run the program in the MSVC++ Debugger, open Game.cpp and modify line 2039, change it to:

CFileHandler f("C:\taspring_0.40b2_src\rts\bagge\Debug.exe");

3.3) Build lesson2.sln (the output files will be written to "taspring_0.40b2_src\rts\bagge")

4.1) Open the crashrpt.sln solution file in MSVC++ .NET 2003

4.2) To build correctly, you may need to set the include path (Tools|Options|Projects|VC++ Directories|Include Directories) to taspring_0.40b2_src\crashrpt\wtl40

4.3 Build crashrpt (the output files will be written to "taspring_0.40b2_src\crashrpt\bin\debug")

4.4) Copy the following file from taspring_0.40b2_src\crashrpt\bin\debug into the folder "taspring_0.40b2_src\rts"
crashrpt.dll


5.1) Open the SpringClient.sln solution file in MSVC++ .NET 2003

5.2) Build SpringClient.sln (the output files will be written to "taspring_0.40b2_src\rts\debug")

5.3) Move the following files from "taspring_0.40b2_src\rts\bagge" into the folder "taspring_0.40b2_src\rts"
ClientControls.dll
SpringClient.exe

6.1) Open the RtsSettings.sln solution file in MSVC++ .NET 2003

6.2) Build RtsSettings.sln (the output files will be written to "taspring_0.40b2_src\RtsSettings\Debug")

6.3) Move the following file from "taspring_0.40b2_src\RtsSettings\Debug" into the folder "taspring_0.40b2_src\rts"
RtsSettings.exe

7.1) Open the UnitSync.sln solution file in MSVC++ .NET 2003

7.2) To build correctly, you may need to set the include path (Tools|Options|Projects|VC++ Directories|Include Directories) to taspring_0.40b2_src\rts, since UnitSync uses some Lesson2.sln headers.

7.3) Build UnitSync.sln (the output files will be written to "taspring_0.40b2_src\unitsync\Debug)

7.3) Copy the following file from "taspring_0.40b2_src\unitsync\Debug" to the folder "taspring_0.40b2_src\rts"
unitsync.dll


8.1) Browse to "taspring_0.40b2_src\CentralBuildAI" and open the TestAI.sln solution file in MSVC++ .NET 2003
8.2 Build the TestAi.sln file

9.1) Browse to "taspring_0.40b2_src\MetalMakerAI" and open the TestAI.sln solution file in MSVC++ .NET 2003
9.2 Build the TestAi.sln file

10.1) Browse to "taspring_0.40b2_src\SimpleFormationAI" and open the TestAI.sln solution file in MSVC++ .NET 2003
10.2 Build the TestAi.sln file


11.1) Rename the file "taspring_0.40b2_src\rts\bagge\aidll\default.dll" to "taspring_0.40b2_src\rts\bagge\aidll\simpleform.dll"

11.2) Copy the following folder (previously built when building the AIs) from "taspring_0.40b2_src\rts\bagge" to ""taspring_0.40b2_src\rts"
aidll


12) Copy the following file (previously built when building SpringClient.sln) from "taspring_0.40b2_src\SpringClient\utility\debug" into the folder "taspring_0.40b2_src\rts"
utility.dll


13) Copy the following folders from "c:\program files\taspring" into the folder "taspring_0.40b2_src\rts"
bitmaps
maps
shaders



14) Copy the following text files from "c:\program files\taspring" into the folder "taspring_0.40b2_src\rts"
armor.txt
selectkeys.txt,
uikeys.txt



15) Copy following files from "c:\program files\taspring" into the folder "taspring_0.40b2_src\rts"
bagge.fnt
Luxi.ttf
PALETTE.PAL
tower.sdu
dbghelp.dll
HPIUtil.dll
zlib.dll
SelectionEditor.exe


16) Copy the totala1.hpi file from your installation of Total Annihilation (c:\cavedog) and copy it into the folder "taspring_0.40b2_src\rts"


17) Double click on "taspring_0.40b2_src\rts\rtssettings.exe" to open the settings and then immediately close it by clicking on the OK button. This will save the default settings.

18.1) Open the lesson2.sln solution file in MSVC++ .NET 2003

18.2) Hit the F5 key to start and TASPRING should now be running in the MSVC++ Debugger! You should now be able to set breakpoints and examine how the code works in detail.



Notes:
Even though you are running taspring_0.40b2_src\rts\bagge\Debug.exe in the debugger, the program will expect to find all of its run-time files/folders within the taspring_0.40b2_src\rts directory. The source distribution does not have the run-time files/folders necessary, so this is why we copied files into the taspring_0.40b2_src\rts directory.
SJ
Posts: 618
Joined: 13 Aug 2004, 17:13

Post by SJ »

I think you have missunderstood slightly how we have it setup. We normally have what comes in the installer in <base>/rts/bagge not in <base>/rts . Otherwise the <base>/rts directory get very messy with both source and output files in it.
adeveloper.clan-sy
Posts: 24
Joined: 28 Apr 2005, 00:26

Post by adeveloper.clan-sy »

This procedure works for the 0.40b2 source distribution.

If you have a more accurate procedure to debug the 0.40b2 source distribution in the MSVC++ .NET 2003 debugger please post it.
SJ
Posts: 618
Joined: 13 Aug 2004, 17:13

Post by SJ »

Easiest way is probably

1: Extract source into directory (call it <base>)
2: Install the full installer into <base>/rts/bagge
3: Open the lesson02 project in <base>/rts
4: Set working dir to bagge
5: Compile as debug
6: Debug
Now this wont compile the different AI dlls etc as debug but normally you dont need to debug inside those.
Jonny C
Posts: 94
Joined: 31 May 2005, 18:06

Post by Jonny C »

anychance i can do this with Borland c++ 5 or Dev c++ ?
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

those are completely different compilers, spring is written in vc++ 7 and will simply generate a great mass of warnings and errors if you try to compile with dev c++ or borland utilities.
Jonny C
Posts: 94
Joined: 31 May 2005, 18:06

Post by Jonny C »

ah, that explains all my problems :p lol

thanks for the heads up.

Jonny C
SJ
Posts: 618
Joined: 13 Aug 2004, 17:13

Post by SJ »

It should be possible to compile with other compilers since we dont use any specific vs stuff. There might be some warning and maybe errors but it should hopefully not be that hard to fix.
Jonny C
Posts: 94
Joined: 31 May 2005, 18:06

Post by Jonny C »

wow, thats good news. I was worried i'de have to go out and buy Visual Studio, So quick question then i'll go off and have a good rummage at the source...

Is there a cheaper alternative to the Microsoft Visual Studio c++ as it would be easier to use that instead of debugging the source...
What exactly is " C++ 7 "? is thats some kind of Microsoft Modification of C++? I'm just used to the good old original C++ nothing fancy.
User avatar
PauloMorfeo
Posts: 2004
Joined: 15 Dec 2004, 20:53

Post by PauloMorfeo »

Jonny C wrote:...
Is there a cheaper alternative to the Microsoft Visual Studio c++ ...
At my programming course, instead of programming C# and ASP in Visual Studio, i'm using Borland C# builder which is free for non-comercial use (or something of the sort). It is a nice program.

[edit]
Was that a question or a statment?
[/edit]
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

pfft nobody ever pays for those sorta things these days unless they're a company or small business...

There's a free microsoft C# compiler, it's the IDE you're payign for
Jonny C
Posts: 94
Joined: 31 May 2005, 18:06

Post by Jonny C »

I've just been having a look for the downloadable Microsoft c# but i can't find it! :(
The MSDN website says you need a subscription, and i tried using my passport (MSN) but if i try to associate it with the MSDN it requests my 'Subscription or Personal ID' (which i'm presuming you need to work for microsoft or have a subscription to register) :(

any suggestions?

Jonny C.
Jonny C
Posts: 94
Joined: 31 May 2005, 18:06

Post by Jonny C »

ok, so if i can't find a free version of Visual C++, can sombody give me a few tips as to how i initially load the RTS into my Borland C++ 5 compiler? (Or DEV bloodshead, which ever you prefer). I've tried looking through the lesson2.proj but its huge and i aint feeling like attempting to individually convert the syntax for a borland / DEV project file...

is their an easier way? please help I really wanna do some debugging for the game :)
Once i get going i can help ya with all your 'to do's...

Jonny C.
User avatar
[K.B.] Napalm Cobra
Posts: 1222
Joined: 16 Aug 2004, 06:15

Post by [K.B.] Napalm Cobra »

Bloodshed DevC++ can import m$vc projects.
Jonny C
Posts: 94
Joined: 31 May 2005, 18:06

Post by Jonny C »

if (Happy_Comment == true) {


REALLY?! WOW! thanks :)

As soon as i've finished my last exam (tommoro I have Maths - Mechanics) Then i'll have a great time looking at the source!

Thanks allot guys big help here :)
(I'm sure any new people to the project will find this usfull)

Cya l8r!

Jonny C.


}
Jonny C
Posts: 94
Joined: 31 May 2005, 18:06

Post by Jonny C »

hello again.

I've been fiddling with DEV bloodshead c++ and i found the import thing for the Microsoft project file but now i can't find the project file for the source code. The one in the source is 'lesson2.vcproj' If you try to import it, Dev just says that this isn't supported.

Any suggestions as to how i can compile the source code ? ? ? :-)

Please Help! :)

Jonny C.
SJ
Posts: 618
Joined: 13 Aug 2004, 17:13

Post by SJ »

Try just creating your own project in your c++ compiler. Just include everything in the rts and rts/gui directory.
Jonny C
Posts: 94
Joined: 31 May 2005, 18:06

Post by Jonny C »

ok, I've 'opened' (included) all the files into both Borland 5 C++ and Dev C++.
As i was told; there was lots of errors. (Dev seems to have less, it says that there is a type conversion error where a variable is of type Int and it should be a float. (or somthing like that)... anyway, I'm wondering if there is anyone else out there that has a copy of the source wich is 'debugged' to work with Dev or Borland? (mainly because it could take me weeks just to get this code to compile properly...)

:)

thanks
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

Yeah I tried creating a project in DevCPP too. Like you said, GCC does not accept implicit int in a function declaration, such as "virtual SomeFunction (int a)". The TA spring linux port will solve that, but that brings up a question: Will the linux source tree be merged with the win32 source tree at some point? It would really help compatibility with DevC++ and maybe other compilers...

I also tried VC6 but it doesn't really compile well either, probably because the templates don't really match those of VC .NET 2003 (VC6 has incomplete template support).

hmm i'm getting a little OT though, sorry
coryrc
Posts: 81
Joined: 01 May 2005, 23:09

Post by coryrc »

Zaphod wrote:Will the linux source tree be merged with the win32 source tree at some point?
Yes, I hope.

Our (porters) code should still run under Windows; we'd like if somebody would let us know if it does. It compiles under Linux now, but does not work yet, so most if not all of those warnings should be gone.

https://lolut.utbm.info/svn/taspring_linux/trunk/
Post Reply

Return to “Engine”