OvermindDL1
01-06-2006 02:58:53
I'm using an engine as a dll that runs a game world within, it has no graphics at all, ergo, using Ogre to build on top of it. Ogre works perfectly with it thus far, and now I am needing terrain. The view distances are always quite short (they do not need to be long for this play style, rather above view).
This is how it handles terrain:
When you first load it, you specify the detail of the terrain you want, for example, it can return a point every meter, or every millimeter (although the source may not be anywhere that accurate, some may). You can change the resolution at any time, or even for specific batches, such as points further away could be more corse and points closer could be more detailed. When first loaded, where you are in the world it gives the float's around that area, out to the distance that you specify, sending multiple steps if needbe (gives out a set of floats, closer together and more detailed when close, further apart when further from player). It expects the graphic engine to cache the values, it does not expect it to cache values that are too far away as it will just resend them, possibly modified. The terrain can be modified at any time, and it will send an update when that occurs. Internally (and through the interfaces), all positions are represented using doubles in the x and z, and floats in the y. It is a theoretically infinite world and as the player moves around, it sends the near terrain to the graphic engine. So I am basically asking, would PLSM2 be good to pull this off, and if so I assume I would implement it as follows:
Set the distance far enough to encompass a couple tiles. Call up a set of terrain so far enough away it will be a constant amount, say 1 point per every 5 meters or so, the closer tiles would be updated using 1 point per half meter, maybe less. I do not know how to plug tiles into PLSM2 in real-time though, details?
Also, when you ask for a set of information on the terrain, it doesn't just give the point location, but it gives a variety of information, something along the lines of (I think I am remembering it all, probably forgetting a bit) in pseudo-code:
It has a position for placing it. It has normal's for lighting it (there are day/night cycles). There is technically another water plane as well as the land plane, the water_level specifies the water's height, if the water's height is <= pos_y, then it cannot be seen (possible caves later on though), if water_level > pos_y, then you can see the water at that point and it should be connected with the surrounding water points to make the water surface. The water_normal is obvious. The water_move is what direction the water is moving in, specifying direction and speed. A turbulent water param will probably be added later to specify how turbulent the water should be. The material_id is to a material. A material can be looked up by it's id, in which a material specifies everything from what texture should be used at this point (the graphic engine is expected to blend the graphics of terrain's together), to how much damage and what type is inflicted just by standing/flying/burrowed/etc... on this point, to how fast you can move for varying movement types, and so on, even though the graphics engine will mostly only deal with the graphic, except maybe drawn debugging info for damage area's and such. The flags just hold some other misc info.
Would PLSM2 be good for this, and how would I pull it off?
This is how it handles terrain:
When you first load it, you specify the detail of the terrain you want, for example, it can return a point every meter, or every millimeter (although the source may not be anywhere that accurate, some may). You can change the resolution at any time, or even for specific batches, such as points further away could be more corse and points closer could be more detailed. When first loaded, where you are in the world it gives the float's around that area, out to the distance that you specify, sending multiple steps if needbe (gives out a set of floats, closer together and more detailed when close, further apart when further from player). It expects the graphic engine to cache the values, it does not expect it to cache values that are too far away as it will just resend them, possibly modified. The terrain can be modified at any time, and it will send an update when that occurs. Internally (and through the interfaces), all positions are represented using doubles in the x and z, and floats in the y. It is a theoretically infinite world and as the player moves around, it sends the near terrain to the graphic engine. So I am basically asking, would PLSM2 be good to pull this off, and if so I assume I would implement it as follows:
Set the distance far enough to encompass a couple tiles. Call up a set of terrain so far enough away it will be a constant amount, say 1 point per every 5 meters or so, the closer tiles would be updated using 1 point per half meter, maybe less. I do not know how to plug tiles into PLSM2 in real-time though, details?
Also, when you ask for a set of information on the terrain, it doesn't just give the point location, but it gives a variety of information, something along the lines of (I think I am remembering it all, probably forgetting a bit) in pseudo-code:
struct
{
double pos_x;
float pos_y;
double pos_z;
float norm_x;
float norm_y;
float norm_z;
float water_level;
float water_norm_x;
float water_norm_y;
float water_norm_z;
float water_move_x;
float water_move_z;
unsigned int material_id;
unsigned int flags;
}
It has a position for placing it. It has normal's for lighting it (there are day/night cycles). There is technically another water plane as well as the land plane, the water_level specifies the water's height, if the water's height is <= pos_y, then it cannot be seen (possible caves later on though), if water_level > pos_y, then you can see the water at that point and it should be connected with the surrounding water points to make the water surface. The water_normal is obvious. The water_move is what direction the water is moving in, specifying direction and speed. A turbulent water param will probably be added later to specify how turbulent the water should be. The material_id is to a material. A material can be looked up by it's id, in which a material specifies everything from what texture should be used at this point (the graphic engine is expected to blend the graphics of terrain's together), to how much damage and what type is inflicted just by standing/flying/burrowed/etc... on this point, to how fast you can move for varying movement types, and so on, even though the graphics engine will mostly only deal with the graphic, except maybe drawn debugging info for damage area's and such. The flags just hold some other misc info.
Would PLSM2 be good for this, and how would I pull it off?