Need info about CONTINUOUS TERRAIN

Post Reply
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Need info about CONTINUOUS TERRAIN

Post by ezee »

I've heard TbHolder asking for news bout it weeks ago .
Then i see references of it in c++ code .
Now , while i'm looking for the creation of the Aeran's sector , i've found that in :
sectors\testsystems\visit_from_the_aera\earth.system :
<planet name="Earth" file="sol/earth.png" radius="3000" gravity="20" >
<planet name="Earth" file="sol/earthcloudmaptrans.png" alpha="true" radius="3200" gravity="20" ri="0" rj="0" rk="0" si="0" sj="0" sk="0" day="600" position="0"/>
<!-- <ContinuousTerrain file="demdata/grandcanyon/continuousterrain.txt" mass=".00000100" y="0000" z="30000" qi="0" qj="0" qk="1" ri="0" rj="1" rk="0" scalex="2" numwraps="4"/>
-->
<Atmosphere radius="10000"/>

</planet>
_This have been already working ?
_Have you got screenshots about it or videos ?
_Can i test it in the c++ code ? ( an option to set in vegastrike.cfg ? )
_Where can i find doc about it ? ( by miracle ... :lol: )

EDIT : I am miraculous :wink: -> http://spacetechs.free.fr/VEGASTRIKEDEV ... rrain.html
DeejAy -> https://www.youtube.com/watch?v=7MYdr8Fkah0 8)
:D
Thx

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Need info about CONTINUOUS TERRAIN

Post by ezee »

There is only echo in a dead mine ...
And the echo say that a reference exists in the c++ code , for terrain options ,
in void vs_options::init()
/* Terrain Options */
xscale = XMLSupport::parse_float( vs_config->getVariable( "terrain", "xscale", "1.0" ) );
yscale = XMLSupport::parse_float( vs_config->getVariable( "terrain", "yscale", "1.0" ) );
zscale = XMLSupport::parse_float( vs_config->getVariable( "terrain", "zscale", "1.0" ) );
mass = XMLSupport::parse_float( vs_config->getVariable( "terrain", "mass", "100.0" ) );
radius = XMLSupport::parse_float( vs_config->getVariable( "terrain", "radius", "10000.0" ) );
and a search of "terrain" in vegastrike.cfg gives :
<section name="terrain">
<color name="terrain_ambient" r="0.0" g="0.0" b="0.0" a="1.0"/>
</section>
WOOoooOOOoooOOooooo ... only the wind .
Hopefully , i've got a :idea: in all that darkness .
And i ain't afraid of no ghost .
https://www.youtube.com/watch?v=ytAYsn__ZZI
8)

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Need info about CONTINUOUS TERRAIN

Post by ezee »

:idea: searchin' some gold ...
That mean that a ContinuousTerrain called " myterrain " is waiting for me .
:lol:
Great ! So , where is it located ... :idea:
Ah , ok , it's in :
void createObjects( std::vector< std::string > &fighter0name,
std::vector< StarSystem* > &ssys,
std::vector< QVector > &savedloc,
vector< vector< std::string > > &savefiles )

{
vector< std::string >fighter0mods;
vector< int > fighter0indices;

static Vector TerrainScale( game_options.xscale, game_options.yscale, game_options.zscale );

myterrain = NULL;
std::string stdstr = mission->getVariable( "terrain", "" );
if (stdstr.length() > 0) {
Terrain *terr = new Terrain( stdstr.c_str(), TerrainScale, game_options.mass, game_options.radius );
Matrix tmp;
ScaleMatrix( tmp, TerrainScale );
QVector pos;
mission->GetOrigin( pos, stdstr );
tmp.p = -pos;
terr->SetTransformation( tmp );
}
stdstr = mission->getVariable( "continuousterrain", "" );
if (stdstr.length() > 0) {
myterrain = new ContinuousTerrain( stdstr.c_str(), TerrainScale, game_options.mass );
Matrix tmp;
Identity( tmp );
QVector pos;
mission->GetOrigin( pos, stdstr );
tmp.p = -pos;
myterrain->SetTransformation( tmp );
}
That createObject(...) func seem to be used only with libserver.pp and netClient_login.cpp

So no chance to see it in the local version of the game .
My magic lamp and i we go in that tunnel .
:idea:

Wait ... i've found a reference in the main-loop !
void main_loop()
{
//Evaluate number of loops per second each XX loops
if (loop_count == 500) {
last_check = cur_check;
cur_check = getNewTime();
if (last_check != 1) {
//Time to update test
avg_loop = ( (nb_checks-1)*avg_loop+( loop_count/(cur_check-last_check) ) )/(nb_checks);
nb_checks = nb_checks+1;
}
loop_count = -1;
}
loop_count++;

//Execute DJ script
Music::MuzakCycle();

_Universe->StartDraw();
if (myterrain)
myterrain->AdjustTerrain( _Universe->activeStarSystem() );
Eh eh ...
https://www.youtube.com/watch?v=tyOFZ8rQZf0
8)

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
TBeholder
Elite Venturer
Elite Venturer
Posts: 753
Joined: Sat Apr 15, 2006 2:40 am
Location: chthonic safety

Re: Need info about CONTINUOUS TERRAIN

Post by TBeholder »

Didn't find that one, but before migrating to /data.4.x/ there was /data/terrain/
"Two Eyes Good, Eleven Eyes Better." -Michele Carter
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Need info about CONTINUOUS TERRAIN

Post by ezee »

too old , but thanks .

I've done my little test , following the red lines in the previous post ,
meaning that if you give a name to the var :
<mission>
<settings>
<origin planet="earth" x="0000" y="100" z="000.0"/>
</settings>

<variables>
<var name="continuousterrain" value="continuousterrain.txt"/><!-- was commented before ezee -->
<var name="defaultplayer" value="blue"/>
<var name="mission_name" value="4 versus 4" />
<var name="splashscreen" value="bad_guys_vs_good_guys.bmp" />
<var name="system" value="mission_sector/alienearth" />
<var name="description" value="4vs4.txt" />
</variables>

.. a terrain is created !
I Tested it with the \Data\mission\test\terrain.mission ...

And for the first time in the vegastrike history , there is a video about continuous
terrain . Let me just do it ... :wink:

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
jackS
Minister of Information
Minister of Information
Posts: 1895
Joined: Fri Jan 31, 2003 9:40 pm
Location: The land of tenure (and diaper changes)

Re: Need info about CONTINUOUS TERRAIN

Post by jackS »

If memory serves, you may be digging up the code that was done for a computer graphics class project in 2002 (one canyon, one planet, not scalable).
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Need info about CONTINUOUS TERRAIN

Post by ezee »

Thank you , i think it's the one that TBeHolder reported last time .
Here we go , there is a little preview of the situation now :
VIDEO PREVIEW
https://www.youtube.com/watch?v=5wsP69F ... e=youtu.be

There is only a plan created because the mission need specific data in a .txt format
that i don't have . But i will try to find ( using the source code ) what was supposed to be used ( height map or mesh ) .

I am :D to have found that new toy to play with .
:lol:

Edit : Perhaps the terrain file could use the files you indicated to me . I will verify that too.
thx guys .
:wink:

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
Deus Siddis
Elite
Elite
Posts: 1363
Joined: Sat Aug 04, 2007 3:42 pm

Re: Need info about CONTINUOUS TERRAIN

Post by Deus Siddis »

jackS wrote:If memory serves, you may be digging up the code that was done for a computer graphics class project in 2002 (one canyon, one planet, not scalable).
Actually I think this code might be the much more recent project by log0. Forum thread. In game footage.

Other projects:

Pioneer (An open source space sim similar to VS but with full procedural planetary terrain.)
Infinity
Outerra
Planetarian (OGRE based.)
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Need info about CONTINUOUS TERRAIN

Post by ezee »

Thank you ! :D
Even if i don't look for seamless planets right now ( too complicated for me ), that is an excellent preview .
Log0 is a genius too .
I like this video from him below , and i hope having the same kind of result for continuous
terrain :
https://www.youtube.com/watch?v=W1upvzYYLc0

Thank you also for the other links , i appreciate them too !
Infinity being the most impressive game project i ever seen or heard about , from a single man .
:shock:

What i like in vega-srike , is the archeology needed before being able to understand the culture behind . And also the fact that different people have worked on it , giving to it that unique and strange " beauty and the Beast " feeling .

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Need info about CONTINUOUS TERRAIN

Post by klauss »

Yeah, integrating log0's code into VS is always on my mind - sadly zero time to do it.

There is terrain code in VS, but it's utterly useless and has most certainly fallen into bitrot.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Need info about CONTINUOUS TERRAIN

Post by ezee »

There is terrain code in VS, but it's utterly useless and has most certainly fallen into bitrot.
:roll:
' He that diggeth a pit shall fall into it; and whoso breaketh an hedge, a serpent shall bite him. '

A book is utterly useless for someone that don't know how to read ,
but it's a roadmap for a reader .
Message to the Church in Sardis
1And unto the angel of the church in Sardis write; These things saith he that hath the seven Spirits of God, and the seven stars; I know thy works, that thou hast a name that thou livest, and art dead. 2Be watchful, and strengthen the things which remain, that are ready to die: for I have not found thy works perfect before God.
What is ready to die is :
Terrain* UnitFactory::createTerrain( const char *file, Vector scale, float position, float radius, Matrix &t )
{
Terrain *tt;
tt = new Terrain( file, scale, position, radius );
tt->SetTransformation( t );
return tt;
}

ContinuousTerrain* UnitFactory::createContinuousTerrain( const char *file, Vector scale, float position, Matrix &t )
{
ContinuousTerrain *ct;
ct = new ContinuousTerrain( file, scale, position );
ct->SetTransformation( t );
return ct;
}
https://www.youtube.com/watch?v=yY3K0oNtVCc
:lol:

Edit : I need to find in your holly ( yeah i said holly :lol: ) temple :
"demdata/grandcanyon/continuousterrain.txt"
Thank you for help .
:)

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Need info about CONTINUOUS TERRAIN

Post by ezee »

:idea:
La réduction du paquet d'onde est un concept de la mécanique quantique selon lequel, après une mesure, un système physique voit son état entièrement réduit à celui qui a été mesuré.
src : http://fr.wikipedia.org/wiki/R%C3%A9duc ... t_d%27onde

By this , we can understand that the observation or judgment of someone about some thing ( a physical system ) influence his state .

I don't have to run after the serial killers , they run by themselves in jail .
( shall i protect my people from serial killers :?: )
But i rather will observe a system that is called ContinuousTerrain, and see if something happens by the fact that i just observe it with love . :wink:

Here we go :

What are the variables that stores the properties of such system ?
class ContinuousTerrain
{
Vector Scales;
float sizeX;
float sizeZ;
int width;
int numcontterr;
Terrain **data;
MeshDat *md;
Matrix transformation;
QVector *location;
bool *dirty;
...
These two variables are themselves systems , that need some good loving too .
struct MeshDat
{
class Mesh *mesh;
class csOPCODECollider *collider;
Matrix mat;
};
beautiful ...
We have a preview here of the possibility of the use of OPCODE physics with the base mesh .

We could even implant a new kind of collider , based upon an other physics lib , like bullet
for example . You wonder why ? Because Blender is the official Mesh generator for VS , and that it can export Bullet physics via Collada files . But we'll look at that later .
:wink:

ContinuousTerrain need some seeds to be able to give fruits :
https://www.youtube.com/watch?v=VAtGOESO7W8

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Need info about CONTINUOUS TERRAIN

Post by ezee »

:!: The second member is the most important , we will soon understand why :
class Terrain : public QuadTree
{
updateparity *updatetransform;
float TotalSizeX;
float TotalSizeZ;
float mass;
int whichstage;
char draw;
// followed by functions only
....
....
That quick preview shows that no C++ objects are stored in that class .
What is important in that class is that it has the responsability to check for collisions:
void Collide( Unit *un, const Matrix &t );
void Collide( Unit *un );
void Collide();
The question then is : Where are located the Terrain mesh datas that serves for collision
check ? .

The answer is : In his ancestor , public QuadTree

And we just entered in a beautiful garden :wink:
Image
, with trees that bears quads :
A quadtree is a tree data structure in which each internal node has exactly four children. Quadtrees are most often used to partition a two-dimensional space by recursively subdividing it into four quadrants or regions. The regions may be square or rectangular, or may have arbitrary shapes.
src : http://en.wikipedia.org/wiki/Quadtree

And , for our enjoyment ( :D ) , contains all we need to create beautiful terrains :
struct TerraXML; <--seen that ? -> explore : Go spec !

/**
* This class is a wrapper class for quadsquare
* It takes care of activating textures, having possession of the vlist
* and having posession of the static vars that get set
*
/

class QuadTree
{
int minX;
int minZ;
unsigned int maxX;
unsigned int maxZ;
void SetXSizes( int mX, unsigned int maxX );
void SetZSizes( int mZ, unsigned int maxZ );
Vector Scales;
float detail;
IdentityTransform *nonlinear_transform;
quadcornerdata RootCornerData;
quadsquare *root;
quadsquare *neighbors[4];
std::vector< TerrainTexture >textures;
std::vector< unsigned int >unusedvertices;
GFXVertexList vertices;
unsigned int VertexAllocated;
unsigned int VertexCount;
TerraXML *xml;
You may ask : " Where are the four children " ?
Here :
void SetNeighbors( QuadTree *east, QuadTree *north, QuadTree *west, QuadTree *south );
A lot of stuff that forces admiration , no ?
It's also a way to enter in the render engine core , and familiarize ourselves with
GFXVertexList. ( proprietary format of Vegastrike , will be useful in the case of the creation of a BlenderToVs exporter for example : http://blenderartists.org/forum/archive ... 19548.html )
But we won't make the wheel before the axe ...
:wink:

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Need info about CONTINUOUS TERRAIN

Post by ezee »

:!: Special thanks ( thank you man ! :wink: ) for TBeHolder that had the very good
intuition with the link to dandandaman that he given to me .

I think yeah , that it is the example that was needed ( without it , no chance... ) to actually load a Terrain file .

I compared the name of the variables in the files and the QuadTree::beginElement(...)
used by QuadTree::LoadXML(...) and they MATCH !

Kudos to TBeHolder please !
Image
:wink:

I need to proove by the experience now that we are in the good direction .
Meaning i'll download the dandaman's files and try to load the terrain .
wow .... :D

Edit : To be totally fair , this thread is a child of a TBHolder's seed here ( last post ):
The roadmap to procedural planets

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Need info about CONTINUOUS TERRAIN

Post by ezee »

:!: LOADING TERRAIN FAILS

I have downloaded the " cunerpicus " folder , and faced different problems :

A_ The PNG are in an unknow format , GIMP can't open them .
They are supposed to be Height map , but the size of the files are suspects :
lyed_terrain512 size is 120 ko only , so perhaps they are corrupted .

B_ cunerpicus was designed at a time where there was a " terrain " folder into " Data\" .
I created this folder , but i'm not sure that the VSFileSystem is aware about that .
I just give " terrain/lyed.sphereterrain " as parameter , hoping that is enough for VS .
It seem ok because in the continuous terrain constructor :
FILE *fp = VSFileSystem::vs_open( filename, "r" );

if (fp) { // i checked and fp is true }
C_ " terrain/lyed.sphereterrain " format is matching the parameters of QuadTree::LoadXML(...) , but they don't match the ContinuousTerrain::ContinuousTerrain( const char *filename, const Vector &Scales, const float mass ) constructor's inside loaders .

They use " VSFileSystem::vs_fscanf( fp, "%d %f\n<%f %f %f>", &width, &tmass, &this->Scales.i, &this->Scales.j, &this->Scales.k ); " to read the params
in the file , and that is not a XML procedure .
So i logcally think that a .txt is needed here , like it is showed in the Data\mission\test missions variables :
<!-- <var name="continuousterrain" value="continuousterrain.txt"/>-->

WHAT TO DO :

You can help me by trying to find an example of continuousterrain.txt in the svn .
I , in my side , will try to deduce the format and produce a test file using :
VSFileSystem::vs_fscanf( fp, "%d %f\n<%f %f %f>", &width, &tmass, &this->Scales.i, &this->Scales.j, &this->Scales.k );
As alternative , i will hardcode the values of width,tmass,Scales .
But i have no idea of the values to give , so that is really tricky .

An option is to first try to use Terrain only , as continuousterrain uses ** to it :
data = new Terrain*[numcontterr];
I will try that also .

Okay , i'll report back later .
:wink:

EDIT : GENERAL ROAD MAP AND USE OF CONTINUOUS TERRAIN
:

:idea: Somewhere i forgot to say what i plan to do with continuous terrain .

So first , we know that continuousterrain is loaded within a mission file .
How to make the transition from space flight to ground/3d base exploration ?

ORBIT GROUND TRANSITIONS
_ A new set of functions need to handle the transitions from orbiting to descent ,
the ways i imagine are :
*Splashscreen ( the actual system in use for gamestate change)
*Video CInematics ( A video that shows the descent/landing , but that need a video per vessel ...
* Game cinematics ( The camera is on the ground , and the vessel lands in autopilot-mode )

_ Landing against Docking
Actually , vessels (units ) are not coded to land , but to dock .
The land function need to be coded , and could handle animations ( video or game cinematics too )

_ Physics system seem to work differently when using terrains : With a vessel , you are in
constant collisions , i don't know why . Probably because of the kind of mesh we use ( there is a rference to a porsche somewhere , we need to check if the physics code is linked to wheels parts , etc ....

_ My personal idea is not to use vessels in terrain , but characters like a MMO RPG style ,
to explore buildings ( future bases modeled in 3D )
Last edited by ezee on Sun Apr 06, 2014 2:07 pm, edited 2 times in total.

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Need info about CONTINUOUS TERRAIN

Post by ezee »

:!: I have a better knowledge now where are made the calls to create the terrain/continuousterrain systems . I will perhaps make a wiki page for dev on it later ,
to help futur coders to start working on it . But lets have a preview here ( for single player mode ) :

1 First call is made in main.cpp , in void bootstrap_main_loop():

Just after
...
InitializeInput();
vs_config->bindKeys(); //gotta do this before we do ai
// TERRAIN IS CREATED HERE BELOW
createObjects( playersaveunit, ss, playerNloc, savefiles );
2 Second call is inside createObjects(...) , located in main_loop.cpp :
...
...
//TEST FOR TERRAIN ENTRY IN MISSION FILE
static Vector TerrainScale( game_options.xscale, game_options.yscale, game_options.zscale ); <--tweak via vegastrike.cfg possible

myterrain = NULL;<-- very first use of
std::string stdstr = mission->getVariable( "terrain", "" );
if (stdstr.length() > 0) {<-- if there is a value in terrain parameter in the mission var
Terrain *terr = new Terrain( stdstr.c_str(), TerrainScale, game_options.mass, game_options.radius ); <-- a terrain is created
Matrix tmp;
ScaleMatrix( tmp, TerrainScale );
QVector pos;
mission->GetOrigin( pos, stdstr );
tmp.p = -pos;
terr->SetTransformation( tmp );
}
3 Thirdcall is inside createObjects(...) again , looking for Continuousterrain var :
...
...
stdstr = mission->getVariable( "continuousterrain", "" );
if (stdstr.length() > 0) {
//DEBUG EZEE
//
printf("*************** continuousterrain TEST ******************\n");
printf(stdstr.c_str());
myterrain = new ContinuousTerrain( stdstr.c_str(), TerrainScale, game_options.mass );
Matrix tmp;
Identity( tmp );
QVector pos;
mission->GetOrigin( pos, stdstr );
tmp.p = -pos;
myterrain->SetTransformation( tmp );
}
My tests with mission->getVariable( "continuousterrain", "lyed.sphereterrain" ) have failed , and the debug
i made show that i need an other form of file as parameter , in text mode .
Until i find the right format , i will work with the terrain option only.
( i guess that will work with Dandandaman's cunerpicus system .
That better fit also with my concept of a walkable base only .
( no need to infinite terrain in this case )
:arrow:

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Need info about CONTINUOUS TERRAIN

Post by ezee »

:!: Test failure with Terrain .

I have tried to use the cunercircus project with terrain , and the first part of the process
is working ( reading the .sphereterrain data . But when the code enters the quadtree:section , a ctd occurs .

I think ( not sure yet ) that this is because quadtree is using hard coded data for terrain ,
as you can see here :
void QuadTree::LoadData()
{
//Load some data and put it into the quadtree.
nonlinear_transform = new IdentityTransform();
HeightMapInfo hm;
hm.XOrigin = 0;
hm.ZOrigin = 0;
hm.XSize = 512;
hm.ZSize = 512;
hm.RowWidth = hm.XSize;
hm.Scale = 7;
hm.Data = new short[hm.XSize*hm.ZSize];
hm.terrainmap = new unsigned char[hm.XSize*hm.ZSize];
memset( hm.terrainmap, 0, sizeof (unsigned char)*hm.ZSize*hm.XSize );
printf( "Loading height grids...\n" );

//Big coarse data, at 128 meter sample spacing.
FILE *fp = VSFileSystem::vs_open( "demdata/gc16at128.raw", "rb" );
...
...
I made a search with google to find "gc16at128.raw" , and it appears that this ressource is well know , being a part of an Opengl tutorial :
http://www.ecsdn.com/d-6LJG.html
File list (Click to check if it's the file you need, and recomment it at the bottom):
quaddemo\clip.hpp
........\demdata\gc16at128.raw
........\.......\gc16at32.raw
........\.......\gc16at64.raw
........\.......\gctexcolored.raw
........\geometry.cpp
........\geometry.hpp
........\glut32.dll
........\makefile
........\quadtest.cpp
........\quadtest.exe
........\quadtest.map
........\quadtree.cpp
........\quadtree.hpp
........\demdata
........\ratcliffdata
quaddemo
My conclusion is that terrain and continuous terrain are a port of this tutorial , and are
not finished . The better way to fix them is to compare the files of the original tutorial
and the modified for VS .

That said , terrain or continuousterrain can be considered as a writing of a new game engine, or at least 50% of it, and having terrain is not enough ,we need physics + meshs enabled for it .

And i must admit that the actual situation don't allow to merge the two projects ( spacesim and ground sim ) together . The way previous coders designed it is not good :
_ A building is a unit that is a part of a FlightGroup ....
if (unittype == "vehicle")
cf.unittype = CreateFlightgroup::VEHICLE;
if (unittype == "building")
cf.unittype = CreateFlightgroup::BUILDING;
A split should be done in the c++ side and python , to differenciate the kind of Units , before using them in a large scaled universe with possibly terrain or planet exploration .

The previous devs used the " in place " .csv system to quickly test loading of meshs etc...for terrain , buildings , but the right way is to have a dedicated system for world ressources . ( with streaming enabled for loading them that would be an efficient way).
A lot of work , yeah .
:wink:

edit : i will have a look to Log0 work , but i think it's in an ogre context .
I want to see how he used quadtrees , perhaps it's possible to adapt his code into
native GFX format .

I would like to finish this thread with the example of a game , that perfectly reflects
the use of continuous terrain with a space simulator game : PRECURSORS
watch that : https://www.youtube.com/watch?v=SrhDiDfjSLc
:wink:

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Need info about CONTINUOUS TERRAIN

Post by klauss »

ezee wrote: ORBIT GROUND TRANSITIONS
_ A new set of functions need to handle the transitions from orbiting to descent ,
the ways i imagine are :
*Splashscreen ( the actual system in use for gamestate change)
*Video CInematics ( A video that shows the descent/landing , but that need a video per vessel ...
* Game cinematics ( The camera is on the ground , and the vessel lands in autopilot-mode )
About the technical aspect of engine/technique change, back when I was thinking about this, I had this idea of using atmospheric friction as a distraction to do the transition seamlessly.

In essence, there'd be a threshold in which a somewhat scripted fireball animation would obscure your view - while this was happening, the engine would pop the continuous terrain into existence, and switch all the techniques for the planet - rendering, physics, whatever. The distraction would make the transition less noticeable, and it would still almost be worthy of the "seamless" name.

So, in essence, my idea is to AP to the planet (autopilot). Like Game cinematics, but allowing you freedom of POV (you can switch views, stuff like that).

I guess the problem isn't really how the player interacts with continuous terrain - even though that's complicated enough - the problem is... what about NPCs?
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Need info about CONTINUOUS TERRAIN

Post by ezee »

I guess the problem isn't really how the player interacts with continuous terrain - even though that's complicated enough - the problem is... what about NPCs?
There are a lot of problems to solve with the terrain generation himself before
going in this .
But it's good to preview the problems in advance when we can , so :

_ If you are talking about NPC as vessels :

They could be spawned at high altitude and land with autopilot , following waypoints as
usual . The traffic could be generated by the .mission file ( as it's the case today ) , or
driven by the AI of the base in the case of persistent vessels ( they stay in orbit waiting
for landing approvals ) .
Vertical landings should be easy to code , and even the physics could be unused for that part . ( Landing with physics can be a headache without a good damping ).

_ If you are talking about the characters of the AI in the terrain :

2 ways could be used , from the easy to the tricky .

* Path following
The NPC ( say a tourist ) go to point A to B , wait 10 minutes , go to C , wait 5 minutes
and is back to A . A could be a arrival/departure lounge .
Other NPC could follow an animation made in blender ( the meccano turn around a ship ,
inspect a part of it , go somewhere in the hangar to search for something , be back to
fix the part , etc ... Same apply for the bartender , the traders etc ...

* Mesh navigation
That is something that i never done before , that is the more dynamic ( your NPCs don't
follow a path , they make their owns using the free nodes that are the vertices of the navigation mesh .
Image
The picture from above is from a blog that describe very well the pros and cons with
path following and navigation mesh :
http://www.ai-blog.net/archives/000152.html

But hey , we are talking about a game into the game ...
From what i've seen in the vegastrike source code , that is not impossible ( in the render loop , a statement like " if( is landing ) { //landing sequence,terrain generation, etc..}" could switch the render method ) but it's not a one man's job .
( one man could make it but who will maintain it , make the 3d assets , do the AI etc...)
:)

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Need info about CONTINUOUS TERRAIN

Post by klauss »

ezee wrote:
I guess the problem isn't really how the player interacts with continuous terrain - even though that's complicated enough - the problem is... what about NPCs?
There are a lot of problems to solve with the terrain generation himself before
going in this .
But it's good to preview the problems in advance when we can , so :

_ If you are talking about NPC as vessels :

They could be spawned at high altitude and land with autopilot , following waypoints as
usual . The traffic could be generated by the .mission file ( as it's the case today ) , or
driven by the AI of the base in the case of persistent vessels ( they stay in orbit waiting
for landing approvals ) .
Vertical landings should be easy to code , and even the physics could be unused for that part . ( Landing with physics can be a headache without a good damping ).
Exactly, but... do you load terrain data for all planets with units landing? (needed for accurate physics)

That could become unmanageable fast.

I think an approximation is needed, and I think, for that, only 2 terrains need to be included:

First, the terrain of the planet the player is landing on. It's the most important terrain of all. Well, to be precise, of all players (there's multiplayer in VS, both online and offline). The online is problematic, because there can be a great deal of players landing, but lets ignore that for now.

Second, is the planet the camer is near to, this is needed to render the planet. In fact, this could be optional depending on detail settings. This would let you focus on a target that is landing, and seeing the right thing on screen.

For most AI maneuvers, I think you're right: waypoints, scripted or easily coded stuff, like mesh navigation (notice this is much harder in 3D, but doable). Keep most of NPC's above the highest terrain feature, and handle the final approach with scripted movements.

Combat is problematic, though. Combat needs terrain-aware NPCs and AI, and it can be very expensive simulating all that for all NPCs engaged near planets.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Need info about CONTINUOUS TERRAIN

Post by ezee »

Combat is problematic, though. Combat needs terrain-aware NPCs and AI, and it can be very expensive simulating all that for all NPCs engaged near planets.
Combat ... in the atmosphere or in space ?

I'm not for a combat simulator in atmospheric flight , it's a third game into the game .
And i'm not for a FPS in terrain , because it's a 4th game into the game .

I mean , all that is very good for the gameplay , but very very difficult to achieve .
A good fps is difficult to make , a good flight simulator too , same apply for a space simulator . It's a challenge even for large commercial companies , with a lot of people involved ( coders and artists ) .

Precursors , the game i have taken as example , is very cool in the fps side and rpg , less
in the space simulator side . I have played 20 or 30 hours with it , and it's a very good game , with a lot of interesting ideas , but still not perfect .
But the devs and the artists involved made a perfect use of shaders , with deph of view
when you reload , beautiful strange and colored alien species , very cool soundtrack , a
background story well written . In fact , they realized what Vegastrike try to be i guess .
The difference is that in precursors , you have ( for what i played with it ) access to only
one spaceship , space stations are the same ( well with minor differencies , but they are beautiful ), you have access to 4*4 and kind of helicopters on ground .
And a lot of guns , yeah ... even strange bio alien gunnery .
Sadly , it is not multiplayer , that game could have been a big success .
I keep a good rememberance of it .
Image

What impressed me a lot , was to discover the planets ground , with all that strange plants and creatures . I think that we don't need to fight on planets , if we :
_ Are shooted down by the ground DCA if we try to ... ( quick fix :mrgreen: )
_ Have enough stuff to discover and trade .

But that don't solve the problem of the terrain generation , the buildings , etc ...
Even if we choosed to not use continuous terrain , but a standard terrain mesh instead ,
we'll need artists to fill it and make it interesting .
So ...
i'm looking again to ogre now , because in less of 3 minutes i can check the result of my
blender's work in my ogre3d program .
And have access to a lot of animations , shaders , etc ...

Rewrite the Terrain and continuousterrain classes is low level opengl engineering .
Using Ogre3D is a high level work , yet difficult , but much more simplified and you have quick results/preview .

This thread was not a WIP for terrain , but initially a search for information .
I know tha amount of work on it now , and i prefer go ahead with a render engine that
can help me out with modern gameplay and visuals .

That said , Vegastrike is a very good project for someone that want to learn low level opengl graphics
in a super cool game .
:wink:

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Need info about CONTINUOUS TERRAIN

Post by klauss »

ezee wrote:That said , Vegastrike is a very good project for someone that want to learn low level opengl graphics
in a super cool game .
:wink:
Well, it's not about the engine and technical aspects, it's about the gameplay. The challenges, I mean.

You can't have terrain without interacting with it, it would be pointless. And you can't have player-only interaction. And you can't have only scripted interaction (again, investing that much effort for scripted eye candy would be pointless).

So... just how would you make terrain a part of the game.

That's my point. You have technical limitations, and you have some kind of gameplay in mind, and you have to find a balance.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Need info about CONTINUOUS TERRAIN

Post by ezee »

Well, it's not about the engine and technical aspects, it's about the gameplay. The challenges, I mean.
So... just how would you make terrain a part of the game.
I don't understand where you go .
Without technically be able to have a terrain or a continuous terrain , you will have nothing on it .
I said earlier what kind of gameplay i would like to create , without fight for keeping the things simple .
How can't you imagine the player interaction with AI , after all my threads about AIML , AI , persistent characters etc ... ?
Exploration is not a challenge , but it's an other kind of experience .

I don't like to loose my time by speaking about this or that when all this or that things will never occur .
But to satisfy your appetite , i will just say that the player could interact with animated 3D characters , as it's the case today in the 2d bases with static textures .

I could say " there will be a lot of fight , the damages will be localized , the Ai agents will work together , be able to use vehicles etc etc ...
But no .
:lol:
I prefer to stay rational , and think first technology ( that VS actually don't have ) and Art ( that vs don't have yet ) for terrain exploration .
A lot of people here are not coders but could be good game designers .
The point is not what i-ezee would make alone with terrain technology , but what the community would like to do with it .

From there , you will know if it's worth the effort or no .
Again , that thread was a look inside something that stayed in the shadow of procedural planets , and that is - in my mind
- a first logical step to them : Procedural generation of lands .
Example with ogre :
http://www.ogre3d.org/tikiwiki/tiki-ind ... rain+Howto

The last major technical question for me is
:
How to generate procedural bases , NPC on procedural terrains .
( and the answer is : Would be created and owned at runtime by the discoverers ,
human or Ai , and you have your gameplay :lol: )

Once you are able to work with a plane , you can try to beat the devil in a sphere .
( the devil lies in the detail-la difficulté réside dans les détails :wink: )

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Need info about CONTINUOUS TERRAIN

Post by klauss »

Fair enough.

Seems like a lot of effort only for explorable planets, and there yet has to be something to do on those planets beyond just exploring the topography, but it could be considered a step towards more action-packed planets I guess.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Need info about CONTINUOUS TERRAIN

Post by ezee »

Back with tech in mind .
I was stuck because the quadtree class was using Dem data to make the mesh .
void QuadTree::LoadData()
{
//Load some data and put it into the quadtree.
nonlinear_transform = new IdentityTransform();
HeightMapInfo hm;
hm.XOrigin = 0;
hm.ZOrigin = 0;
hm.XSize = 512;
hm.ZSize = 512;
hm.RowWidth = hm.XSize;
hm.Scale = 7;
hm.Data = new short[hm.XSize*hm.ZSize];
hm.terrainmap = new unsigned char[hm.XSize*hm.ZSize];
memset( hm.terrainmap, 0, sizeof (unsigned char)*hm.ZSize*hm.XSize );
printf( "Loading height grids...\n" );

//Big coarse data, at 128 meter sample spacing.
FILE *fp = VSFileSystem::vs_open( "demdata/gc16at128.raw", "rb" );
VSFileSystem::vs_read( hm.Data, sizeof (unsigned short), hm.XSize*hm.ZSize, fp );
VSFileSystem::vs_close( fp );
printf( "Building quadtree data...\n" );
root->AddHeightMap( RootCornerData, hm );

//More detailed data at 64 meter spacing, covering the middle of the terrain.
hm.XOrigin = 16384;
hm.ZOrigin = 16384;
hm.Scale = 6;
fp = VSFileSystem::vs_open( "demdata/gc16at64.raw", "rb" );
VSFileSystem::vs_read( hm.Data, sizeof (unsigned short), hm.XSize*hm.ZSize, fp );
VSFileSystem::vs_close( fp );
printf( "Adding quadtree data...\n" );
root->AddHeightMap( RootCornerData, hm );

//Even more detailed data, at 32 meter spacing, covering a smaller area near the middle.
hm.XOrigin = 24576;
hm.ZOrigin = 24576;
hm.Scale = 5;
fp = VSFileSystem::vs_open( "demdata/gc16at32.raw", "rb" );
VSFileSystem::vs_read( hm.Data, sizeof (unsigned short), hm.XSize*hm.ZSize, fp );
VSFileSystem::vs_close( fp );
printf( "Adding quadtree data...\n" );
root->AddHeightMap( RootCornerData, hm );

delete[] hm.Data;
}
An other approach is to use heightmaps instead .
( Dem are perhaps sometimes ( not here :lol: ) more precise than height maps , Libnoise say :
" For an example of what you can do with a large combination of noise modules, take a look at the complex planetary surface page. It contains a program that generates an Earth-sized planet from a combination of over one hundred noise modules, complete with mountains, hills, badlands, and plains. The smallest features on that planet is roughly 7.5 meters. "
)

Libnoise is the library that planets dev often ( always ? ) use to make their elevations map .
Can be used also to generate ground , clouds textures .
There is a tutorial that shows how to use libnoise to generate such maps in c/c++ :

http://libnoise.sourceforge.net/tutoria ... rial3.html

I have started to work with libnoise in ogre3d , i will report the fruits of my experience later .
:wink:

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
Post Reply