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 / DarkGDK Terrains

Author
Message
Triumph Daytona
14
Years of Service
User Offline
Joined: 18th Apr 2010
Location: UK
Posted: 9th Jul 2010 20:12
I'm developing a 'project' -- one of the features being that the game is played on a "very, very large terrain" which, in reality, is made up of lots of "very large terrains".

I had intended that as the camera moves over the terrain, you switch from one terrain to another. The problem for me, DarkGDK 7.3 didn't have a dbDeleteObject function.

However, in DarkGDK 7.4 -- there is such a function. However, reading around the problems of upgrading from 7.3 to 7.4 -- I thought I would wait awhile before upgrading.

In the meantime, I did upgrade the header and library for the Terrain package -- so, although I'm running 7.3 (core) I'm actually running the terrain 7.4 version.

So, switching between terrains works like this:

1. Build the terrain as standard.
2. Use dbUpdateTerrain(); and dbSync(); as standard.
3. When the event to change terrains fires:
3.1. Save down the camera's co-ordinates.
3.2. Call dbDeleteObject(); to remove current terrain.
3.3. Create the new terrain (as standard) using a new object pointer.
3.4. Restore the camera positions.

However -- the thing is -- you can't then call dbUpdateTerrain() on the new terrain. If you do; it crashes (at least for me). And the strange thing is -- the terrain updates anyway without having to use the dbUpdateTerrain on subsequent terrains.

There's slightly more to it than that:

1. The terrain map extends beyond the skybox. So, when you move around the terrain, you move the skybox accordingly. This means you never actually get to see the end of the current terrain (things are scaled to next to nothing) and as you move, things appear over the horizon seamlessly (e.g. mountains, etc).

2. When the edge of the skybox reaches the end of the current terrain -- that's the event to switch terrains. Which means, the hieght maps and textures have to have some overlapping element (the width of the skybox to be exact). By having the overlapping parts in the height map means when you switch between terrains, you preserve continuity and and player's reference is all within the same skybox.

Hope this helps -- if you need; I'm happy to upload code samples and image files to make this more clear.

Dave.
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 11th Jul 2010 13:09
dbUpdateTerrain() culls all polygons that you can't see (behind you etc), are you sure it is doing this without calling it?
You can use dbStatistic(1) to find out how many polys are being drawn.

Do you need to delete the terrain, can you hide it?

I have never done what you are trying so I'm sorry I don't have any solid answers.

Triumph Daytona
14
Years of Service
User Offline
Joined: 18th Apr 2010
Location: UK
Posted: 11th Jul 2010 13:21
Hiding terrains? I tried (and failed) on a few attempts. What I found was that sometimes the new terrain old terrain would conflict and the end result was a merged terrain. Plus, long term, I'm not too sure about the objects placed (buildings, etc) but I guess they will need deleting in any case.

I'll complete my prototype and put the source up on my website later. Plus I'll add more stats (FPS, polys, etc) -- feel free to take a look, etc.

Dave.
Triumph Daytona
14
Years of Service
User Offline
Joined: 18th Apr 2010
Location: UK
Posted: 19th Jul 2010 21:27
Well, I said I'd put a demo together -- so, here it is. This uses 9 "terrain" files stitched together in a 3 by 3 grid. I've put 3 objects in place to demo object collision in a terrain file.

Usual keys WASD plus left-ctrl for 'crouch' (to demo crawling into a barrel).

Not quite 'glitch free' as once inside the barrel you can stand up (doh!) nevermind ... plus, there's a flicker when you walk out of one terrain into another (working on that).

Provided you've already downloaded August 2007 DirectX 9.0c SDK then:

http://www.american-wasteland.com/resources/bin/aw0.3.exe

Username = dark; password = gdk

If anyone knows how to do skydomes and horizontal antialiasing -- v. fast please would really like to know.

Dave.

Login to post a reply

Server time is: 2024-11-19 20:52:49
Your offset time is: 2024-11-19 20:52:49