Theater developmental notes - The Tile's
-
There seem’s to be some continued confusion about how terrain tile’s work in Falcon.Though I have posted many time’s my understanding,through testing, observation and researching the CODE for 10+ year’s, we still seem to miss important thing’s.
So in this thread I wish to employ the KISS method in hope we ALL finally understand.
I know in past post’s here and @ PMC\FF\OF\Frug’s…etc. Fora I have been a bit facicious\abserbic on the subject.Sorry!!!BUT my feeling is,if you can’t understand the tool’s,concept’s,file structure…etc. in Falcon.Then you should not be modifying itIn closing,PLEASE CODER’s,MODDER’s and USER’s FEEL FREE to add\correct where needed.This will further my philosphy of “We don’t know what we don’t know,BUT we can find out” in Falcon!!!
Here Go’s nothing:1ST…A tile is an image/picture(Texture) that the GFX engine “draws” over a wireframe (the Terrain) No different at this point than a Google Earth tile used by map maker’s other than it is in a compressed format (.DDS) for Falcon.It in itself doe’s not contain any data other then pixel(picture element) count and pallette (color) After this Falcon has nothing more to do with it then put it on a list to be rendered by the GFX engine.
2nd…When we take these picture’s in Falcon and apply them to a certain XY coordinate on our MAP.She has a way for us to “Group” them together(16 images per group max,4096 total ATM).These are called “SET’s” and that DATA is saved in the texture.bin file.Basicly “Set’s” allow us to apply a “Terrain TYPE” to every texture in that “Group\Set”.This is essential for large area’s,say Mountain’s\Water,that we want to exclude\allow GU movement over.
3rd…Now we have our “Set’s” defined in the texture.bin.Let’s say we made the “Set Type” Water and it has an Airbase tile in it???Problem…exploding AC when you spawn on that tile.We can now define an “AREA” on said tile.So now we edit that tile in texture.bin and make an “AREA” of “Plain’s” on it, then wa’la,no more BoomBoom when you spawn Get It???
4th…So we should understand now,I hope, that a “Set Type” define’s the “Terrain Type\AREA” for every tile in that “SET”,but we can edit any tile in that set and define a new “AREA” on it…kewl!!Here is where the confusion set’s in.“Hell,demer I did what you said,but they still won’t move” (direct quote from an old PM) I’ll get back to that in a minute.
5th…Now we have our “Tile” in a “SET” with a defined “AREA” on it.We would like the GU’s to move over it.How do we tell them that they can??? We define a “PATH” on the tile in texture.bin!!!Now “PATH’s” on a “Tile” have nothing to do with “Objective Link’s” at this point!!!Bear with me a minute and I’ll get back to it.
So we need to “PATH” this tile.HOW???Well you can draw just one ROAD pixel on it, then the cODE read’s the entire tile as “Pathed” and as long as the “Touching” tile is “Pathed” then they go on their merry way.IF you want to “FORCE” them to the road image,then you have to draw the entire path,as best you can,on the tile(Remember this Data is NOT stored in the .dds image,just in the texture.bin)6th…Now we have a tile,in a set (insert your set TYPE here) with a defined area of plain’s and a “Road Path” defined on it, but there is a “River” path that intersect’s the road…HMMM??? Your GU’s stop and then go chasing off along the river until they find a point to cross or in worse case, not.We now need to define a “Bridge Path” over the “Road Path” so they can cross…Get IT???They don’t NEED a Bridge Objective\Feature there.They DON’T CARE,they just need a “Bridge PATH” to get over this…that is all.
7th…Getting back to “Hell,demer I did what you said,but they still won’t move” There is other DATA that Falcon use’s to determine where,how and when a GU can\cannot move over the Terrain.For this diatribe I am only concerned about the Terrain.There is another file at this point where DATA is stored and shared in Falcon that effect’s the GU’s movement over the entire “TERRAIN”.(NOT talking about “LINK’s” here,they are SEPERATE from TERRAIN!!!..Get IT???) It is often ignored or not understood by us.That is your .thr file.This file is the intersection of your terrain and your campain’\theater and contain’s Data that Falcon use’s,as in his case,he had no clue(Trying to make them drive up a mountain…;) )
_EDIT1:A little bit from “Baldeagles” Pathmaker manual circa ~2001,some of the naming convention’s have changed though (Thank’s Fred,saved me alot of headache’s over the year’s…:rtfm:LOL)
"Paths
- Paths are used in Falcon 4 to draw roads and rivers on the Ground Radar display. There are 4 Path Types available: River, Road, Bridge and Railway. The <theater>.thr’s Road along with Cover Type and Relief information are used to calculate the Cost to travel various routes from their current position to the Objective. When the units encounter a Bridge Path segment, a request is transmitted for the status of the bridge object over the river. The River Path delineates areas in the tile where the ground units cannot go without a means to cross the river. Although Railway type is checked in Falcon 4, I am not sure how ground units will use this type of path.
Areas
- Areas are used in Falcon 4 to determine the cost for ground units to follow a path through the Area type defined in a tile. There are 10 Area Types available: Water, Swamp, Plains, Brush, Thin Forest, Thick Forest, Rocky, Urban, Runway and Station. The defined Areas with Cover Type are used to calculate the Cost to travel various routes from their current position to the Objective. When there are high cost areas between the ground unit and its objective, the unit will try to take a lower cost route. Thus, high-cost areas in the tile might block the route through an area they should not travel, such as ocean, lakes, rocky areas or thick forest. The use of Runway and Station types is unknown. Station type sounds like a railway station area. Runway type may be for airbases, but it is not used in the original tile’s areas. From this discussion you can see how important it is to lay down good areas. Look at the original Korea tiles to get an idea of how the F4 developers defined paths. Be aware that not all of the F4 people did a good job. I have found many errors with the way paths and areas were defined."</theater>_
EDIT2: for you Ted…. <theater>.thr file…is built, in the various tool’s,i.e TerrainView,PathMaker,TerrainEditor from the Theater.L2 and Texture.bin file’s.Without getting into extreme detail,suffice it to say, there are “byte’s and bits” contained in the file for each tile in your theater….(WHEW!!! think about that math for a minute…LOL).
The three most important for your campain’s\theaters to run correctly are: Terrain\Cover\Set Type and Path Data from the Texture.bin.And Elevation Data from the Theater.L2.
ANYTIME you change ANY data in those two file’s you MUST rebuild your <theater>.thr file against the new data.Get it???</theater></theater>_EDIT3: This is how the CODE see’s “PATHS\AREAS”
@*****:
Here you go……
// Return the type of ground under the specified point on the ground. int GetGroundType( float x, float y ) { // Grab the texture ID at location x,y int texID = Terrain.GetTexID( x, y ); // Check all segment features for inclusion int pathCount = 0; int i = 0; int type = -1; TexPath *path; Edge segment; TexArea *area; GET_NEXT_PATH; while ((type == -1) && path) { pathCount++; float r = path->width * 0.5f; // Skip this one if we're not inside its bounding box if (path->x2 < path->x1) { if ((path->x2 > x+r) || (path->x1 < x-r)) { GET_NEXT_PATH; continue; } } else { if ((path->x1 > x+r) || (path->x2 < x-r)) { GET_NEXT_PATH; continue; } } if (path->y2 < path->y1) { if ((path->y2 > y+r) || (path->y1 < y-r)) { GET_NEXT_PATH; continue; } } else { if ((path->y1 > y+r) || (path->y2 < y-r)) { GET_NEXT_PATH; continue; } } // Now check the line segment itself segment.SetupWithPoints( path->x1, path->y1, path->x2, path->y2 ); segment.Normalize(); d = (float)fabs( segment.DistanceFrom( x, y ) ); if (d < r) { type = path->type; } GET_NEXT_PATH; } // Check all area features(Type's) for inclusion uint32 areas = 0; i = 0; area = TheTerrTextures.GetArea( texID, 0, i++ ); while ((type == -1) && area) { float dx = x - area->x; float dy = y - area->y; float d = dx*dx + dy*dy; if (d < (area->radius * area->radius)) { type = area->type; } area = TheTerrTextures.GetArea( texID, 0, i++ ); areas++; } // Get the basic terrain type of this tile if (type == -1) { type = TheTerrTextures.GetTerrainType( texID ); } return type; }
Thank’s from a fellow Welshman ;)_
I really hope’s this help’s,sorry if I missed some point’s\question’s
No EGO demer -
Thanks Dave. Mods can we make this a sticky?
-
Good info Dave. Thank you.
Nikos. -
This is good write Dave, thanks. Please continue it to cover .thr file.
It looks to me that all that path and area business is to channel GUs across the water. Touching the tile just with the dot of the road while permissible may and IMHO probable cause GUs to “spill” from the tightly controlled roads by which traffic can be “channeled” to the bridges in the most efficient and cheap (movement points )way. And yet it is obvious that GUs should be able to do fighting in other than the road areas. It is sure complex AI issue.
I remember some interesting discussion about it on PMC forum. I’ll try to find it.
-
Dave, Thank’s.
I remeber you wrote similar at PMC, but not that detailed.@Ted,
I’m curious with which PMC thread you’ll come up.:munch:
Cheers,
LS -
Post #1 updated……;)
demer -
I was browsing the old PMC posts and realized we covered this stuff 3+ years ago over there. Man alive.
-
Thnaks mate. Nice post.
-
I was browsing the old PMC posts and realized we covered this stuff 3+ years ago over there. Man alive.
HAHAHAHAAA……Mike…seem’s we still don’t Get It…:(
Dat’s OK we’ll try again here.Dave
-
well sorry but PMC is a chaotic place also it is for many flavors. To find your way there u need months just looking around… and why is that sure there is the wiki but some stuff are old and lot’s of tips and tricks and discussions are on threads on specific theaters. So for some even old guys here those things are unknown as it is proven to be.
Also lot’s of attempts are one man show… well one man can’t do and remember and know everything on the subject.
-
Thank’s Guy’s & Gal’s…
Post #1 updated again…;) (Old\New info from some Falcon Coder’s…HEHEHE)
@ALL…Please feel FREE to ask question’s or contribute answer’s to the thread…but,please no EGO antic’s here.
Just share what we may or may not know.That is the only Correct way to do it…demer
-
Nice thread so far, but I have questions
Can a set contain mixed res tiles, or do they all have to be the same res?
If not can different sets use different res?
If we use different res is the actual ‘tiling’ in world space still a pure equal sized square grid? Ie the higher res tiles just appear crisper as you fly over them?
Is there a common grid density people adhere to? Ie 500m per tile for instance?
Are there any polygonal mesh constraints to think about, or is uv mapping of the main terrain all handled by the engine?
Do we build terrain meshes and let a tool chop that up too into manageable chunks?
I was a big fan of Tornado back in the day and it’d be cool to make a little map with similar campaign style, but richly packed with lots of details etc. They were only about 100nm square iirc… Fantasy removes lots of constraints too, vs copying something.
Lastly, any tools to go from Max to terrain mesh? Or conversion processes?
Thanks
Dave
-
@Mr:
Nice thread so far, but I have questions
Can a set contain mixed res tiles, or do they all have to be the same res?
If you mean can they be different resolution sizes, yes they can be different/mixed.
@Mr:
If we use different res is the actual ‘tiling’ in world space still a pure equal sized square grid? Ie the higher res tiles just appear crisper as you fly over them?
Normally, the higher the res, the better the quality. BUT, that all depends on IF the tile artist does good work. You could essentially have higher res tiles but they could look bad, depending on whether they are sloppy or not, if you know what I mean
@Mr:
Is there a common grid density people adhere to? Ie 500m per tile for instance?
1KM
@Mr:
Are there any polygonal mesh constraints to think about, or is uv mapping of the main terrain all handled by the engine?
Do we build terrain meshes and let a tool chop that up too into manageable chunks?
Not sure exactly what you’re asking. Terrain tilers build the tiles at whatever res they want, say 512x512, so he/they determine the size of the tile artwork
@Mr:
Lastly, any tools to go from Max to terrain mesh? Or conversion processes?
To get started and build a mesh, you need to get Dem2Terrain. You need to get the Geo Data and also the country E00 data, roads, water, etc and build the mesh with Dem2Terrain. You may want to go to PMC and check out the tutorial on theater building. Some things are outdated but there’s enough to get you going.
After that you would want Sakis’s Terrain Editor.
I’m in a rush, so I hope I understood what you are asking. Making a theater, the terrain mesh, the terrain tile art work is a very huge job.
RAM22
-
Hmmm, had a read over at Monsters Tools site, the format makes sense now.
64/128 Segment theatre size options, possibly even 256.
A segment = how many tiles? 16 by my calcs, makes Korea theatre 1024km x 1024km.
It looks like the height field data is 16bit and hard coded to feet, so 0-65536ft!
It also appears the grid is a pure square grid with each tile uv mapped to fill it, so a tile per polygon basically.
I’m guessing the grid size is hard coded at 1km which is pretty wide, that is the biggest shame overall. Even Tornado had higher poly density hehe
Such a shame that we can’t increase poly count since getting nicer hills would be niceSo it seems like we will be stuck with mainly updating textures.
PS I have a 3ds max script that pretty much makes the Topo map format from a mesh. Not sure how useful it might be. I’d probably model terrain in max, possibly even paint tiles. The lod0 format is quite basic to script a raw hex output.
Just gutted it’s only 1km res, but such were the limitations back in the 90s. Im certainly not gonna get tight low-level flying looking nice (ie Mach Loop) Time to see how rivers/bridges and buildings etc are defined… Is it all x/y coord based in essence?
Looks like a fairly flat inland area is best if you want it to all feel as realistic as possible
Perfect for a Tornado mini map
Thanks
Dave
-
@Mr:
Hmmm, had a read over at Monsters Tools site, the format makes sense now.
64/128 Segment theatre size options, possibly even 256.
A segment = how many tiles? 16 by my calcs, makes Korea theatre 1024km x 1024km.
It looks like the height field data is 16bit and hard coded to feet, so 0-65536ft!
It also appears the grid is a pure square grid with each tile uv mapped to fill it, so a tile per polygon basically.
Just gutted it’s only 1km res, but such were the limitations back in the 90s. Im certainly not gonna get tight low-level flying looking nice (ie Mach Loop) Time to see how rivers/bridges and buildings etc are defined… Is it all x/y coord based in essence?
For more format info and terrain/theater creating info at all, … look at the PMC WIKI
(already suggested by RAM22)
http://tactical.nekromantix.com/tactical/wiki/doku.php?id=falcon4@Mr:
PS I have a 3ds max script that pretty much makes the Topo map format from a mesh. Not sure how useful it might be. I’d probably model terrain in max, possibly even paint tiles. The lod0 format is quite basic to script a raw hex output.
I would be interested in that 3ds max script, if it works with max 2011.
@Mr:
Looks like a fairly flat inland area is best if you want it to all feel as realistic as possible
Take a look at the GUAM theater.
https://www.benchmarksims.org/forum/forumdisplay.php?63-Pacific@Mr:
Perfect for a Tornado mini map
For a mini map, uhmm maybe.
BTW. what was the area for Tornado (I guess Tornado was also a jetsimulation???)And BTW. again, a perfect terrain for a Tornado would only be a europe 128 segmented theater, IMHO.
Cheers,
LS -
A perfect terrain for Tornado would be Europe in 128 hehe, but it’s just so gutting that the 1km terrain limits you so much to doing the tight valleys and fairly hilly terrain the Tornado was designed to ingress and egress through. Well, you could make them still, but it wouldn’t look so appealing without some seriously well made tiles with lots of shading in them to try fool your eye as much as possible, I might give it a try just in 3DS Max to see how 512px tiles might look on a bit of UK valley I have modelled.
Tornado was a sim back in the early 90’s, it was about 200Nm square I think, so about right for a ~ 500km x 500km 32 segment theatre I think…
It was pretty basic. Pretty much flat for anything that was positioned, and then the hills were about 500m grid mesh (so not great), and only vehicles could traverse onto them. The end result was kinda odd but it worked really well in my view. The campaigns were certainly the strength of Tornado too, but the small maps made it relatively fast to play.
Uhhh there really has to be a way to get the grid size down. Even 500m would be amazing (even if the tile texture was spread over the 4 squares, 512px per 1km feels ok) as it’d look 4x more detailed!
Downloading F4 source code now, lets hope it has lots of commenting to see how things work hahaDave
-
@Mr:
A perfect terrain for Tornado would be Europe in 128 hehe, but it’s just so gutting that the 1km terrain limits you so much to doing the tight valleys and fairly hilly terrain the Tornado was designed to ingress and egress through. Well, you could make them still, but it wouldn’t look so appealing without some seriously well made tiles with lots of shading in them to try fool your eye as much as possible, I might give it a try just in 3DS Max to see how 512px tiles might look on a bit of UK valley I have modelled.
I agree regarding the mesh, but we can just sit and wait unitl there would be something new.
BUT I think If there will be a new/ changed terrain engine someday, then the already available theaters
could be converted, similar to “BaZT” back in 2004/2005/2006.512px tiles should be minimum standart these days AFAIK, IIRC and IMHO.
Some theater devs are even using tiles up to 2048px for airbase tiles.@Mr:
Tornado was a sim back in the early 90’s,…
Copy
@Mr:
Downloading F4 source code now, lets hope it has lots of commenting to see how things work haha
Keep in mind that you in fact download outdated code. (either originally Falcon4 1.06 or Falcon4 SP3)
Many things have changed I guess.Cheers,
LS -
Yeah the 512px tiles look quite ok by todays standards as a default size. From my readings it seems that texture memory has not THAT much impact vs geometry, and the terrain is as light as can be in that regard, so the only way we can make it any good for now is textures…
I think there will be a way to get more terrain mesh detail, it’s just how hard it is to make it work haha. 250m would be a big game-changer, even with 512 or 1024px textures per 1km still!
I even wonder if you could just run the terrain flat and blank (apply one set with one texture in it, with nothing on it and 1px x 1px in size. Then place your own new higher poly meshes over the top. Ie, imagine that building is now a 5km x 5km mesh referencing the same old tile textures… it’d still have LOD and you could bake the distance ‘fog’ into the mip-maps of the texture tiles… at 250m intervals it’d be what, about 20x20 squares, 1600 tris?
Hmmm, has anyone ever tried that?
Hmmm I guess the issue then is the whole AI and all that stuff, and trying to have vehicles drive on it etc etc…
Bah.
Back to the editing the source code in my dreams solution hehe.
Dave
-
Again BaZT, we already had 250m terrain in the past, it’s just “deactivated” for BMS (atm. ???)
here is an old, but informative thread: http://tactical.nekromantix.com/forum/viewtopic.php?f=12&t=20922&hilit=baztI hope the BMS devs are cooking someting up regarding the mesh and that actually 256 tilesets limit.
Uhmm, if you want to discuss more about the mesh, i suggest to start a new thread,
because we are OT on a sticky thread here.Or even better, do a search here on BMS- forums, on good old GlobalFalcon- forums and on PMC- forums first.
Cheers,
LS -
Good links, thanks for those!
I noticed Iceland was done using a 250m grid.
I suppose then, to slew the thread back onto topic a bit, the GFX engine does support 250m grids natively relatively easily. The issue will be that tile textures themselves cover only 250m rather than 1km, but with 256px textures we also get around 1px/metre of visual quality too. However it does mean that 250m grids will probably mean totally new tile development will have to take place… unless there would be an elegant way to paste one texture over a few grid squares.
But obviously only ideal for smaller theatres (for now)
PS, the src code is very well commented and fairly easy to read… no wonder F4 worked out so well, and worked so well from a modding perspective!
Thanks
Dave