Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / will there ever be a dbDeleteTerrain command?

Author
Message
Wikaman1
16
Years of Service
User Offline
Joined: 17th Aug 2008
Location: Scotland
Posted: 3rd Nov 2008 10:26
it would be great if there was. Will there be one in the next version of DarkGDK?
sydbod
16
Years of Service
User Offline
Joined: 14th Jun 2008
Location: Just look at the picture
Posted: 3rd Nov 2008 13:47
Just look at the commands in DarkBASIC Professional V7.0 thread.

That should tell you basically what should also be coming into the new Dark GDK.

I am a bit curious why you would want a dbDeleteTerrain() function?
SunDawg
19
Years of Service
User Offline
Joined: 21st Dec 2004
Location: Massachusetts
Posted: 3rd Nov 2008 22:23
To clean up, if he no longer needed. Seems like a pretty valid idea.


My site, for various stuff that I make.
sydbod
16
Years of Service
User Offline
Joined: 14th Jun 2008
Location: Just look at the picture
Posted: 4th Nov 2008 00:37 Edited at: 4th Nov 2008 00:40
Quote: "To clean up, if he no longer needed. Seems like a pretty valid idea."

Hehehe ..... I think that may be stating the obvious.

I was just wondering why a person may no longer require a terrain object.

Thinking about it, if a person had a multi mission game where each mission was a different terrain, then it could be a very valid requirement.
Wikaman1
16
Years of Service
User Offline
Joined: 17th Aug 2008
Location: Scotland
Posted: 4th Nov 2008 08:37
Quote: "Thinking about it, if a person had a multi mission game where each mission "


yes this is my idea. Currently you have to close the game and load it up again to do a different level.
SunDawg
19
Years of Service
User Offline
Joined: 21st Dec 2004
Location: Massachusetts
Posted: 4th Nov 2008 17:42
Or you can hide that terrain, and make a new one elsewhere. However, that's a waste of memory, as well as being inefficient.


My site, for various stuff that I make.
Shadow Fan 0
16
Years of Service
User Offline
Joined: 27th Jan 2008
Location: Livermore, CA
Posted: 12th Nov 2008 21:33
Quote: "Just look at the commands in DarkBASIC Professional V7.0 thread.

That should tell you basically what should also be coming into the new Dark GDK."


Sadly, something like dbDestroyTerrain is not present in the update...

"...The Protoss do not run from their enemies. Aiur is our homeworld, it is here that we shall make our stand!" -Aldaris
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 12th Nov 2008 22:04
Uhm.... now, I don't know about Dark GDK, but there is a deleteTerrain function in DBPro anyways, and has been for quite a while.


-> Oh, come on...
Shadow Fan 0
16
Years of Service
User Offline
Joined: 27th Jan 2008
Location: Livermore, CA
Posted: 12th Nov 2008 22:55
I meant the function isn't in the Dark GDK update. It continues to baffle me as to why not...

"...The Protoss do not run from their enemies. Aiur is our homeworld, it is here that we shall make our stand!" -Aldaris
Hayer
18
Years of Service
User Offline
Joined: 4th Nov 2005
Location: Norway
Posted: 12th Nov 2008 23:28
You can write your own by using the DirectX device that DGDK engine makes.

randal
15
Years of Service
User Offline
Joined: 18th Nov 2008
Location:
Posted: 21st Nov 2008 14:23
I think a terrain loads as a 3d odject into memory. So you could possibly use dbDeleteObject(int iObject) to remove the terrain. I haven't tried this, but i should work.
Shadow Fan 0
16
Years of Service
User Offline
Joined: 27th Jan 2008
Location: Livermore, CA
Posted: 1st Dec 2008 21:38 Edited at: 1st Dec 2008 21:38
Quote: "I think a terrain loads as a 3d odject into memory. So you could possibly use dbDeleteObject(int iObject) to remove the terrain. I haven't tried this, but i should work. "


You can delete the object number for reuse you're correct there. However, dbDeleteObject(int iObject) does not clean up the terrain data. If you try to make another terrain afterwords you get the wonderfully descriptive error in the attached picture.

"...The Protoss do not run from their enemies. Aiur is our homeworld, it is here that we shall make our stand!" -Aldaris

Attachments

Login to view attachments
Bishop
21
Years of Service
User Offline
Joined: 18th Dec 2002
Location: In my favorite chair...
Posted: 2nd Dec 2008 04:09
Why would you need to delete a terrain? hide it when not in use and use a different heightmap and rebuild it when you do need it.

dbSetTerrainHeightmap( int iID, char* szFilename );
dbdbBuildTerrain( int iID );

BAM! Same terrain with a different heightmap =P

At least, I think you can reassign heightmaps and rebuild them...*ponder*


Tux is my guildmaster.
Shadow Fan 0
16
Years of Service
User Offline
Joined: 27th Jan 2008
Location: Livermore, CA
Posted: 2nd Dec 2008 07:49
Quote: "Why would you need to delete a terrain? hide it when not in use and use a different heightmap and rebuild it when you do need it.

dbSetTerrainHeightmap( int iID, char* szFilename );
dbdbBuildTerrain( int iID );

BAM! Same terrain with a different heightmap =P

At least, I think you can reassign heightmaps and rebuild them...*ponder*"


I tried that too. You get a similar numeric error box if you try to rebuild the terrain (regardless if the heightmap changes). A terrain deletion command would help free up memory and boost performance when you're going long stretches without the terrain object being needed.

"...The Protoss do not run from their enemies. Aiur is our homeworld, it is here that we shall make our stand!" -Aldaris
Alfie
16
Years of Service
User Offline
Joined: 25th Dec 2007
Location:
Posted: 2nd Dec 2008 13:06 Edited at: 2nd Dec 2008 13:09
Yea, basically the problem is once a terrain is loaded that's it.
If you've tried it before you'll realise you can't delete the actual terrain or reload over it (you can delete the object (dbDeleteObject), but that doesn't free it up).

If you want to change levels basically you need a function like dbDeleteTerrain and well... every game has more than one level so it's pretty important!!

Oh by the way has anyone successfully used dbSaveTerrain ()? As far as I know no one has got it to work, but it might just be my system or something... I was trying to save the terrain then load another one over the top as a fix... as I couldn't save the terrain I'm still unsure if you can load an actual terrain over the top of an existing one which is a possibility.
sydbod
16
Years of Service
User Offline
Joined: 14th Jun 2008
Location: Just look at the picture
Posted: 2nd Dec 2008 13:13 Edited at: 2nd Dec 2008 13:18
For the time being, why not just make your terrain from a mesh.
Then you can do whatever you like with it.

Here is a code fragment (pulled out of my current project) that will do just that ( with the same orientation as the terrain functions).



You should be able to adapt it.
Niels Henriksen
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location: Behind you breathing heavely
Posted: 2nd Dec 2008 14:51
sydbod: do you have an example on your 2 image files?

Niels Henriksen
www.tales-of-the-realms.com
if Microsoft can sell software with bugs, so can I.
sydbod
16
Years of Service
User Offline
Joined: 14th Jun 2008
Location: Just look at the picture
Posted: 2nd Dec 2008 16:31
@ Niels Henriksen,

Just be aware that I am dealing with huge terrains with that code.
I am actually producing my screen image with 3 cameras that are overlapping their images, to overcome Z fighting and to overcome close object shaking when camera is a significant distance from 0,0,0 world position due to limitation of single precision floating point numbers.

Anyway use the following files if you want to test it out, as they were the ones I used for the proof of concept.

You will have to create your own semi transparent 0.0f high water mesh, and your -100.0f high ocean bed mesh, so things will line up on the yellow sand marker of the island.

If the upload fails, then please let me know.

Sorry I can never get the Upload applet to work for me, it keeps saying I am trying to upload over 50MB.

Here is a link : http://rapidshare.com/files/169528140/Media1.zip.html
Niels Henriksen
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location: Behind you breathing heavely
Posted: 2nd Dec 2008 20:33
@sydbod:

Thank you. Im interested in see how you are making this huge terrain. Im trying to make the same and its my goal to have that working before I can continue with my project.

Niels Henriksen
www.tales-of-the-realms.com
if Microsoft can sell software with bugs, so can I.
sydbod
16
Years of Service
User Offline
Joined: 14th Jun 2008
Location: Just look at the picture
Posted: 2nd Dec 2008 23:38 Edited at: 2nd Dec 2008 23:45
@ Niels Henriksen,

Should you be interested, and should we have overlapping areas in our respective projects, then maybe you might be interested in working together so that we can help each other, and progress faster..... just a though .

As far as the terrain is concerned, here is my current relevant function.




As far as the cameras are concerned, here are the data structures:

The data structure gets its data from the position and angles of the players aircraft.

The relevant camera code is,



Camera 0 and 1 fly around the real world and view what the player eyes would be viewing.
Camera 2 sits at eye level over a cockpit model and these are currently at 0,0,-50 . this camera sits there and only rotates regarding how the pilots view changes with regard to the view of the cockpit.

The screen is made up from firstly the view that the long range camera displays, then it is overlaid by what the close range camera sees, and this is overlaid by the cockpit camera view.

I am looking into refining the terrain code a bit further by creating a very limited ocean mesh and ocean floor mesh and moving it around within the field of view of the camera (there is no point in having a huge ocean model where most of it is not being viewed at any given point in time). I am still having some troubles with my "void EulerToMatrix( struct Euler Rotation )" and the interpreting of its data to get the true aircraft "Pitch" irrelevant to the aircraft "Yaw" so that I can keep the mini ocean mesh within view. It may just be that I may have to use double precision calculations within my maths code as it may just be a problem of inaccuracies with single precision calculations. ..... will see soon enough.

Anyway hope this gives you something to think about .
Alfie
16
Years of Service
User Offline
Joined: 25th Dec 2007
Location:
Posted: 3rd Dec 2008 01:04 Edited at: 3rd Dec 2008 01:15
@ sydbod
Hey you have some nice stuff there ^^. I'm impressed.

You might find loading RAW format for a height map is better than using a color image (not that it really matters, but saves memory ). You can save RAW format in photoshop. RAW format has no header and is greyscale (basically just a byte array) so best to use a square image (equal width and height).

Here's what I use:



The advantage of using a dbTerrain though is that is does a lot of optimization when you call dbUpdateTerrain ();
When you create a dbTerrain, it creates a bunch of meshes and LODs for each one (I assume). You can set the number with dbSetTerrainSplit. If you make a mirror you will find bits of terrain turning off when you don't look at them Anyway, it does a lot of optimization for you Though you look like you're on your way to your own optimization!
sydbod
16
Years of Service
User Offline
Joined: 14th Jun 2008
Location: Just look at the picture
Posted: 3rd Dec 2008 04:32 Edited at: 3rd Dec 2008 04:50
Hi Alfie,
Thanks for the comments. You have given me something to think about. .
It is nice to see you doing error checking when trying to open a file. It is a shame that most of the DGDK functions do not provide a return value to confirm a successful outcome for their operation.
I am looking towards a flight sim based in the pacific islands.
This means I have to produce a number of islands scattered through an ocean.
The problem with using dbTerrain, is that one can only have a single land or closely clustered island mass as such. When using a separate matrix for every single island, things become much more manageable. It also allows me to determine how I want to manage the frustum culling and LOD for the terrain (but I desperately require some of the NEW functions that will be included in the upgraded new version of DGDK when it gets released).
I suspect that most of us will never produce anything worthy of being called "Commercial Quality", but it is the quest for perfection and learning that makes this whole exercise so satisfying for me.

Login to post a reply

Server time is: 2024-09-30 11:21:51
Your offset time is: 2024-09-30 11:21:51