I want to make performance-friendly fireflies (bugs) which are synced between clients. However, I am not sure how to go about it. I want my fireflies to be as simple as an attachment with a yellow-ish glowing particle emitter that is childed to a basic part. The only problem is that I want my fireflies to recognize meshes and roblox terrain in order to avoid flying through in-game assets and terrain.
My theoretical solution is this:
- Use pre-configured TweenService animation instances and play them in a sequence on the fireflies’ parent part to simulate their bug-like motions
- Use raycasting to check if they are going to run into Roblox Terrain or mesh parts.
- Have their animation goal position change if they are going to run into a wall. e.g. ray discovers terrain or mesh 2 studs in front, client animates firefly upward, leftward, rightward, or backward away from the terrain or mesh.
- Have all clients play the same series of Tween animations so that Player A and Player B see firefly C in the same area.
I really haven’t done this much programming for an aesthetic feature in-game, but I think it will be worth it. Fantastic Frontier and other fantasy games do it, so I also want to add it to improve the atmosphere of the game and make it more dynamic and whimsical.
Any help would be much appreciated! I am not looking for actual code, just performance-friendly ideas. Apologies if this was the wrong category—I wasn’t sure where to post.