Game Development Community

Small terrain

by Craig Gray · in Artist Corner · 12/05/2003 (4:57 pm) · 11 replies

I've noticed alot of question about making big terrain. My question is how to make the terrain much smaller. I'm learning, so please bear with me. I'm making a test game based on my own house. I just want the terrain to be about the size of my yard and no bigger. Can anyone tell me how to shrink the terrain?

#1
12/05/2003 (5:11 pm)
There are two pretty simple ways. One would be to make the models larger, which in turn makes the terrain seem smaller. The other would be to just "scrunch up" the terrain in the editor. There is a setting in there for what the 250x250 area should be equivalent to. I don't remember the unit of measurement tho.
#2
12/06/2003 (8:05 am)
Change the terrainSquareSize from the default 8 to 4, 2, 1, or 0.5. The terrain will still repeat however unless you turn off terrain tiling which I posted in a thread a while ago.
#3
12/06/2003 (9:03 am)
The problem with big models is that it confuses the LOD system (it still thinks they're vanilla size, so it swaps levels too soon).

And the problem with changing squareSize is that it hoses the water (and the editor till you restart Torque AFAIK).

Agh! XD
#4
12/06/2003 (9:41 am)
Yeah, water is a definate PITA once the squareSize is changed. It (apparently) still assumes the standard "squareSize=8" is valid and so you end up with holes in weird places.

...and don't even try to use the fxWater functions.

-Eric F
#5
12/06/2003 (10:32 am)
Not if you followed my thread where I changed the waterBlock size to match the terrainSquaresize:
if (terrBlock)
       mSquareSize = terrBlock->getSquareSize() * 128.0f;

    P    = mObjToWorld.getPosition();

    P.x += mSquareSize;
    P.y += mSquareSize;
#6
12/06/2003 (10:48 am)
Desmond, where did you change/add that? And what thread are you referring to?
#7
12/06/2003 (11:03 am)
@Craig - A simpler way to solve your problem could be to just set the mission area to the size of your yard and either script in a warning when you go outside of it or just ignore what's outside of it. Depends what your ultimate goal is.
#8
12/06/2003 (12:42 pm)
Yeah, Desmond, where do I put that...? Thanks for the tip :)
#9
12/07/2003 (7:22 pm)
Let me try it again since I didn't have the complete version in the post from last year...

in waterBlock.h

private:
...        
    F32 mSurfaceZ;   ///< Height of surface (approx.)
    [b]F32  mSquareSize;[/b] ///< Terrain square size 
...

in waterBlock.cc

(about line 78)
WaterBlock::WaterBlock()
{
...  
    [b]mRemoveWetEdges	= false;[/b]
...
    //Set our default square size
    [b]mSquareSize      = 1024.0f;[/b] 
...
(about line 121)
void WaterBlock::UpdateFluidRegion( void )
{
    MatrixF M;
    Point3F P;

    //Attempt to get the current terrain square size, if we can't
    //we will use the default (see WaterBlock::WaterBlock())
    [b]TerrainBlock *terrBlock = dynamic_cast<TerrainBlock*>(Sim::findObject("Terrain"));[/b] 
    [b]if (terrBlock)[/b] 
       [b]mSquareSize = terrBlock->getSquareSize() * 128.0f;[/b] 

    P    = mObjToWorld.getPosition();

    [b]P.x += mSquareSize;[/b] 
    [b]P.y += mSquareSize;[/b] 

    mSurfaceZ = P.z + mObjScale.z;
...
    [b]P.x -= mSquareSize;[/b]
    [b]P.y -= mSquareSize;[/b]
...
(about line 239)
void WaterBlock::GenerateDepthTextures(GBitmap* pBitmap, TextureHandle& mTexture, bool ShoreFlag)
{
...

	// Fetch the Waterblock Position.
	Point3F	TerrainPos = mObjToWorld.getPosition();
	// Change Spaces.

        [b]TerrainPos.x += mSquareSize;[/b]
	[b]TerrainPos.y += mSquareSize;[/b]
...
(about line 608)
void WaterBlock::renderObject( SceneState* state, SceneRenderImage* )
{
...
   // Handle the fluid.
    {
        // The water block lives in terrain space which is -1024,-1024.
        // To get into world space, we just add 1024,1024.
        // The fluid lives in world space.
        //V23
        [b]Point3F W2Lv(  mSquareSize,  mSquareSize, 0.0f );[/b] //World to Local vector
        [b]Point3F L2Wv( -mSquareSize, -mSquareSize, 0.0f );[/b] //Local to World vector
...
(about line 1007)
bool WaterBlock::isPointSubmergedSimple(const Point3F &pos, bool worldSpace) const
{
    Point3F Pos = pos;

    if( Pos.z > mSurfaceZ )
        return( false );
                         
    if( worldSpace )
    {
        [b]Pos.x += mSquareSize;[/b]
        [b]Pos.y += mSquareSize;[/b]
    }

    return( mFluid.IsFluidAtXY( Pos.x, Pos.y ) );
}
(about line 1027)
bool WaterBlock::castRay( const Point3F& start, const Point3F& end, RayInfo* info )
{
...
    Pos = mObjToWorld.getPosition();

    [b]X = (x * mObjScale.x) + Pos.x + mSquareSize;[/b]
    [b]Y = (y * mObjScale.y) + Pos.y + mSquareSize;[/b]

    if( mFluid.IsFluidAtXY( X, Y ) )
...
#10
12/07/2003 (10:30 pm)
I will see about getting this into HEAD, perhaps.
#11
12/08/2003 (10:35 pm)
Desmond,

I've read a few of your posts...and I have to say...you rock!

Thanks for the advice.