View Issue Details

IDProjectCategoryView StatusLast Update
0005853DarkRadiantShader Systempublic02.03.2022 17:41
ReporterDragofer Assigned Togreebo  
PrioritynormalSeveritynormalReproducibilityalways
Status resolvedResolutionfixed 
Product Version2.14.0 
Target Version3.0.0Fixed in Version3.0.0 
Summary0005853: DR overwrite order for defs is different from TDM's
DescriptionIf the mapper provides a custom definition with his FM that has the same name as one of the core asset definitions, DR uses different rules for which definition wins out than TDM.

For example:
For DR, the .prt file whose name sorts lexicographically latest takes priority (i.e. z_nofog.prt overwrites particles in tdm_fog.prt)
For TDM, the .prt file whose name sorts lexicographically earliest takes priority (i.e. a_nofog.prt overwrites particles in tdm_fog.prt).

Testing so far, DR's order seems to be wrong for:
- entityDefs
- particles

It seems to be correct for:
- soundshaders
Steps To Reproduce1) The attached .prt file, z_nofog.prt, should turn TDM's dustfog particles and more into nodraw, 1-cycle, 1-count particles. Place this file in your FM's "particles" folder and set DR to use this FM.
2) Create a func_emitter, change its particle to "tdm_dustfog1.prt". You'll see it's just some huge nodraw quads. If you started TDM it'd look the same as the stock version, however.
3) Rename to a_nofog.prt and "Reload particles" in DR. In DR the particle looks normal in the Particle Editor/Chooser, but in TDM it would now look invisible as intended.
TagsNo tags attached.

Relationships

related to 0005911 resolvedgreebo Unify Declaration Parsers 

Activities

Dragofer

Dragofer

25.12.2021 23:06

developer  

z_nofog.prt (9,336 bytes)   
particle tdm_dustfog1 {
	{
		count				1
		material			textures/common/nodraw
		time				10.000
		cycles				1.000
		bunching			1.000
		distribution		rect 128.000 128.000 32.000 
		direction			outward "0.000" 
		orientation			view 
		speed				 "1.000"  to "10.000"
		size				 "200.000" 
		aspect				 "1.000" 
		randomDistribution				1
		boundsExpansion				0.000
		fadeIn				0.700
		fadeOut				0.800
		fadeIndex				0.000
		color 				1.000 1.000 0.900 0.250
		fadeColor 			1.000 1.000 1.000 0.000
		offset 				0.000 0.000 0.000
		gravity 			world 0.000
	}
}

particle tdm_dustfog2 {
	{
		count				1
		material			textures/common/nodraw
		time				10.000
		cycles				0.000
		bunching			1.000
		distribution		rect 128.000 128.000 8.000 
		direction			outward "0.000" 
		orientation			z 
		speed				 "1.000"  to "1.200"
		size				 "200.000" 
		aspect				 "1.000" 
		randomDistribution				1
		boundsExpansion				0.000
		fadeIn				0.700
		fadeOut				0.800
		fadeIndex				0.000
		color 				1.000 1.000 0.900 0.250
		fadeColor 			1.000 1.000 1.000 0.000
		offset 				0.000 0.000 0.000
		gravity 			world 0.000
		softeningRadius 5
	}
}


particle tdm_dustfog3 {
	{
		count				1
		material			textures/common/nodraw
		time				10.000
		cycles				1
		bunching			1.000
		distribution		rect 128.000 128.000 32.000 
		direction			outward "0.000" 
		orientation			view 
		speed				 "1.000"  to "10.000"
		size				 "200.000" 
		aspect				 "1.000" 
		randomDistribution				1
		boundsExpansion				0.000
		fadeIn				0.700
		fadeOut				0.800
		fadeIndex				0.000
		color 				0.500 0.500 0.500 0.250
		fadeColor 			.500 0.500 0.500 0.000
		offset 				0.000 0.000 0.000
		gravity 			world 0.000
	}
}

particle tdm_dustfog4 {
	{
		count				1
		material			textures/common/nodraw
		time				10.000
		cycles				0.000
		bunching			1.000
		distribution		rect 5000.000 5000.000 500.000 
		direction			outward "0.000" 
		orientation			view 
		speed				 "10.000"  to "30.000"
		size				 "2200.000" 
		aspect				 "1.000" 
		randomDistribution				1
		boundsExpansion				0.000
		fadeIn				0.700
		fadeOut				0.800
		fadeIndex				0.000
		color				0.820 0.580 0.400 0.300
		fadeColor 			0.820 0.580 0.400 0.000
		offset 				0.000 0.000 0.000
		gravity 			world 0.000
	}
}

particle chimney_smoke1
{
	depthHack	1
	{
		count				1
		material			textures/common/nodraw
		time				7.000
		cycles				1
		bunching			0.950
		distribution			sphere 24.000 24.000 24.000
		direction			cone 10.000
		orientation			view
		speed				"0.000"  to "4.000"
		size				"36.500"  to "82.500"
		aspect				"1.000"
		rotation			"-45.000"  to "35.000"
		randomDistribution		1
		boundsExpansion			0.000
		fadeIn				0.750
		fadeOut				0.900
		fadeIndex			0.150
		color 				0.090 0.100 0.110 1.000
		fadeColor 			0.000 0.000 0.000 0.000
		offset 				0.000 0.000 0.000
		gravity 			-10.000
	}
}

particle chimney_smoke2
{
	depthHack	1
	{
		count				1
		material			textures/common/nodraw
		time				6.500
		cycles				1
		bunching			0.950
		distribution			sphere 24.000 24.000 24.000
		direction			cone 10.000
		orientation			view
		speed				"0.000"  to "4.000"
		size				"36.500"  to "82.500"
		aspect				"1.000"
		rotation			"-45.000"  to "35.000"
		randomDistribution		1
		boundsExpansion			0.000
		fadeIn				0.750
		fadeOut				0.900
		fadeIndex			0.150
		color 				0.090 0.100 0.110 1.000
		fadeColor 			0.000 0.000 0.000 0.000
		offset 				0.000 0.000 0.000
		gravity 			-10.000
	}
}


// not so bright night time smoke
particle chimney_smoke_dull_blue {
	{
		count				1
		material			textures/common/nodraw
		time				1.550
		cycles				1
		bunching			1.000
		distribution		rect 2.000 2.000 0.000 
		direction			cone "0.000" 
		orientation			view 
		speed				 "26.000"  to "9.000"
		size				 "0.000"  to "34.000"
		aspect				 "1.000" 
		randomDistribution				1
		boundsExpansion				0.000
		fadeIn				1.000
		fadeOut				1.000
		fadeIndex				0.000
		color 				0.230 0.250 0.310 1.000
		fadeColor 			0.000 0.000 0.000 0.000
		offset 				0.000 0.000 0.000
		gravity 			-10.000
	}
}

// not so bright night time smoke
particle chimney_smoke_dull_grey {
	depthHack	10
	{
		count				1
		material			textures/common/nodraw
		time				1.550
		cycles				1
		bunching			1.000
		distribution		rect 2.000 2.000 0.000 
		direction			cone "0.000" 
		orientation			view 
		speed				 "26.000"  to "9.000"
		size				 "0.000"  to "34.000"
		aspect				 "1.000" 
		randomDistribution				1
		boundsExpansion				0.000
		fadeIn				1.000
		fadeOut				1.000
		fadeIndex				0.000
		color 				0.280 0.280 0.300 1.000
		fadeColor 			0.000 0.000 0.000 0.000
		offset 				0.000 0.000 0.000
		gravity 			-10.000
	}
}


// not so bright night time smoke - Tall plume, eg, for use within high chimney
particle chimney_smoke_dull_blue_tall {
	{
		count				1
		material			textures/common/nodraw
		time				10.0
		cycles				1
		bunching			1.000
		distribution		rect 5.000 5.000 0.000 
		direction			cone "0.000" 
//		angle				0.000
		customPath flies 0.000 0.000 0.000 
		orientation			view 
		speed				 "0.000"  to "250.000"
		size				 "50"  to "150.000"
		aspect				 "1.000" 
		randomDistribution				1
		boundsExpansion				0.000
		fadeIn				1.000
		fadeOut				1.000
		fadeIndex				0.000
		color 				0.230 0.250 0.310 1.000
		fadeColor 			0.000 0.000 0.000 0.000
		offset 				0.000 0.000 0.000
		gravity 			-10.000
	}
}

particle tdm_floating_mood_dust_small { 
	{
		count 				1
		material 			textures/common/nodraw
		time 				5.000
		cycles 				1
		timeOffset 			0.000
		bunching 			1.000
		distribution 		sphere 48.000 48.000 48.000
		direction 			cone 90.000
		orientation 		view
		speed 				"5.000" to "-5.000"
		size 				"0.500" to "1.000"
		aspect 				"1.000"
		rotation 			"0.000"
		randomDistribution 	1
		boundsExpansion 	0.000
		fadeIn 				1.000
		fadeOut 			1.000
		fadeIndex 			1.000
		color 				0.070 0.110 0.140 1.000
		fadeColor 			0.030 0.040 0.070 1.000
		offset 				0.000 0.000 0.000
		gravity 			0.000
		entityColor 		1
	}
}

particle tdm_chimney_smoke { 
	{
		count 				1
		material 			textures/common/nodraw
		time 				6.000
		cycles 				1
		timeOffset 			0.000
		bunching 			1.000
		distribution 		sphere 15.000 15.000 15.000
		direction 			cone 10.000
		orientation 		view
		speed 				"0.000" to "4.000"
		size 				"15.000" to "45.000"
		aspect 				"1.000"
		rotation 			"0.000" to "35.000"
		randomDistribution 	1
		boundsExpansion 	0.000
		fadeIn 				0.750
		fadeOut 			0.900
		fadeIndex 			0.150
		color 				0.090 0.100 0.110 1.000
		fadeColor 			0.000 0.000 0.000 0.000
		offset 				0.000 0.000 0.000
		gravity 			-10.000
	}
}

particle tdm_chimney_smoke_medium { 
	{
		count 				1
		material 			textures/common/nodraw
		time 				5.000
		cycles 				1
		timeOffset 			0.000
		bunching 			1.000
		distribution 		sphere 15.000 15.000 15.000
		direction 			cone 10.000
		orientation 		view
		speed 				"0.000" to "4.000"
		size 				"15.000" to "45.000"
		aspect 				"1.000"
		rotation 			"0.000" to "35.000"
		randomDistribution 	1
		boundsExpansion 	0.000
		fadeIn 				0.800
		fadeOut 			0.900
		fadeIndex 			0.150
		color 				0.090 0.100 0.110 1.000
		fadeColor 			0.000 0.000 0.000 0.000
		offset 				0.000 0.000 0.000
		gravity 			-10.000
	}
}

particle tdm_chimney_smoke_small { 
	{
		count 				1
		material 			textures/common/nodraw
		time 				5.000
		cycles 				1
		timeOffset 			0.000
		bunching 			1.000
		distribution 		sphere 15.000 15.000 15.000
		direction 			cone 10.000
		orientation 		view
		speed 				"0.000" to "4.000"
		size 				"15.000" to "35.000"
		aspect 				"1.000"
		rotation 			"0.000" to "35.000"
		randomDistribution 	1
		boundsExpansion 	0.000
		fadeIn 				0.800
		fadeOut 			0.900
		fadeIndex 			0.150
		color 				0.090 0.100 0.110 1.000
		fadeColor 			0.000 0.000 0.000 0.000
		offset 				0.000 0.000 0.000
		gravity 			-10.000
	}
}

particle tdm_floating_dust {
	{
		count				1
		material			textures/common/nodraw
		time				5.200
		cycles			1
		bunching			1.000
		distribution		sphere 128.000 128.000 128.000 
		direction			cone "90.000" 
		orientation		view 
		speed				 "5.000"  to "-5.000"
		size				 "0.500"  to "1.000"
		aspect			 "1.000" 
		randomDistribution	1
		boundsExpansion		0.000
		fadeIn			1.000
		fadeOut			1.000
		fadeIndex			1.000
		color 			0.480 0.310 0.220 1.000
		fadeColor 			0.070 0.040 0.030 1.000
		offset 			0.000 0.000 0.000
		gravity 			0.000
	}
}


particle tdm_floating_moon_dust {
	{
		count 				1
		material 			textures/common/nodraw
		time 				5.000
		cycles 				1
		timeOffset 			0.000
		bunching 			1.000
		distribution 		sphere 128.000 128.000 128.000
		direction 			cone 90.000
		orientation 		view
		speed 				"5.000" to "-5.000"
		size 				"0.500" to "1.000"
		aspect 				"1.000"
		rotation 			"0.000"
		randomDistribution 	1
		boundsExpansion 	0.000
		fadeIn 				1.000
		fadeOut 			1.000
		fadeIndex 			1.000
		color 				0.070 0.110 0.140 1.000
		fadeColor 			0.030 0.040 0.070 1.000
		offset 				0.000 0.000 0.000
		gravity 			0.000
		entityColor 		1
	}
}
z_nofog.prt (9,336 bytes)   
greebo

greebo

01.03.2022 06:09

administrator   ~0014743

I couldn't exactly reproduce the behaviour you described, but after some research I now know what the engine is doing when loading (particle) decl files:

TDM Decl Parser:
- It asks the filesystem instance to deliver all .prt files in the particles/ folder, it is returning a list of files (here z_nofog.prt is on the top of the list, since the FM folder is delivering files first)
- That list is sorted alphabetically, this makes the z_nofog.prt file slide down to the bottom of the list.
- The parser processes that file list, top to bottom, meaning that the TDM files are processed first, the tdm_dustfog1 particle gets created first.
- Once the z_nofog.prt is reached, the encountered tdm_dustfog1 is rejected with a duplicate warning. The TDM decl is kept.

DarkRadiant's ParticleManager:
- Asks the filesystem to deliver all .prt files in the particles/ folder
- Every file that is delivered is parsed immediately, i.e. the z_nofog.prt gets to be parsed before the rest of the files
- Once the TDM decl is reached, it is actually overwriting the one defined earlier, this way the TDM decl still takes precedence.

While the file precedence is well defined (FM folder takes precedence over base game, Filesystem is taking precedence over PK4s), I'm not sure if it's a wise thing to make FMs overwrite base decls in the way described above. It will produce warnings, and that shouldn't be part of any recommended practice. If TDM declarations need to be overwritten, the warning-free way would be to override the corresponding file tdm_fog.prt entirely, which I wouldn't really recommend either.

I agree that the DR parsing algorithm needs to be adjusted to match the one in TDM, but the use case remains questionable for me.
greebo

greebo

01.03.2022 06:11

administrator   ~0014745

When placing the z_nofog.prt in my FM/particles folder:
grafik.png (14,665 bytes)   
grafik.png (14,665 bytes)   
greebo

greebo

02.03.2022 17:41

administrator   ~0014755

Duplicate Particle Defs are no longer overwriting previous ones when encountered during the same parse pass.

Related Changesets

DarkRadiant: master c351fd7f

2022-03-02 04:55:34

greebo

Details Diff
0005853: Add a .mtr file precedence scenario to the test resources Affected Issues
0005853
mod - test/Materials.cpp Diff File
add - test/resources/tdm/materials/z_precedence.mtr Diff File
mod - test/resources/tdm/tdm_example_mtrs.pk4 Diff File

DarkRadiant: master fcadac25

2022-03-02 05:05:49

greebo

Details Diff
0005853: Add a .prt file precedence scenario to the test resources Affected Issues
0005853
mod - test/CMakeLists.txt Diff File
add - test/Particles.cpp Diff File
add - test/resources/tdm/particles/z_precedence.prt Diff File
add - test/resources/tdm/test_particles.pk4 Diff File
mod - tools/msvc/Tests/Tests.vcxproj Diff File
mod - tools/msvc/Tests/Tests.vcxproj.filters Diff File

DarkRadiant: master f7cb3e11

2022-03-02 17:35:46

greebo

Details Diff
0005853: Improve ParticleLoader such that it can deal with duplicate defs. They don't overwrite previously parsed ones in the same pass. Affected Issues
0005853
mod - include/iparticles.h Diff File
mod - radiantcore/particles/ParticleDef.h Diff File
mod - radiantcore/particles/ParticleLoader.cpp Diff File
mod - radiantcore/particles/ParticleLoader.h Diff File
mod - radiantcore/particles/ParticlesManager.cpp Diff File
mod - radiantcore/particles/ParticlesManager.h Diff File
mod - test/Particles.cpp Diff File
mod - test/resources/tdm/particles/z_precedence.prt Diff File

Issue History

Date Modified Username Field Change
25.12.2021 23:06 Dragofer New Issue
25.12.2021 23:06 Dragofer File Added: z_nofog.prt
26.12.2021 21:02 Dragofer Summary DR overwrite order for particles is different from TDM's => DR overwrite order for defs is different from TDM's
26.12.2021 21:02 Dragofer Description Updated
01.03.2022 06:09 greebo Status new => feedback
01.03.2022 06:09 greebo Note Added: 0014743
01.03.2022 06:11 greebo Note Added: 0014745
01.03.2022 06:11 greebo File Added: grafik.png
02.03.2022 09:03 greebo Relationship added related to 0005911
02.03.2022 17:40 greebo Assigned To => greebo
02.03.2022 17:40 greebo Status feedback => assigned
02.03.2022 17:41 greebo Changeset attached => DarkRadiant master c351fd7f
02.03.2022 17:41 greebo Changeset attached => DarkRadiant master fcadac25
02.03.2022 17:41 greebo Changeset attached => DarkRadiant master f7cb3e11
02.03.2022 17:41 greebo Status assigned => resolved
02.03.2022 17:41 greebo Resolution open => fixed
02.03.2022 17:41 greebo Fixed in Version => 3.0.0
02.03.2022 17:41 greebo Note Added: 0014755
02.03.2022 17:41 greebo Target Version => 3.0.0