StepByStep: FTEs terrain editor (draft)

ABSOLUTE BEGINNERS GUIDE TO TERRAIN EDITING

DISCLAIMER: (wip DRAFT ONLY)

PREFACE
Spoike has made an addon for FTE called csaddon.dat which contains some VERY promising features. One that intrigues me is the terrain editor. I’ve seen some amazing shots of VAST landscapes, and would like to make a massive map featuring a landscape like that. However, iiuc, terrains can only be used to make maps which are Q3 format. This means they cannot be played with clients such as EZQuake. This also means that you need to use a q3 map editor in your workflow, because we will be making a q3 map. Unfortunately I know close to nothing about q3bsp mapping, so I’m not sure whether the situation is:

A: You can add a terrain to an existing q1 bsp map, by loading both into a q3bsp editor, and sending them to a q3bsp compiler, or

B: It’s not as simple as that.

Hopefully, it isnt:

C: It’s NOWHERE NEAR as simple as that.

 

Anyway, I’m hoping the answer is A, but am still waiting for a confirmation on this.

INTRODUCTION
There is some basic information about the terrain editor on the Quake Wiki, and a link to a tutorial by Golden Boy featuring some terrific information (and those fantastic screenshots!) but .. it’s not really for beginners, and it assumes you already have Q3 mapping experience. I did find another VERY handy post where Golden boy explains the terrain editor. He also says “The terrain sculpting works just like in Crysis Sandbox, if you’ve ever used that.” I assume he’s talkin’ about this.

Using those tutorials, and with the help of Spoike, echo, and eukara, here’s my attempt at a step by step guide for absolute beginners.

OVERVIEW
The basic procedure is to

  1. Run FTE in terrain editor mode
  2. Make the terrain
  3. Save the information in a foo.hmp file
  4. Make a basic/minimal/template foo.map in your q3 map editor,
  5. Copy the information in foo.hmp file, and add the extra information to the worldspawn entity in foo.map
  6. Compile foo.map into foo.q3bsp

 

DISCLAIMER: I’ve tried to implement this but, as of Sep 2019, have failed to produce a finished result. Even with the help of Gurus, I’ve gotten stuck w errors, missing files, and progress has ground to a halt. So pending further information, the following information remains incomplete at best, and unreliable at worst.

 

WHAT DO I NEED?
1. latest fte 

2. latest csaddon.dat  Put it in: csaddon.dat in: C:/Quake/FTE/

3. A Q3 map editor. If you’re coming from the Q1 world, and havent made a q3 map before, heres an excellent tutorial.

WHAT DO I DO?
1. put csaddon.dat in: C:/Quake/FTE/

2. Run Quake -> single player -> new game

3. To run the addon, you can type “ca_show 1”, and disable it via “ca_show 0”. Most people bind it to a key, by typing at the console (eg) “bind k “toggle ca_show” . NOTE: use ‘k’ because other keys (eg ‘p’) are already used within csaddon). You can turn the csaddon menu on and off now, by typing ‘k’

4. [Credit: echo]  “The next command is very very long but its where the magic happens”

mod_terrain_create NAME “DESCRIPTION” SKYNAME DEFAULTGROUNDTEX DEFAULTHEIGHT DEFAULTWATER DEFAULTWATERHEIGHT

Let’s break it down:

mod_terrain_create  // name of the command

name_of_terrain // what will the file you’re making be called ie “name_of_terrain.hmp”

“DESCRIPTION” // message “description_of_terrain” (note this is in quotes)

SKYNAME  // what sky texture to use

DEFAULTGROUNDTEX  // what ground texture to use

default_height

DEFAULTWATER // what water texture to use

default_water_height

For example:

[code]mod_terrain_create foo "my first terrain" sky4 ground1_6 0 _04water1 4 0 [/code]

This creates a new *.hmp file calleed “foo.hmp”, which looks like this:

[code]
{
classname "worldspawn"
message "my first terrain"
_sky "sky4"
_fog 0.02
_maxdrawdist 0 /*overrides fog distance (if greater)*/
_segmentsize 1024 /*how big each section is. this affects texturing and resolutions*/
_minxsegment -2048
_minysegment -2048
_maxxsegment 2048
_maxysegment 2048
_seed "4" /*for auto-gen plugins*/
_exterior solid
_defaultgroundtexture "ground1_6"
_defaultgroundheight "0"
_defaultwatertexture "_04water1"
_defaultwaterheight "4"
}
{
classname info_player_start
origin "0 0 1024" /*EDITME*/
}
[/code]

 5. After you type that ^ it should say
Wrote maps/foo.hmp

6. “run” this new map via “map foo.hmp” [Note: DON’T forget the “.hmp” – you need the extension!]

7….?

ISSUES

  1. What folder to put cs_addon in? c:/quake/id1
  2. Sky is all garbled – gl_clear 8
  3. “texures didnt load”
  4. If you already have a mod w a csprogs.dat it conflicts – “csaddon doesn’t quite interact too well with other csqc mods” [Spoike: 2019]. This is why we use c:quake/FTE in this example.
  5. “csaddon is blocked in deathmatch, unless you have sv_cheats 1” [Spoike 2019]

Q&A:

Q: How does the terrain editor actually work?

A: [Spoike (from here)] “its some private sparse format, split over multiple files (which allows for some massive terrain).
losslessly exporting it to a raw heightmap would take 16gb.
the texture blends (and granularity) is unlikely to be compatible with other programs, and would be about 16 times bigger, and it would still be missing data.

the sections get written into some ‘maps/FOO/block_XX_YY.hms’ files, which you’ll generally find in some annoying homedir location somewhere that everyone forgets about etc.
use the ‘path’ command at the engine’s console and you’ll see lots of paths, files usually get written to the first one listed.
or `dir maps/*/*.hms` should include the system path info too (and can list dupes if you have the same file in multiple places – a red colour shows inactive entries). ”

 

NOTES:

protocol limit is at +/- 4096 for a total size of 8192qu in each axis.
tell all potential users to set sv_protocol 999, sv_protocolname dpp7, sv_bigcoords 1, or whatever else it might be in their engine
the bsp29 limit is at +/- 32768. breaching that limit is possible by just recompiling with -bsp2 (but also needs the protocol change first)
i assume you’re using protocol 999? otherwise you’re limited to +/- 4096. there may be some issues with subdividing skies. if you get those then just disable sky subdivision (I don’t remember the cvar name) and use a skybox.
beware of lightmap sizes. large surfaces = even larger lightmaps, expect problems if you’ve a large terrain-style map with massive walls.
iirc the only other real limit is are bsp29’s node bounds at +/-32767. compile it as bsp2 to bypass this issue in quakespasm.
other than that all I can really say is to check your map in another engine (eg fte or dp) to see if they cut off at the same place too. if so, its probably the map compiler’s fault.
if you go far enough, you’ll eventually find that floating point precision degrades too much, and everything gets a bit glitchy.
sv_protocol 999 gl_farclip 100000 (or whatever you need)
Node bounds in bsp29 are int16_t so all of the coordinates have to be within -32768 to 32767; bsp2 changes these to float. Not all engines use this value (fitzquake family doesn’t) but winquake/glquake do use it for culling, and it would totally break rendering in those engines if you overflowed the coordinates, so it should probably be a hard qbsp error.
——-
told you, that you can only use one sky, it doesn’t matter if its a skybox or not
you are using more than one
which is a map error
fix the error
thats all that is wrong perhaps
[03:22:19:01:48] <Spoike> mod_terrain_create [03:22:19:01:48] <Spoike> use csaddon to edit the heights+textures [03:22:19:01:49] <Spoike> you may need to edit the worldspawn entity in the .hmp file to redefine the extent of the terrain [03:22:19:01:50] <Spoike> bind c “toggle ca_show”
[03:22:19:01:52] <Spoike> Con_Printf(“%s: NAME “DESCRIPTION” SKYNAME DEFAULTGROUNDTEX DEFAULTHEIGHT DEFAULTWATER DEFAULTWATERHEIGHT seed\nGenerates a fresh maps/foo.hmp file. You may wish to edit it with notepad later to customise it. You will need csaddon.dat in order to edit the actual terrain.\n”, Cmd_Argv(0));
[03:22:19:01:53] <Spoike> the .hmp file is basically just an .ent file [03:22:19:02:01] <Spoike> four-way blend per-section [03:22:19:02:02] <Spoike> each section can have its own four textures [03:22:19:02:04] <Spoike> sections of 1616 quads (1717 verts) [03:22:19:02:05] <Spoike> 6464 texels per section [03:22:19:02:05] <Spoike> with each section being spread over a 10241024 area or so [03:22:19:02:05] <Spoike> (that one is customisable) [03:22:19:02:07] <Spoike> the other limit is that the engine supports 40964096 sections total, so 6553765537 height values across the entire terrain [03:22:19:02:07] <Spoike> or 262144*262144 different lightmap samples.
———
define your wads then so the compiler can find it
there’s two ways. the original way is to use ‘mod_terrain_create foo; map foo’ and then paint stuff with the csaddon.dat thingie (some csqc-based editor util thing – you should be able to find a copy on triptohell.info/moodles). the other way is to just copy the various terrain-specific worldspawn fields from that foo.hmp file and place those into a bsp ‘shell’ map, and then use csaddon to paint it again. be warned that both terrain and csaddon need a bit more polish. obviously, other engines have no chance of displaying any of this stuff properly.
i’m pasting you all the stuff spike told me
play with the apropos command whenever you can’t remember the name of a cvar/console command (or want to see if one exists with some word in its name or description). some cvars+commands will display a description of what they do when you try tab-completing them at the console. check fteextensions.qc for similar things in regard to qc extensions. the descriptions may be a little terse but they should usually be enough to guide anyone that is vaugely familiar with the functionality.
—————
[03:22:19:01:53] <Spoike> the .hmp file is basically just an .ent file [03:22:19:01:53] <Spoike> but with an extra header line [03:22:19:01:53] <Spoike> this predates fte’s .map loading support. [03:22:19:01:54] <Spoike> the .hmp and .map support are actually the same thing now. [03:22:19:01:54] <echos> do you think you can get better terrains out of this, than the old q3a terrains? [03:22:19:01:54] <echos> or does it end up looking about the same? [03:22:19:01:55] <Spoike> the terrain system supports four-way blending at the cost of lightmap colours [03:22:19:01:56] <echos> so no colored lighting on the terrain? [03:22:19:01:56] <Spoike> in theory you could get a better result with q3map2, but in practise it’d fuck up SOMEWHERE [03:22:19:01:57] <echos> yeah the q3map2 is kind of dodgy sometimes [03:22:19:01:57] <Spoike> you can do colours using vertex colours, but its at a lower res than the lightmaps [03:22:19:01:57] <echos> the rtlights will still cast color on it just fine though right? [03:22:19:01:57] <Spoike> the ‘lightmap’ texture that the renderer sees is used for the blend masks [03:22:19:01:58] <Spoike> R+G+B+(1-(R+G+B)) [03:22:19:01:58] <Spoike> each part scaled by one texture [03:22:19:01:58] <Spoike> giving four-way blends [03:22:19:01:59] <Spoike> the alpha channel is then used for a greyscale lightmap [03:22:19:01:59] <Spoike> whereas typical q3 terrain only does two-way blends using vertex alphas [03:22:19:02:00] <echos> yeah they come out looking like a layer cake or neopolitan ice cream [03:22:19:02:00] <Spoike> http://fte.triptohell.info/moodles/junk/fte-20150609160903-0.png [03:22:19:02:00] <Spoike> I’m not an artist. [03:22:19:02:00] <echos> everyones an artist hehe
[03:22:19:02:01] <Spoike> notice how there’s about 5 textures in use there. [03:22:19:02:01] <Spoike> and yes, I was serious when I said it was a 4-way blend. [03:22:19:02:01] <echos> yeah, is that lava in the middle? [03:22:19:02:01] <Spoike> its just a texture [03:22:19:02:01] <Spoike> four-way blend per-section [03:22:19:02:02] <Spoike> each section can have its own four textures [03:22:19:02:02] <Spoike> the section with the lava in it has only one road texture or something [03:22:19:02:03] <echos> how can you blend 4 ways when a triangle has only got 3 vertices? i thought its using the vertices to decide the blending [03:22:19:02:03] <Spoike> … [03:22:19:02:04] <Spoike> I already said the blends were done using the lightmap, not vertexes. [03:22:19:02:04] <Spoike> texture data. [03:22:19:02:04] <echos> yeah thats right [03:22:19:02:04] <Spoike> sections of 1616 quads (1717 verts) [03:22:19:02:05] <Spoike> 6464 texels per section [03:22:19:02:05] <Spoike> with each section being spread over a 10241024 area or so [03:22:19:02:05] <Spoike> (that one is customisable) [03:22:19:02:06] <echos> so theres no need to supply a bitmap to use for the blending, you make it using the csaddon? [03:22:19:02:07] <Spoike> the other limit is that the engine supports 40964096 sections total, so 6553765537 height values across the entire terrain [03:22:19:02:07] <Spoike> or 262144*262144 different lightmap samples.
[03:22:19:02:08] <Spoike> and by lightmap samples, I mean texture blend weightings. [03:22:19:02:08] <Spoike> csaddon acts as a painting program, yes. [03:22:19:02:09] <echos> so the max extents then is +/- 65537 since thats the max height it has? [03:22:19:02:09] <Spoike> you can tell it which textures to paint on, and it’ll add textures to the sections only as needed [03:22:19:02:10] <Spoike> with a section defined as 1024qu*1024qu, you get one height per 64qu, one blend weight per 16qu, and a total map size of 4194304qu * 4194304qu [03:22:19:02:10] <Spoike> or 1.759218604×10¹³ square qu [03:22:19:02:11] <Spoike> sorry, but my calculator broke out into exponential notation. 🙁 [03:22:19:02:13] <Spoike> anyway, lots of numbers. [03:22:19:02:15] <Spoike> note that qc can edit maps, as demonstrated by csaddon [03:22:19:02:17] <Spoike> its not perfect [03:22:19:02:17] <Spoike> it could do with more polish [03:22:19:02:17] <Spoike> but it should work [03:22:19:02:21] <echos> well i’ll try it and see how it looks / behaves, because you did say before going out to some far extents can cause some issues [03:22:19:02:22] <echos> i guess they are precision error from the floating point numbers
end of terrain documentation

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>