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 / Use Bitmap for Height Map

Author
Message
Rainbow Evil
14
Years of Service
User Offline
Joined: 31st Mar 2010
Location:
Posted: 13th Sep 2010 02:49
Hi,

I am trying to create a worldbuilder for a game I am creating and after trawling the internet for a while, searching for a way to adjust the terrain, I decided to use a method whereby a bitmap image would be used for the height map which would be open in the background. This would then be edited when the user tries to adjust the terrain height and the height map re-applied to the terrain in real time.

The question I want to ask is how can I use a bitmap as the height map? Under the information on dbSetTerrainHeightMap, it only specifies using an ID for the terrain and a file name for the height map and has no function overloading, which is confirmed in C++. Does this mean the only way to achieve this is to constantly save and load the bitmap? If so, this would be extremely inefficient and I would therefore need to search for another method

Thanks in advance

take a look at (and rate!) my Dark GDK/MultiSync tutorial - http://tinyurl.com/multisync
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 13th Sep 2010 02:58
there are functions to set some specific vertices height, i'm not sure which and how as i never tried, the documentation is lacking these so you'd better search your /include directory for the word "Vertex", and see functions, they might be self-explained

also, if you can find them then maybe you need to check out GDK 7.4 if you dont have it

Rainbow Evil
14
Years of Service
User Offline
Joined: 31st Mar 2010
Location:
Posted: 13th Sep 2010 03:26 Edited at: 13th Sep 2010 03:54
Are you saying that what I wanted to do is impossible without saving and loading then? If so, that seems quite counter-intuitive and I would have imagined that it wouldn't be very difficult to implement something like that - all they would need to do is create a function which skips the loading part!

Onto the line about Dark GDK 7.4, where could I find it with instructions on installation? I haven't updated my Dark GDK since I first downloaded it about a year and a half ago! Searched google but didn't find any links to this site which had a download link.

Thanks for the quick reply.

Take a look at (and rate!) my Dark GDK/MultiSync tutorial
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 13th Sep 2010 04:01 Edited at: 13th Sep 2010 04:03
to update, go to the gdk 7.4 thread, download the first link from first post, replace your libs/headers (/include and /lib in gdk directory) with the downloaded ones, the SCROLL DOWN, there is a patch, a new core & display libraries in it, they include fix for the 3d rendering, around the middle of the page

you got it the opposite way, its impossible with loading and saving, only possible without it!

vertices are "3d points" which an object is made of, there is something called indices (an array of WORD/DWORD), each 3 indices define one triangle, by having the vertex id in their value, for example:

GDKVERTEX verts[24]; //24 vertices
verts[0] = blabla...
verts[1] = ...
....
....

WORD indices[36]; //36 indices, = (36/3) triangles (12) so the shape (object) has 12 triangles, indices define how those triangles are formed
indices[0] = 0; //indice 0 is the vertex 0
indices[1] = 1; //1 = vertex 1
indices[2] = 2; //2 = vertex 2, now we formed one triangle made up of vertex 1, 2 and 3
indices[3] = 2;
indices[4] = 4;
indices[5] = 3;//another triangle made up of vertices 2,4 and 3 (note that in directX, the order matters! (opposite order is backfacing)
....

and that's how object are formed (simply file format are made up of such data)

you dont want to change indices, as they define how triangles are made, they're fine! we need to change vertices which are the corners of the triangle, so it placed in a different way.

i believe i suck at explaining and just got you in a maze, you better read some about it on the net, it's generally useful thing to know, will help you on MUCH, MUCH things in your game programming journey!

back to your question, all you need to do is to find the function that changes a vertex's data, changing a vertex's position will make a change on the terrain

probably terrains wont be modifiable, i think you should either create a matrix, or a normal object

if you need any further help let me know

Rainbow Evil
14
Years of Service
User Offline
Joined: 31st Mar 2010
Location:
Posted: 13th Sep 2010 18:12 Edited at: 13th Sep 2010 18:34
Thanks for the instructions on updating Dark GDK and the explanation of how indices and vertexes work.

Why wouldn't terrains be modifiable this way? If they aren't, doesn't that mean I lose lots of functionality that the terrain objects provide - things such as dbGetTerrainGroundHeight which will be necessary for worldbuilding tools such as unit and scenery placement...

Also, after making a stupid mistake during the update, I think I accidentally replaced the lib/vs9 folder with the new one which deleted any .lib files that weren't updated (idiot, I know!) and I also didn't have a lib/VS9Debug folder until this and would imagine there would be files missing from there as well... is it possible to download just those files from somewhere or have someone attach them to their post?

thanks again for the help so far

Take a look at (and rate!) my Dark GDK/MultiSync tutorial
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 13th Sep 2010 18:55
Well terrains wont work because the commands for getting vertex data is only for objects, i dont know if there is a way to do it for terrains as i didnt try, but i think you can make your own getterraingroundheight function.

Oh god, how did i forget this....take a look at BlitzTerrain (made by kaedroho), its the best terrain plugin, it includes LOD and alot of features maybe it fits your needs, it can be found here : http://forum.thegamecreators.com/?m=forum_view&b=8&t=145404&p=0
just read the demos and see the header files and see if the functions suit you, this will save you tons of headache.

Rainbow Evil
14
Years of Service
User Offline
Joined: 31st Mar 2010
Location:
Posted: 13th Sep 2010 20:00
thanks for the link to blitz terrain, this sounds like a very useful tool!

Not to sound like a broken record, but is there anywhere I could find the Dark GDK .lib files for lib/VS9 and lib/VS9Debug? I am very annoyed about having made the mistake of replacing the folder with the new one and not just replacing the old contained files, but I can't find these files anywhere unfortunately. If anyone could ink me to them or compress them and attach them to a post I would be very grateful.

Thanks again, Hassan, for all your help

Take a look at (and rate!) my Dark GDK/MultiSync tutorial
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 13th Sep 2010 20:31
well just re-download gdk 7.3 and reinstall it, then patch it up and make sure you dont do the mistake again

Rainbow Evil
14
Years of Service
User Offline
Joined: 31st Mar 2010
Location:
Posted: 13th Sep 2010 20:49
but 7.3 (and all since then) do not contain some .lib files. For example, the error message when trying to compile says "fatal error LNK1104: cannot open file 'atls.lib'" which isn't in 7.3 or 7.4 as I guess they haven't changed since the original download. I believe this isn't the only .lib file missing, just the first alphabetically and therefore it stops after not being able to find it.

Take a look at (and rate!) my Dark GDK/MultiSync tutorial
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 13th Sep 2010 21:47
you dont need atls.lib, you need to ignore it in the project properties

Rainbow Evil
14
Years of Service
User Offline
Joined: 31st Mar 2010
Location:
Posted: 13th Sep 2010 22:01
ahhhh, thanks - works fine and blitz terrain stuff looking good. Thanks for all the help

Take a look at (and rate!) my Dark GDK/MultiSync tutorial

Login to post a reply

Server time is: 2024-11-19 18:42:49
Your offset time is: 2024-11-19 18:42:49