VStanced/mods
Submit a mod
Mods Guides Forum Submit a mod Log in Register

Forum

Questions, builds, help and the odd argument. The mods and guides are out front.

Notifications
Clear all

Amilmand WIP

526 Posts
57 Users
0 Reactions
282.9 K Views
holeecrab
(@holeecrab_12721)
Honorable Member
Joined: 12 years ago
Posts: 709
 

Hey man just got some minor issue here. I always got a crash everytime i open the catalog with high amount of resources (eg:tyres, wheels) for about twice. Before it crashes, sometimes the model just won't load or it misses some textures. Weird thing is that i never had the issue before i applying your patch. Is there any way to prevent it by editing the .fx such as particles or the in-game config via reshade?



   
ReplyQuote
Bigg_Boss93
(@bigg_boss93_1370)
Member Admin
Joined: 15 years ago
Posts: 3835
 

Believe me or not but i've used those same exact strigs, copied and edited accordingly to my files, from 2.3.1 exhausttip.java, gently sourced by Adnan, set to use the tyre smoke(particles:0x0002r😉 but it did not appear(while it did when i tried on osd.java.

In which section of the java did you put that stuff?

I know i've got to put a string to delete all particles into "Exit"...

Fuck i so want to be home now to try again lol, hopefully i'll manage doing it tomorrow morning xD

Thanks for your constant help



   
ReplyQuote
amilmand
(@amilmand_18634)
Reputable Member
Joined: 11 years ago
Posts: 259
Topic starter  
Bigg Boss93 wrote

which section of the java

There are two main points here the parent of the ParticleSystem must be a GroundRef and you must load() the particle resource before creating the particle system.
I put it in the garage.enter after creating the map (the GroundRef).

I replaced the method behind the "HaltAfterFirstReflecting" I updated the exe to report when it is initializing to draw the cars and this triggers the copying of the backbuffer this isnt a full solution either but now it will always render the map (not the placed objects or natives) before copying out so it become an inclusive method; there may be objects you wouldnt expect on the reflection (I've seen the tyres rendered separately) but self reflection should be impossible for cars (windows as part of the map may selfreflect)

I only updated the Reshade links I didnt push this to the SlrrExhaustive patch
(SlrrExhaustive Bits)

holeecrab
Can you give a little more context;
are you using SlrrExhaustive?
Try and downloading the patch again you may have hit a window, for some time there was a wrong version on the link.
(In the meantime I'll download the version uploaded and apply the patch and try and recreate the crash)

If you are not using SlrrExhaustive can you share your Reshade config (on Pastebin if possible) the error you are experiencing suggests that the game runs out of memory you may have caught a memory leak.

Added 39 minutes later:

Well I could crash the game but I had to sweep through almost all the rims in the catalogue to do so without returning to the garage(on returning to the garage the game frees up memory) maybe there should be forced memory cleanup in more places :/



   
ReplyQuote
gorgoil
(@gorgoil_3248)
Member Moderator
Joined: 14 years ago
Posts: 219
 

# amilmand :
Spoiler:

particleRender = new RenderRef(particles:0x00000106r);
particleRender.load();
particleRef = new ParticleSystem(map,particleRender,"scriptParticle");
particleRef.setSource("particle1", new Vector3(0,1.0,0), 0.01, 0.3, new Vector3(0,4.0,0), 0.0, 1.5, 1000.0, null);
particleRef.setFreq(1000.0);

You should stick to the one source/particle system approach.
You can set multiple sources (either with this setSource or the setDirectSource function) but if you want multiple sources for one system you have to take into consideration that there is one default source at the parent-(0,0,0) (this parent must be a GroundRef) which you can not move and if you dont use all the frequency present in the particle system by default, then you will have more sources than intended.
Also if you set the frequency with the setFreq call on the particle system the source structure will collapse and only the first manually set source will spawn particles (but this way you can circumvent the (0,0,0) source problem(I'm fairly sure this is not intended))
You must keep the reference alive (at least one reference in some class so the GC wont delete it)
You must load the particle type with an explicit call to load() or you will need to wait for the engine to load it itself and only after it has been loaded can you create the actual particle system or it will silently fail (all calls will silently fail).
You can stop the particle system by destroying it with a destroy() or finalize() call.

particleRef.setSource("particle1", //the name for the source you can stop a particular source with a delAction( String name ); call on the particle system
                      new Vector3(0,1.0,0), //position of source
                      0.01, //the min radius of spawning (wide or narrow waterfall)
                      0.3, //max radius 
                      new Vector3(0,4.0,0), //velocity vector this will be added to the velocity that is generated from the cfg
                      0.0, //velocity scale minimum the velocity from the cfg will be scaled at least by this amount 
                      1.5, //velocity scale max
                      1000.0, //frequency but this is subject to the particle density defined at the offset 0x00618948 (same as the setting in options)
                      null); //bone name no clue...

WOW this will help me to realize an idea I had some years ago that I thought it would be impossible at least for me, thank you so much 😃



   
ReplyQuote
amilmand
(@amilmand_18634)
Reputable Member
Joined: 11 years ago
Posts: 259
Topic starter  
Bigg Boss93 wrote

smoke(particles:0x0002r😉

It seems the smoke is a bit different the handplaced source overflows much easier so setting the frequecy on the system didnt prevent smoke coming from the (0,0,0) point.
Though when I set the frequency of the system to some very low value (0.0001) and the frequency of the placed source to some high value (10000000.0) (doesnt really matter because this will be capped by the global particle density) the particles worked as intended and only the placed source produced smoke.



   
ReplyQuote
holeecrab
(@holeecrab_12721)
Honorable Member
Joined: 12 years ago
Posts: 709
 

Sorry for making you confused, but seems my issue was something with Memory Leak.

Btw here's my config if you still need it: https://pastebin.com/eEGpDKhg



   
ReplyQuote
Bigg_Boss93
(@bigg_boss93_1370)
Member Admin
Joined: 15 years ago
Posts: 3835
 

Wait, now i know why it didnt work.

I copy-pasted you lines, added the "RenderRef particleRender, particleRef;" on the main class, then tried it ingame, it worked.

I added particleRef.setMatrix(as i was doing in my own file) - it doesnt work anymore.

FML.jpg 😃

Added 6 minutes later:

Nevermind, that's not the reason... It did work once, i edited the position and it stopped working - i reset as you made it, it still wont work anymore.

Sometime i do really hate this game

Added 22 minutes later:

Ok fuck my life for real. Just please dont tell me that it wasnt working all the time, even when i made it by my own, just because my particle density was set to 0. 🙂) I'm an asswipe 🙂)



   
ReplyQuote
amilmand
(@amilmand_18634)
Reputable Member
Joined: 11 years ago
Posts: 259
Topic starter  

Though the setMatix function doesn't move it right?
The particleRef is actually a ParticleSystem instance which is indeed a child of RenderRef.
I tried making the player.car and the player.car.chassis the parent of the system and it did appear but it didn't follow the car nor had the position of the car any affect on the particles, so the parent doesnt need to be the map itself but a simple RenderRef will not suffice.



   
ReplyQuote
Bigg_Boss93
(@bigg_boss93_1370)
Member Admin
Joined: 15 years ago
Posts: 3835
 

Yeah the setMatrix doesnt work as the setSource got a vector3 of its own(i believe).

Anyway the reason i didnt get it working was that my particle density was set to zero, i only saw it once when i ran the game with reshade(which apparently, with your tweaks, simply override the java setting and make them enabled no matter what you do on the options dialog).

I think you could get it to follow the car by using a the_car.getmatrix into an animate class?! I may be wrong though.

Also, i've been trying to make an array in order to have multiple of the same type of particle in the scene but it gives me an error that says something about trying to array an un-arrayable thing.

Imma paste the code really quickly.

Added 2 minutes later:

Spoiler: highlight

Added 2 minutes later:

I have tried replacing "new String" with RenderRef, ParticleSystem but nothing changed, it just gives me an error and doesnt let me to... i was evaluating adding it as native object rather than to the main java and moving it that way(i wonder if that'd work)

Added 7 minutes later:

# Bigg Boss93 :
I think you could get it to follow the car by using a the_car.getmatrix into an animate class?! I may be wrong though.

Something like this

Spoiler: highlight



   
ReplyQuote
amilmand
(@amilmand_18634)
Reputable Member
Joined: 11 years ago
Posts: 259
Topic starter  
Bigg Boss93 wrote

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 wrote

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 wrote

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 wrote

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))



   
ReplyQuote
Bigg_Boss93
(@bigg_boss93_1370)
Member Admin
Joined: 15 years ago
Posts: 3835
 

You kind of creep me out with your knowledge, that's so damn amazing though. I think i said this already but, thanks a lot



   
ReplyQuote
amilmand
(@amilmand_18634)
Reputable Member
Joined: 11 years ago
Posts: 259
Topic starter  

You cant really go crazy with particles 1000 sources makes the game quite unplayable so I think only 100 is advisable.
(this is 1000 particle sources with around 10fps)



   
ReplyQuote
Bigg_Boss93
(@bigg_boss93_1370)
Member Admin
Joined: 15 years ago
Posts: 3835
 

It really depends on the intensity of the particle though, using a tyre smoke particle my game goes very slow(with your setup), but using my own particle(which i'm gonna show you in not too long) you wont see literally 1fps difference from without any particle.

That's pretty rad tho, i have managed making a goku-supersayian-ing-like particle earlier today lol.



   
ReplyQuote
gorgoil
(@gorgoil_3248)
Member Moderator
Joined: 14 years ago
Posts: 219
 

# Bigg Boss93 :
That's pretty rad tho, i have managed making a goku-supersayian-ing-like particle earlier today lol.

Me too using a particle based on waterfall 🙂)



   
ReplyQuote
Bigg_Boss93
(@bigg_boss93_1370)
Member Admin
Joined: 15 years ago
Posts: 3835

   
ReplyQuote
Page 9 / 36
Share: