GarageGames / Torque3D

MIT Licensed Open Source version of Torque 3D from GarageGames
http://torque3d.org
MIT License
3.35k stars 1.2k forks source link

Standards for fileNames, NavMesh, Terrain, Forest etc #2153

Open ghost opened 6 years ago

ghost commented 6 years ago

I encountered the problem that if you create a navMesh in your scene and generate it and then save the mission, the navMesh does not exist, since you first need to specify a filename and a path to it, otherwise it will not save. But there should be a default behavior that will just take the missionname.nav for the navmesh and save it in the same folder as the level. Some similar problems exist with other objects that work like that like the Terrain or Forest, even though they have a default behavior already, but it is not standardized, for example terrains are generated in art/terrains by default, but it should be the same folder as the mission file and the terrain should have the same name as the mission file by default. Forest I think behaves correctly.

So I would suggest when the "fileName" in the object inspector of the item is not specified it should do the defaulthavior and just use the mission file in the missions relativy directory like "./missionname.nav" If it is specified use that.

I encountered that problem a lot since you need to specify the filename for a navMesh, but when you create a new level based from that, it is already specified and if you save the mission it will overwrite the files like nav, terrain, forest of your old mission which can get quite annoying, as you may leave valuable work if you do not use version control, like done in the Terrain or Forest.

John3 commented 6 years ago

I was thinking the same for the terrain and forest naming convention, with the navmesh I don't see trouble on this behavior.

ghost commented 6 years ago

The navmesh is the biggest issue as it does not save at all if you do not manually type the path and filename, which can be really annoying.

chaigler commented 6 years ago

Took a stab at this: https://github.com/chaigler/Torque3D/tree/navmesh_default_filename

Adds a default filename to NavMeshes. They'll be automatically saved out as LevelName_NavMeshName.nav in the levels folder.

Forests appear to save correctly so I didn't make any changes there.

Terrain is an easy fix as well but probably needs some discussion. You typically have separate material & texture data for terrains so keeping all of the terrain stuff together in a separate folder makes sense to me.

ghost commented 6 years ago

It is not typical to have new materials for every terrain, in most cases you will just use the same set of terrain textures for all terrains. I use that folder for terrain textures only and put the .ter files where the missions are that use those .ter files, it never occured to me that I needed this to be different. Here is how my art/terrains looks https://github.com/Duion/Uebergame/tree/master/art/terrains If I would use unique textures for my terrain, I would just put it into the level directory, since those art assets are only used with that specific level.

chaigler commented 6 years ago

That's a clean setup, I like it. I suppose we'll have to decide as a community if the default behavior should change (and what it should be if it does) but I'll probably go with something similar to what you've done for my own stuff.

ghost commented 6 years ago

Well it is not that clean, since I also have art/textures/ folder, which is used for regular materials. I just kept art/terrains/ since terrain textures/materials work differently and use a different system in the engine. The plan for newer versions of Torque I heard is to replace the Terrain texture system and use regular materials, so they can also have specular maps and all other features the material editor provides.

My problem with the default setup was just, that it has no unified style, like everything has a different behavior instead of just saving any file related to a mission as the same name as the mission file in the same folder just changing the file extension, so you had files ending up in all different locations and some won't even save if you do not specify the filepath like with the navmesh.

So I think repeat your change to the navMesh files to terrain files as well and everything should be fine.