Game Development Community

Yack Pack port to Torque 3D

by Konrad Kiss · in Torque 3D Professional · 09/01/2009 (10:16 am) · 61 replies

I've seen that there were many people interested in a port of the Yack Pack to Torque 3D, so I decided to give it a try. Unfortunately, this is coming a little more than a week later than I promised, but I hope it's going to be useful for those who own the pack.

I'm going to do the port "live" - hoping that it might help others starting a port on their own. Take it as a tutorial if you will. If it helps one person do another port, its already worth it, right?
Page «Previous 1 2 3 4 Last »
#1
09/01/2009 (10:18 am)
First of all, I check if I have the latest version of the Pack. I see that I have 1.0 downloaded, but just in case, I check My Account / Products to see if there's a newer version. At this time, there's no new version, so I'm gonna go with the 1.0. I'll re-download the Pack just to make sure I work with the original files.

In parallel, I install a new version of Torque 3D Beta 5. If everything works in there, the pack should work in my game as well. I install this new version to a path such as "D:/TorqueTasks/Yack for Torque 3D 2009 Beta 5" instead of the default path.

When it has been installed, I generate a new project called "Yack" and fire up Visual Studio. Before I do anything, I switch to DEBUG mode and recompile the engine.
#2
09/01/2009 (10:34 am)
While Visual Studio is compiling the engine's DEBUG configuration, I unpack the contents of the pack into a Yack directory in the project dir. I see that there are two zip files which I also unzip to be in the root Yack pack folder.

When Visual Studio is done with the compilation, I start Torsion, and create a new project (also called "Yack") and a DEBUG configuration.
#3
09/01/2009 (10:40 am)
As expected, Visual Studio compiled all 17 projects within the engine successfully. First of all, I'll port the engine code for the Yack pack.

Luckily, the Yack pack only has two files that need to be added to the engine: dialogMemory.cc and dialogMemory.h.

I'll first rename the .cc file to .cpp to fit with the rest of the source. Although originally it had to be dumped in the game (later T3D) folder, I'd like it to be in the T3D/Yack folder instead. For that, I'll need to create a new filter under T3D in Visual Studio. When it's done, I copy the files over to the engine source, into a new Yack directory within the source/T3D directory, and add the files to the project under th new Yack filter.

I can now try a compile to see if it works out of the box...
#4
09/01/2009 (10:49 am)
The thing fails, unfortunately. Let's see what we got:

Quote:
Error 1 fatal error C1083: Cannot open include file: 'core/bitStream.h': No such file or directory d:torquetasksyack for torque 3d 2009 beta 5enginesourcet3dyackdialogmemory.cpp 7
Error 2 error BK1506 : cannot open file '....LinkVC2k8.Debug.Win32Yack DLLdialogMemory.sbr': No such file or directory BSCMAKE

core/bitStream.h was moved to core/stream/bitStream.h, so I replace that include. The second error was a make error, and will be there as long as we have errors.

While editing the .cpp file, I notice some other includes with the wrong paths, so I replace them. game/* becomes T3D/*, core/tVector.h becomes core/util/tVector.h and finally, game/dialogMemory.h becomes T3D/yack/dialogMemory.h.

If you don't know what file must be included, and searching for the filename yields no results, you can check the version the resource was written for, and see the contents of the file. If the file does not exist in the newer version of the engine, try looking for its contents.

We can try a recompile now. Successful! That was too easy. For now, regardless of how easy that was, we can assume that it works. Let's go on with the script file ports.
#5
09/01/2009 (10:50 am)
Following this thread as I'm looking forward in the progress :)
Have bought the yack pack for a project but in the end the project was moved to a new tech, yet the Yack pack would serve as a good dialog solution in my T3D simple demo game
#6
09/01/2009 (11:04 am)
Porting the scripts and assets part of the pack look like they might take a bit more time, given the number of files. I will first copy all the assets over that I'll need for testing.. Since Torque3D has a totally different directory structure, this is how I do it:

I'll use wildcards (even if there's only one file) wherever I can, so pay attention! :)

  • client/scripts/* go to scripts/gui/*
  • client/ui/*.cs go to scripts/client/*.cs
  • client/ui/*.gui go to art/gui/*.gui
  • client/ui/*.png go to art/gui/*.png
  • data/shapes/player/* go to art/shapes/players/*
  • server/scripts/* go to scripts/server/*

Now, we'll need to go through each of the files to see if they reference other files at their old path..
#7
09/01/2009 (11:18 am)
don't you think it would make more sense to move them into "yack" folders too instead of cluttering the common folder directly?
#8
09/01/2009 (11:27 am)
Indeed, they reference old paths and other old stuff.. let's go over the interesting ones:

scripts/gui/guiCrossHairHud.cs
  • I replace every occurrence of starter.fps/client/ui with art/gui

scripts/client/yackProfiles.cs
  • it might not be referencing old paths, but we still should replace every instance of new GuiControlProfile with singleton GuiControlProfile

art/gui/YackGui.gui
  • this seems to be in order. I like to have absolute paths everywhere, so I replace every occurrence of ./black.png with art/gui/black.png

scripts/server/dialogue/Stanley_Sunshine.dla
  • I replace every occurrence of ~/data/shapes/player with art/shapes/players
  • also AudioProfile with SFXProfile

@Marc: No. :) I'd like to stay as close to the original pack as possible. I'm not planning to improve on or modify it, just as much as common sense (or the port itself) suggests. I'm just doing a simple port. :) Feel free to do that yourself. I've found that everyone has their own idea about order. :)
#9
09/01/2009 (11:37 am)
By now, we should have the (hopefully working) Torque 3D versions of the files within the pack. This will be a good time to read through the install instructions to see what else needs to be added to the engine and our script files to make the thing work.

The yack_docs directory contains extensive documentation about the pack. Double-click install.html and follow through. We have pretty much covered steps 1 and 2, so the Merge Guide is what's going to be the most interesting to us. I'll mention anything that caused me some trouble as I go through the required steps.
#10
09/01/2009 (11:55 am)
@Konrad, Thank you for going through this. I think I will buy the Yack Pack and use it in my Game. Looks like porting isn't too dificult.
#11
09/01/2009 (11:57 am)
@David: Oh, the worst is still ahead! :) I'll let you know when its finished, I'm still going through the merge guide right now.
#12
09/01/2009 (12:34 pm)
Following through the Merge Guide, here are the key things to always keep in mind:

Engine source
  • The original game directory is now called T3D, so I make sure I use that everywhere.
  • *.cc files are now *.cpp
  • There's no MountInfo struct in ShapeBase.h, so insert that variable declaration in the private declaration block of the ShapeBase class. Watch out, there are several classes defined in that file!
  • Wherever different code for TGE and TGEA is given, use the TGEA version, it will be easier to modify that.

When you're done with the engine source changes, recompile. I got 11 compile errors.. let me go through each of them.

Quote:
Error 1 error C2039: 'setBitmapModulation' : is not a member of 'GFXDevice' d:\torquetasks\yack for torque 3d 2009 beta 5\engine\source\gui\controls\guitextlistctrl.cpp 210
We'll need to replace all instances of GFX->setBitmapModulation with GFX->getDrawUtil()->setBitmapModulation. That takes care of 3 errors.

Quote:
Error 2 fatal error C1083: Cannot open include file: 'T3D/dialogMemory.h': No such file or directory d:\torquetasks\yack for torque 3d 2009 beta 5\engine\source\t3d\player.h 18
That's because I changed the game/dialogMemory.h (or T3D/dialogMemory.h) path to T3D/yack/dialogMemory.h, so you'll need to include that yack subdirectory in the path if you also did so.

We're now down to two errors.
Quote:
Error 1 error C2039: 'drawTextN' : is not a member of 'GFXDevice' d:\torquetasks\yack for torque 3d 2009 beta 5\engine\source\gui\controls\guitextlistctrl.cpp 248
Replacing GFX->drawTextN with GFX->getDrawUtil()->drawTextN in the affected file fixes the problem.

Quote:
Error 2 error C2665: 'Con::executef' : none of the 21 overloads could convert all the argument types d:\torquetasks\yack for torque 3d 2009 beta 5\engine\source\t3d\fps\guicrosshairhud.cpp 158
That's an easy one! Con::executef syntax was changed sometime around TGEA 1.7, we don't have to pass the number of arguments anymore. So to solve this one, replace Con::executef(this, 1, "onRender"); with Con::executef(this, "onRender");

Our project now compiles successfully with all the engine source changes needed.. Now, on to some script ports..
#13
09/01/2009 (12:38 pm)
thank you for the work so far :)


As for the Yack folder: it was not the idea to alter it but you did it for the sources so I thought it would make sense to do it where you are going to use yack 99% of the time too :)
#14
09/01/2009 (1:27 pm)
Script
  • The path example/starter.fps will mean your project's game directory.
  • client/defaults.cs would be scripts/client/defaults.cs - add your prefs after the core prefs exec. Same goes for server/defaults.cs (scripts/server/defaults.cs)
  • Make sure you check the new paths of the pack's resources when they are being included in scripts/client/init.cs (find them in comment #6)
  • A big bummer is that there is no aiPlayer.cs script in Beta 5. The best place to put the datablock properties in Step 13 is in art/datablock/players/player.cs - within the definition of the DefaultPlayerData datablock right after, say, emap = true; This is for testing only, and for that, this place will do, hopefully.
  • You'll find the audioProfiles file in Step 14 in art/datablocks. When adding the pack's description, make sure it looks a bit like the ones in the file. For now, I'll go with something like this: (haven't tested yet)
  • //START YACK
    datablock SFXDescription(DialogSound : AudioClosest3D)
    {
       volume   = 1.2;
       ReferenceDistance = 10.0;
    };
    //END YACK
    I also put the exec at the end of the code in the same step to the top of scripts/server/scriptExec.cs, just to keep things tidy.
  • In Step 15 (first change), instead of putting the exec after aiPlayer.cs in game.cs, open scriptExec.cs, and put the exec at the end of the file.
  • Since Beta 5 does player spawning a little differently, you will not find createPlayer in game.cs anymore (Step 15, last change). Instead, insert the yack code in core/scripts/server/spawn.cs in spawnPlayer after the following code:
  • // Player setup...
       if (%player.isMethod("setShapeName"))
          %player.setShapeName(%this.playerName);
  • Step 17: client/ui/playGui.gui is now art/gui/playGui.gui. Unfortunately, the generated PlayGui gui doesn't have a GuiCrossHairHud by default, so we'll need to add one. Add this at the end of PlayGui as a child of PlayGui (I borrowed this from the Torque 3D Beta 5 fps genre kit with a little modification):
  • new GuiCrossHairHud(CrossHair) {
          damageFillColor = "0 1 0 1";
          damageFrameColor = "1 0.6 0 1";
          damageRect = "50 4";
          damageOffset = "0 10";
          bitmap = "art/gui/crosshair.png";
          wrap = "0";
          isContainer = "0";
          Profile = "GuiModelessDialogProfile";
          HorizSizing = "center";
          VertSizing = "center";
          position = "496 368";
          Extent = "32 32";
          MinExtent = "8 8";
          canSave = "1";
          Visible = "1";
          tooltipprofile = "GuiToolTipProfile";
          hovertime = "1000";
          canSaveDynamicFields = "0";
       };
  • Still Step 17, there's no health bar, so just add the gui control above the CrossHair that we added in the previous step.

Now, I'll search a little, because I remember a few threads on porting this pack, and discovering some nastiness. It might save me some time. After that I'll prepare a test environment, and check if everything works as it should.
#15
09/01/2009 (1:34 pm)
I'll take a break, and continue tomorrow morning. Kids' time now! :)

@Marc, David: Thanks for following this! I hope you don't mind the break. With all the explanation, it takes more time than I guessed, and I wasn't prepared to spend more than 3 hours on it today. No problem, I'll go on tomorrow.

Also, I might have made mistakes, but even if I did, it will be a good exercise fixing them later on in this thread - it's a part of porting the pack after all.
#16
09/01/2009 (1:56 pm)
I am following it too :-) , I wonder if I will be able to replicate all this myself.

Also, I know this is off topic, but why did they take out Aiplayer.cs? I could see if they replaced it with something better, but what purpose does taking it out serve?
#17
09/01/2009 (10:01 pm)
Sure, take the breaks you need :)
#18
09/03/2009 (1:42 am)
@Konrad, I am getting the following error with the ShapeBase.h

1>..\..\..\..\..\Engine\source\T3D\staticShape.cpp(141) : error C2248: 'ShapeBase::mMount' : cannot access private member declared in class 'ShapeBase'
1> C:\Torque\Torque 3D 2009 Beta 5\Engine\source\T3D/shapeBase.h(589) : see declaration of 'ShapeBase::mMount'
1> C:\Torque\Torque 3D 2009 Beta 5\Engine\source\T3D/shapeBase.h(541) : see declaration of 'ShapeBase'
1>..\..\..\..\..\Engine\source\T3D\staticShape.cpp(141) : error C2248: 'ShapeBase::mMount' : cannot access private member declared in class 'ShapeBase'
1> C:\Torque\Torque 3D 2009 Beta 5\Engine\source\T3D/shapeBase.h(589) : see declaration of 'ShapeBase::mMount'
1> C:\Torque\Torque 3D 2009 Beta 5\Engine\source\T3D/shapeBase.h(541) : see declaration of 'ShapeBase'
1>..\..\..\..\..\Engine\source\T3D\staticShape.cpp(151) : error C2248: 'ShapeBase::mMount' : cannot access private member declared in class 'ShapeBase'
1> C:\Torque\Torque 3D 2009 Beta 5\Engine\source\T3D/shapeBase.h(589) : see declaration of 'ShapeBase::mMount'
1> C:\Torque\Torque 3D 2009 Beta 5\Engine\source\T3D/shapeBase.h(541) : see declaration of 'ShapeBase'
1>..\..\..\..\..\Engine\source\T3D\staticShape.cpp(151) : error C2248: 'ShapeBase::mMount' : cannot access private member declared in class 'ShapeBase'
1> C:\Torque\Torque 3D 2009 Beta 5\Engine\source\T3D/shapeBase.h(589) : see declaration of 'ShapeBase::mMount'
1> C:\Torque\Torque 3D 2009 Beta 5\Engine\source\T3D/shapeBase.h(541) : see declaration of 'ShapeBase'


My guess is I put that code in the wrong place. Can you clarify where that needed to be put?
#19
09/03/2009 (11:15 am)
@David: Double check the merge guide and see if you did this step right:
Step 3: Merge engine/game/shapeBase.h

You don't have to add that MountInfo struct to ShapeBase, just place something after it. mMount is now in SceneObject.

Quote:
  • There's no MountInfo struct in ShapeBase.h, so insert that variable declaration in the private declaration block of the ShapeBase class. Watch out, there are several classes defined in that file!
#20
09/03/2009 (11:17 am)
Guys, I'll have to postpone continuing this until tomorrow once again, RL and job are becoming hectic. I'll finish this tomorrow night the latest.
Page «Previous 1 2 3 4 Last »