Setting the height that units appear when on ocean tiles

Deliverator

Graphical Hackificator
Joined
Feb 12, 2008
Messages
4,813
Location
London, UK
I would like to figure out how to make units on ocean tiles appear at the level of the sea bed rather the level of the ocean surface.

The reason is that in the Dune Wars mod we have removed the graphical effect of the ocean surface and now units look like they are floating in space.

The screenshot illustrates the problem - from above things look OK, but when you zoom in the grid shows how far the unit is hovering above the 'ground' (sea bed).
 
Sorry this has nothing to do with fixing your problem, but may I ask how you created that terrain? I have been wanting to add a plateau feature to the game. I was going to try and make it myself but what you made looks almost exactly like what I wanted.
 
Sorry this has nothing to do with fixing your problem, but may I ask how you created that terrain? I have been wanting to add a plateau feature to the game. I was going to try and make it myself but what you made looks almost exactly like what I wanted.

He just removed the water graphic from the ocean. So what your seeing is the ocean floor. Theyre basically walking on what used to be the surface of the water. For a plateau you'll probably have to do it different.
 
Deliverator: Do units ever go from the normal land to the lower land /sea bed (I take it thats supposed to represent deep desert)?

Yes, that is how we are representing the deep desert. A small number of units can move on both land and deep desert.
 
He just removed the water graphic from the ocean. So what your seeing is the ocean floor. Theyre basically walking on what used to be the surface of the water. For a plateau you'll probably have to do it different.

Well, back to the drawing board.:sad: Thanks anyways.
 
Well as far as I can see no one has posted on modding the heightmap so I thought I'd share what I've found so far.

The height of the terrain is controlled by the files in the directory assets/art/terrain/heightmap. The files are 16x16 TGA images looking like this:

attachment.php


The closer to white the pixel the higher the terrain - the closer to black the lower. If you have a graphics editor that can show the HSV for the pixels then the V value effectively maps to the terrain height.

It seems like the sea level is effectively a hard-coded minimum height at which units can appear. So, I decided to attempt to raise the height of all terrains by an equal amount to bring the sea bed up to the level of the ocean. To do this, I simply adjusted the brightness of the following TGA files by the same amount: ocean1_1.tga and all the files in coasts and flats subdirectories. The heightmaps in the subdirectories hills, peaks and coastblendmasks seem to be heightmap filters that are applied after the initial heights are construct from the other files.

The result succeeds in the main aim in that units now walk on what was formerly the sea bed since the entire landscape is shifted up vertically.

attachment.php


Sadly, however the coast heights are no longer smooth and so the result is not really acceptable right now. See last two attached screenshots.

I have searched for the names of these heightmap TGAs, but the only reference to them I can find is in Civ4BeyondTheSword.exe. I think unless the tga files can be edited in such a way as to get the coastlines smooth then I can't go any further.

I'm interested to try making the shape of the terrain more interesting using the heightmaps too.

Edit: I wasn't saving the TGAs in quite the right format - I saved them using Paint Shop Pro and the coasts are now smooth. :)
 
I'm interested to try making the shape of the terrain more interesting using the heightmaps too.

Edit: I wasn't saving the TGAs in quite the right format - I saved them using Paint Shop Pro and the coasts are now smooth. :)

Very interesting. What format did you have to save it in?

One thing though. In your pics it still looks like the "sea bed" is lower than the land terrain. And that it is the units that are now lower rather than the sea bed that was raised. Which is what you were aiming for, but kind of the opposite of what you describe. What gives?
 
Great to hear, that you've found a way to do it :goodjob:.
I thought, that it would sure be controled by the .exe and not to be modable.

But i have the same question like achilleszero: What will happen with ships?
When i'll re-create my terrain (also with lowered terrain), i'll sure have a look at that, but my mod also contains ships, and i guess, that'll be a problem.
 
Hopefully this diagram shows what I was aiming for, and how I achieved it.

attachment.php


Effectively, since the sea has no water, we want it to operate as another height of land terrain from a graphical perspective, while treating it as ocean from a gameplay perspective.

Here are a couple of shots of the final result:
Spoiler :
attachment.php

attachment.php


I'm not exactly sure what the TGA format required is yet. I saved my edited TGAs in Paint.NET and the resultant files were only around 768 bytes. I noticed that the vanilla ones were around 1K. I tried a few different paint programs and when I tried a really old version of Paint Shop Pro the files came out at 1K and they gave the smooth edges I was looking for. There is a probably a way to get other paint packages to output these 1K heightmap TGAs - something to do with bit rate perhaps.

There is no water and there are no ships in the Dune Wars mod, which is quite an unusual case, but maybe people can do something interesting with shaping the terrain even in mods with water. For example, you could make the surface of the land more uneven by creating more variation in the heightmap/flats files. I'm going to try that myself. You could also create a plateau heightmap, but you'd have to sacrifice either peaks or hills to do it and be warned there are 80+ files to edit for the hill/peaks heightmap filter TGAs.
 
Interesting, thanks :goodjob:.

The question for me will be, if the height of the ships is adjusted by the sealevel, or by the ground.
If first: No problem.
If second: I'll have to adjust all ships in Nifscope.
Doesn't matter, what option, i guess, it'll maybe be a problem with the subs, and rendering below water will not work.


...erm...could i use your heigtmap? Would be really nice :).
 
Back
Top Bottom