#Handling client sided visual effects that have already begun

1 messages · Page 1 of 1 (latest)

livid mauve
plucky rune
#

this will vastly change depending on how you make your visual effects

#

lets say your effects have a array of actions to do

#
local effect = {
  {"PlayerAnimation", "Swing", 0, 1}, -- play swing animation from 0 to 1 seconds
  {"Partical effect", "Fire", 0.5, 2}, -- enable partical effect from 0.5 to 2 seconds
  {"Spawn Model", "Rocks", 2}, -- spawn rocks model at 2 seconds
}
#

now if the client knows what time the animation started

#

they will be able to use the effects array to workout what part of the effect there at

#

lets say they enter 1.5 seconds after the effect started

#

then know not to play the animation

#

they know to play the particals for 0.5 seconds

#

and they know to spawn the model in 0.5 seconds

plucky rune
#

but for me this is a lot of work if it was me i would just let them miss the effect and not see it
ant anybody got time to worry about 2 seconds of fire particles

astral copper
#

So basically you'll just have a step function for the effect that'll receive a parameter that represents the delta of the "effect state". The tricky part with using the particle engine is like Suphi said it's pretty rough tryna force particle emitters to do exactly what you intend so depending on the effect it might not make sense to be this miticulous about it

#

I think it does make sense if there are a lot of hard coded effects

#

If you absolutely need to have high control of particles, the only alternative I can see is to recreate particles using billboard guis, and that's gonna come out wonky under most circumstances if you're not creative with how you implement it

#

Plus there isn't really a ton of circumstances under which this would happen to you, unless your connectivity resumes after a lag spike or you just joined a server

livid mauve
#

and they enter the particle stage late

#

gradualy building up for example

plucky rune
#

like the particales have a low spawn rate

#

but a long life?

livid mauve
#

Yeah

#

I mean it does not have to

plucky rune
#

you would have to use something else i guess

#

maybe a animation?

livid mauve
#

what if they start the effect at 1.8

#

problems should accur

plucky rune
#

could you use a animation istead of a partical emitter?

livid mauve
#

an animation?

plucky rune
livid mauve
#

imagine for the full particle effect we need at least 0.5 sec to convey the effect

plucky rune
#

a partical animation

livid mauve
#

and they start the effect at 1.8

#

you mean the flipbook? @plucky rune

plucky rune
#

no

livid mauve
#

I'm very good at vfx

plucky rune
#

i mean like a a animation

livid mauve
#

Is that new?

plucky rune
#

and use a animation controller to play it

livid mauve
#

You mean a litteral animation that has nothing to do with particles?

#

or can you animate particles via animation?

livid mauve
#

I'm not familiar with how to animate particles

#

I have only worked with the defualt roblox character

plucky rune
#

make a model with lets say planes

livid mauve
#

so no particle emitter

plucky rune
#

and you texture the planes with fire texture

#

then you move the planes with the animation controller

#

no partical emitter

livid mauve
#

That would look really bad no?

#

and would be hacky

plucky rune
#

only if you make it look bad

#

it would replicate to other client perfectly

livid mauve
#

Is there an example of this

#

I can see in action?

plucky rune
#

no

#

but i could make a video in the future

livid mauve
#

on this specific topic?

plucky rune
#

yer

livid mauve
#

what if I mess with acell and other values to manipulate the emmiter somehow

plucky rune
#

roblox animation controller is very good at syncing animations without sending much data to the clients

plucky rune
livid mauve
#

it does not have to be in perfect sync

#

it just has to look ok

#

from the client side

#

and not have a significant difference from other clients

plucky rune
#

well if you have a partical that emits once per second

#

that lasts for 20 seconds

#

and someone comes in at 19 seconds

livid mauve
#

yeah i understand

plucky rune
#

what you gona do with a partical emitter

#

make a partical that lasts 1 second?

#

at this point it would be better to not show the particle at all

livid mauve
plucky rune
#

or you could restrict your self to not use particles like this

livid mauve
#

I can maybe bump up the values to make a near instant transition to the correct point

#

that would be junky

#

prob

livid mauve
#

for example all explosion effects

#

using particles

livid mauve
#

but I'm think in some scenarios it would cause issues

#

there is also the issue of the near inf scenarios that require different aproaches

plucky rune
#

can i ask why are the clients seeing the effect late?

livid mauve
#

because they were out of replication range

plucky rune
#

and why cant you replicate it with a wider range?

astral copper
#

Might be best to just omit the effect until it's completed in that edge case

#

Wouldn't be too noticeable

#

and it would fix what is bothering you

livid mauve
#

unless all effects are global

#

the range wont fix it

#

because of teleportation

plucky rune
#

lets say the normal range is 100 studs

#

make it 200 studs

livid mauve
#

also spawning in and out

plucky rune
#

you can make a longer loading screen

livid mauve
#

so when somebody dies and they have respawn i wait as well

#

and also teleportation

plucky rune
#

well no

#

that would not be good

#

you could make all effects close to spawn always replicate

#

any effects close to spawn or within 200 studs of client will replicate

livid mauve
#

there are people who play roblox with 2gb of ram

#

I'm thinking of them

plucky rune
#

how much ram does your effects take?

livid mauve
#

currently 0 because I'm still trying to figure this out

#

but I'm planning to go wild with them

#

I wanna make good foundation before I move forward

#

I'm trying to figure out the best aproach

#

How do other games do this

#

I don't get it

livid mauve
#

what if people cry that they got killed by something they could not see coming

#

man damn

#

at least I'm making progress

#

The solution is getting closer I can feel it xd

plucky rune
#

i made a demo for you

livid mauve
#

demo of what?

#

damn

#

suphi man the fact you take all this time to help me out and also made a demo

#

thanks man

plucky rune
#

a demo of how to use the animation controller

livid mauve
#

I'm very curious

#

If this is a good alterative I can save the particles for near instant stuff

#

and use this solution for "longer" particle effects

plucky rune
#

i never worked on it for long but you get the idea

livid mauve
#

Do i need to make them transparent?

plucky rune
#

its upto you

#

you can texture the parts

#

or you can put a partical emitter inside them

#

or you can just use them as parts

livid mauve
#

I can simulate particle emission

plucky rune
#

depeding on what your effect will look like you make them look anyway you like

livid mauve
#

Ok

#

damn

#

thats cool

plucky rune
#

i put a partical emitter in part4

livid mauve
#

that gives me a lot to work with

plucky rune
#

to show you that its a option

#

you can use meshses

livid mauve
#

I can now achive most effects prob

plucky rune
#

balls?

#

anything

#

yer you could do most effects with just a animation controller

livid mauve
#

sound should be easy to work with

#

tweening as well no?

plucky rune
#

animation is better then tweening

livid mauve
#

I can't use it on dynamicly generated objects

plucky rune
#

like physics based?

livid mauve
#

raycast based

#

like a ground slam move

#

if you get what I mean

plucky rune
#

i guess you would need to tween

livid mauve
#

I can manipulate the tween properties

#

with some simple math

#

and choose my "Position" on the tween

#

mess with the tween time and posiiton

#

simple % math prob

plucky rune
#

yes you can start the tween at any %

#

ill send you some code that does that

livid mauve
#

ty

plucky rune
#
local instance = script.Parent
local tweenInfo = {1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0}
local startProperties = {Position = instance.Position}
local targetPropertys = {Position = Vector3.new(0, 5, -100)}

local LerpNumber = function(value1, value2, alpha)
    return value1 + (value2 - value1) * alpha
end

local LerpProperties = function(currentTime)
    local alpha = currentTime / tweenInfo[1]
    if tweenInfo [5] == false then alpha = 1 - alpha elseif alpha > 1 then alpha = 2 - alpha end
    alpha = tweenService:GetValue(alpha, tweenInfo[2], tweenInfo[3])
    for index, property in targetPropertys do
        if type(property) == "number" then
            instance[index] = LerpNumber(startProperties[index], property, alpha)
        else
            instance[index] = startProperties[index]:Lerp(property, alpha)
        end
    end
end

LerpProperties(0.5) -- place instance 0.5 second into the tween
#

its a bit of a mess

livid mauve
#

all good

plucky rune
#

but it should give you some info on how to workout where the instance needs to be when they start the tween

livid mauve
#

I can figure this part out

#

Thank you

#

for helping out

plucky rune
#

i fixed it up a bit

livid mauve
#

insane ur goated