I use an emitter to get a collision event on a blueprint (cpu particles), but the particles are not simulated on dedicated server. Any idea on how to enable this?
I don’t quite get what’s your goal, why should an emitter run on the server? it should just be replicated.
and I’m quite sure that the “event generator” is made for another emitter to run within the same particle system (something like when hit the floor spawn other particles)
and even if you could use it as a trigger to an event, then you could just make this event call another event (this time a server side event) and that would be all.
In the above example a vehicle shoots a laser beam every 0.2 seconds.
My options are:
- Spawn a blueprint for every beam (which means potential hundreds of more actors spawning and getting deleted all the time crippling performance)
- Use one particle system with collision and event generators. Event generator prompts events on blueprints. Damage is applied on every particle hit via events. (works perfectly on listen server but not on dedicated)
- Each client notifies server when a particle hits a target (prone to hacking)
I would just have the spaceship blueprint with a timer that ticks every 0.2 seconds that spawn a particle effect and then set beam source and target.
with the same source and target you then use LineTraceByChannel and check for hits, if there is a hit you get the actor that is being hit and you can call an event on that actor (through rpc).
It is not really clear what you are planning to do…
btw if you place a blueprint in the map it will always be executed by the authoritative server.
you should really post the part of code with the timer that spawn the particle effect and the event that you are interested to be called onhit
Yeah you’re definitely going the wrong way about this I’m afraid.
First thing to note is that particle system collision is much more expensive than primitive collision. Most projectiles use simple spheres for collision because they are the fastest to resolve, and collision primitives have a lot of extra optimization such as collision filtering - something you won’t get in a particle system. You should definitely use a sphere primitive as the root component and use that for collision, especially with so many projectiles, and create a custom collision channel for them.
Next problem you have is that (going by your other thread) - you can’t spawn a component directly in the world, it must be part of an Actor. Even Matinee Cameras are actors. Without it being an actor, it can’t have any form of network relevancy or role, and therefore you can’t do any replication/network operations on it. Even though you can replicate components, they need to have a valid actor channel and Owner (plus various other things) to do so.
Additionally, lasers are typically instant-hit weapons not projectiles, so you want to do your laser via a Line Trace as MaxiHori suggests, and set the source and target points of a beam emitter. You can also simulate projectiles this way as well without having to actually spawn any moving object. There is a lot of writing out there about making hitscan weapons. ShooterGame has a good example, but of course that’s in C++. I can probably write a summary of how it works here so you can recreate it in Blueprint (but will have to do it later).
EDIT: One more thing - spawning lots of actors in a very short space of time can be very expensive. In order to get around that, you may need to look at ‘pooling’ your projectiles, which basically means spawning them all at the start of the game (or when you spawn a weapon for instance) - and the weapon will just find the first inactive projectile in an array of projectiles and fire that one off. Beware though, as this all comes with a cost of it’s own.
Also completely off topic - your forum name isn’t related to the ‘Forgotten Enemies’ expansion pack by any chance is it? (If it is, you’ll know what I’m on about).