Author Message

amilmand

00
Posts: 259

Location: ---
Occupation:
Age:
V$:
#136159   2018-01-23 14:58          
Bigg Boss93:
animate class
You can always do that but if at all possible one should avoid using these kind of solutions because you cant reliably synchronise your threads so race conditions can occur. But it seems there is no other way this time (the particle system seems unfinished in the engine)

Bigg Boss93:
array
The decalration of the setSource is defined in the RenderRef.java
public native void setSource( String alias, Vector3 pos, float rmin, float rmax, Vector3 vel, float vmin, float vmax, float freq, String bone );
as you can see its return type is void it doesnt return an object which you could insert to an array.
The name(alias) is the key for sources, that is what defines a particle source.
So as your example stands you are only creating one particle source because calling the setSource with a given name updates the source with that name or creates it only if it didn't exist before.
(But because of this functionality the example for the animate function is theoretically sound since it will only move the particle source named particle1 and will not spawn a new one each iteration)
What you want to do is push the names (strings) to an array and then refer to the individual sources by their name.
You only need to keep the particle system alive with a reference.
Also you should take a look at the Vector class defined in system\Scripts\util\Vector.class that wraps the array functionality.
The declaration of the variables should match their intended use.
particleDiddy is an array but is declared as a RenderRef
particleRef is a ParticleSystem but declared as a RenderRef
You should destroy the particle system(s) on exit and should not wait for the GC to do it this can be a resource intensive object.

You should also consider using only one source for a given system because the density of the particle sources does not scale with the particle density setting as you might expect, but at least test it with different values (option-values).

Bigg Boss93:
the game with reshade
Reshade has an interface for these settings yes but the slrr_gi.exe is the one disregarding the ingame settings
there is an external config program for it which is only included in the non-reshade version of the patch
(if you are not using reshade this is the only way to edit these with the patched exe
but if you do than reshade will overwrite the values set by the external program)
here is a list of these settings then as it seems it got under the radar:
cfg_mem_texture_min
cfg_mem_sound_max //max memory in Mb that can be reserved for sounds
cfg_deformation //deformation factor if 0 car is like in nfs
cfg_engine_inertia_factor
cfg_external_damage
cfg_internal_damage
cfg_mem_instance_max
cfg_mem_instance_min
cfg_mem_sound_min
cfg_mem_texture_max
cfg_mem_vertex_max
cfg_mem_vertex_min
cfg_particle_density //particle density 1.0 = 100%
cfg_skidmarks_max //skidmarks maximum length
resource_loadrate //if high everything gets loaded when needed but this causes lag,
                    if low things might get loaded too late to matter (crash into something that is not yet there)
These settings are set in the Config.class (were set) but not all of them were exposed in the Options dialog.

Added 38 minutes later:

amilmand:
theoretically sound
Scratch that if you recreate the system each time there will be a new source spawning each iteration the ones spawned in previous iterations will only be removed by the GC which will result in a trail of smoke emitting particle sources behind the followed object (the car in this case).

Added 1 hour 15 minutes later:

I would do it as such:
        RenderRef particleRender = null;
	ParticleSystem particleRef;
	Vector particleSystems = new Vector();
	int particelCounter = 0;
	void AddParticle(Vector3 p)
	{
		if(particleRender == null)
		{
			particleRender = new RenderRef(particles:0x00000106r);
			particleRender.load();
		}
		particelCounter++;
		particleRef = new ParticleSystem(map,particleRender,"scriptParticle"+particelCounter);
		particleRef.setSource("particle"+particelCounter, p, 0.01, 0.3, new Vector3(0,4.0,0), 0.0, 1.5, 100000.0, null);
		particleRef.setFreq(0.1);
		particleSystems.addElement(particleRef);
	}
	
	public void enter( GameState prev_state )
	{
		Frontend.loadingScreen.show();
		GfxEngine.flush();

		super.enter( prev_state );
		
		AddParticle(new Vector3(3.1465, 3.2354, -8.7183));
		AddParticle(new Vector3(4.4329, 3.2354, -8.7183));
		AddParticle(new Vector3(5.7594, 3.2354, -8.7183));
		AddParticle(new Vector3(7.0454, 3.2354, -8.7183));
		AddParticle(new Vector3(8.2981, 3.2354, -8.7183));
		AddParticle(new Vector3(9.5840, 3.2354, -8.7183));
		AddParticle(new Vector3(3.1465, 3.2354, -4.3413));
		AddParticle(new Vector3(4.4329, 3.2354, -4.3413));
		AddParticle(new Vector3(5.7594, 3.2354, -4.3413));
		AddParticle(new Vector3(7.0454, 3.2354, -4.3413));
		AddParticle(new Vector3(8.2981, 3.2354, -4.3413));
		AddParticle(new Vector3(9.5840, 3.2354, -4.3413));
		AddParticle(new Vector3(3.1465, 3.2354, 0.03020));
		AddParticle(new Vector3(4.4329, 3.2354, 0.03020));
		AddParticle(new Vector3(5.7594, 3.2354, 0.03020));
		AddParticle(new Vector3(7.0454, 3.2354, 0.03020));
		AddParticle(new Vector3(8.2981, 3.2354, 0.03020));
		AddParticle(new Vector3(9.5840, 3.2354, 0.03020));
		AddParticle(new Vector3(3.1465, 3.2354, 4.43250));
		AddParticle(new Vector3(4.4329, 3.2354, 4.43250));
		AddParticle(new Vector3(5.7594, 3.2354, 4.43250));
		AddParticle(new Vector3(7.0454, 3.2354, 4.43250));
		AddParticle(new Vector3(8.2981, 3.2354, 4.43250));
		AddParticle(new Vector3(3.1465, 3.2354, 8.85030));
		AddParticle(new Vector3(4.4329, 3.2354, 8.85030));
		AddParticle(new Vector3(5.7594, 3.2354, 8.85030));
		AddParticle(new Vector3(7.0454, 3.2354, 8.85030));
		AddParticle(new Vector3(8.2981, 3.2354, 8.85030));
		AddParticle(new Vector3(3.1465, 3.2354, 13.0862));
		AddParticle(new Vector3(4.4329, 3.2354, 13.0862));
		AddParticle(new Vector3(5.7594, 3.2354, 13.0862));
		AddParticle(new Vector3(7.0454, 3.2354, 13.0862));
		AddParticle(new Vector3(8.2981, 3.2354, 13.0862));
	}

	public void exit( GameState next_state )
	{
		for(int i = 0; i != particleSystems.size();++i)
		{
			particleSystems.elementAt(i).destroy();
		}
		super.exit( next_state );
	}

This would have the desired effect (regardless of the particle density setting (of course if it is 0 than there wont be any))

This post was edited by amilmand (2018-01-24 04:34, ago)