Game Development Community

Forest Pack Q&A

by Kyle Carter · in Torque Game Engine · 10/27/2007 (1:50 am) · 196 replies

In followup to my blog post, please post any questions about the Forest Pack release here.
Page «Previous 1 2 3 4 5 6 7 Last »
#1
10/27/2007 (6:22 am)
Hey Ben!


error C2039: 'userData' : is not a member of 'SceneState::RenderBSPNode'
10> ../engine\sceneGraph/sceneState.h(333) : see declaration of 'SceneState::RenderBSPNode'

Was this part of something else?
EDIT: NM, thought it was part of the pre 1.4 instructions, note it's needed in 1.5.2 :) Sorry
#2
10/27/2007 (7:10 am)
I needed to add a coma at line 65 of convex.h:
ForestConvexType[b],[/b]

Don't forget this step
Quote:In engine/sceneGraph/sceneState.h around line 337. Find lines:

SceneRenderImage* rimage;
  };

Change to read:

     SceneRenderImage* rimage;
     void              *userData;
  };
We are all skipping it thinking it is related to pre-1.4 release. ;-P


And this is outdated:
Quote:Put this in /example/common/editor/EditorGui.cs in [function Creator::init( %this )] (around line 1149)

%Environment_Item[12] = "ForestClearing";  <-- ADD THIS.


Put the function in /example/common/editor/ObjectBuilderGui.gui [around line 458] ...

function ObjectBuilderGui::buildForestClearing(%this)
{
    %this.className = "ForestClearing";
    %this.process();
}

and I did this:
Put this in /example/creator/editor/EditorGui.cs [new line 1304]
%Environment_Item[16] = "ForestClearing";

Put the function in /example/creator/editor/ObjectBuilderGui.gui [around line 463] ...
function ObjectBuilderGui::buildForestClearing(%this)
{
    %this.className = "ForestClearing";
    %this.process();
}
#3
10/27/2007 (7:32 am)
Ga! 8-(

No compile errors. Everything I've done is reported above.
Quote:creator/newObject.cs (0): Unable to instantiate non-conobject class ForestClearing.
#4
10/27/2007 (10:17 am)
Full rebuild hehe
#5
10/27/2007 (11:11 am)
One thing I am noticing is that the trees don't seem to be receiving lights yet. Going to dig into the many things going on here and see why.
#6
10/27/2007 (12:28 pm)
This is due to some Lighting Kit changes. The last update pass was on 1.5.0. If you look on Forest, there are installLights() and uninstallLights() methods. Those used to be on SceneObject and setup and tear down the GL lighting - but they got moved into sgSetupLights() and sgResetLights() on the LightManager class. So I stubbed them out and made them call the LightManager methods.

Apparently this didn't quite work. ;)

Does anyone know the TLK well enough to figure out what's going on there?

Also - yes, that void *userData needs to be added, it was in 1.4.x for a while but it looks like it got nuked!
#7
10/27/2007 (1:15 pm)
I must be stupid, since no one else has said anything about this yet, but I can't complete the last part of the installation instructions, i.e.

Quote:
Finally, copy the contents of the code directory into engine/game/fx.

Demo Installation

1. Copy the starter.fps included with the forest pack over your existing starter.fps from a checkout of HEAD.
2. Run the starter.fps demo.
3. Open the Forest mission.
4. Look! Trees!

because I don't have a code directory in the zip file nor do I have a starter.fps. The zip I downloaded only has the dgl and forest directories. What am I missing?
#8
10/27/2007 (1:45 pm)
@Derry: you are not, the files aren't provided 8-)
Check here instead...

It seems my Xcode project was corrupted for some reason: working on it. 8-/
#9
10/27/2007 (2:19 pm)
Grrr 8-( No way, same error:
Quote:creator/newObject.cs (0): Unable to instantiate non-conobject class ForestClearing.

I've been using clean TGE 1.5.2 code (and project) this time, and of course it was a full rebuild.
#10
10/27/2007 (2:35 pm)
Did you include that forestclearing file?
#11
10/27/2007 (2:58 pm)
Is this going to be a pain to get working with TGEA? Just noticed i should ask here instead of in your nice Blog area;)
#12
10/27/2007 (3:04 pm)
It's pretty TGE specific. You might try e-mailing Tom Spilman about his TGEA version.

@Stephan - make sure the ForestClearing file is being compiled in your project - a full rebuild ought to make it show up if so.
#13
10/27/2007 (5:28 pm)
Ok, Ive got this compiled. No errors. I've made the editor changes. No errors.
I've added a forest.

new Forest(newForest) {
      canSaveDynamicFields = "1";
      position = "0 0 0";
      rotation = "1 0 0 0";
      scale = "1 1 1";
      randomSeed = "100";
      forestCount = "0";
      treeDistance = "1";
      minOcclusionLevel = "3";
      maxOcclusionLevel = "5";
      singleBlock = "0";
   };


I've read the manual

Umm, what??? What do you mean by this? Do I need duplicate code? One in client and one in server?
Set up a script file somewhere it can be executed both client and server side.
This is the only thing I don't get.
#14
10/27/2007 (9:13 pm)
Wow, compiles fine and works great. a bit of a performance hit, but not nearly as much as I would have expected. Nice work, thanks!
#15
10/27/2007 (10:11 pm)
Just a quick question, has anyone tried this in 1.4.2? My initial attempt was pretty messy, so I'm going to take another stab at it, but just thought I'd ask if anyone else had accomplished it.
#16
10/27/2007 (11:39 pm)
@Alan: It basically works against 1.4, too, although the exact details of how to tweak the editor scripts and what specific feature merges are needed may vary slightly. If you look at the working code in 1.5 you should be able to backport pretty easily. It's almost entirely self-contained.

@Mike Rowley: It means that the script configuration stuff the manual describes must be executed before the mission is loaded, and this must be done whether you're a server or a client. Basically, to save on networking overhead, all that's sent is a reference to the configuration data and the random number generator seed. So you need that config data to be there on both the client and server.

Where exactly will work best depends on your game. For reference, in my last test run, I just placed the Forest::onAdd and datablock definitions on a file called forest.cs and executed it manually from the main menu. You could execute it to your mod's main.cs, or even execute it when the client first starts connecting. This is different from normal Torque behavior, but it saves you downloading literally megabytes of forest data.

Does that help? I can brush up the manual if it's still not clear to you.
#17
10/28/2007 (4:25 am)
First i would like to thanks for this great resources. but i couldn't get it run on my system, my system is a TGE 1.52 + Afx. when i scaned my log file i noticed these

Missing file: newForest..cs!
CreateShapeInstances in 0.02 seconds.
---- End createForest: RandomSeed: 679  Forest Array Size: 120    Num ForestItems: 0    Number of ShapeInstances: 3

and few more lines down

Missing file: newForest..cs!
Forest::createForest - Forest count is zero. To save on memory hits, you should set it to the number of items this forest generates.

the missing file error is came from here
void Forest::scriptOnAdd()
{
   // Script onAdd() must be called by the leaf class after
   // everything is ready.

   // We do some trickery around loading the right .cs file...
   char forestFile[256];
   dSprintf(forestFile,sizeof(forestFile),"%s.%s", getName(), ".cs");
   Con::executef(2, "exec", forestFile);
   Con::executef(this,1,"onAdd");
}
i dont understand why need to execute script with name same as the Forest object

and the zero forest count was due to
void Forest::createForest()
{
 ....
   mForestCount = mTotalItems; // <--- mTotalItems return zero
   ForestItem::resetTotalItems();
   Con::printf("Forest Created in %3.2f seconds.", (Platform::getRealMilliseconds()-time)/1000.0f);
}

anyone encounter similar problem as me?
#18
10/28/2007 (4:30 am)
Karen:

Is this line intentionally producing two periods..? i.e. is the script really called "newForest..cs" ?

dSprintf(forestFile,sizeof(forestFile),"%s.%s", getName(), ".cs");
#19
10/28/2007 (6:06 am)
Quote:@Stephan - make sure the ForestClearing file is being compiled in your project - a full rebuild ought to make it show up if so.
hoh, hoh! (red faced and laughing stupidly, like a teenager that has been given his first date...)
#20
10/28/2007 (7:11 am)
Those code snippets, i got them from TGEForest directly, without any modification. scripting wise, i added a Forest block into my mission file, i also added a new file which contained the the ForestItemDatas and newForest::onAdd as described in TGEForest doc. the file name is server/script/forest.cs. there's no script called newForest..cs in my project

i'll be grateful for any help offered, thanks
Page «Previous 1 2 3 4 5 6 7 Last »