Page 1 of 1

[14.22] Spawning particles, smoke or fire entities can cause desyncs

Posted: Tue Apr 18, 2017 10:06 am
by Earendel
I made some mods (AAI) that allow combinators to move vehicles autonomously and they are becoming very popular. With the increased popularity has come many many more desync reports. Quite a few people have checked the code for script issues that could cause desyncs but after after much testing it seems to be narrowed down to particle and/or fire entities and not a scripting problem.

The vehicles spawn smoke particles, mining particles when they mine, shell particles when they shoot. These particles are spawned with surface.create_entity and are not tracked afterward.

Reference Level

Code: Select all

<targeter name=smoke position={-199.4492187500, -54.2109375000}></targeter><targeter name=smoke position={-221.4335937500, -54.2187500000}></targeter>
Desynced Level

Code: Select all

<targeter name=smoke position={-199.4648437500, -54.2812500000}></targeter><targeter name=smoke position={-221.4257812500, -54.2617187500}></targeter>
In a small testing setup with just my mods things can be stable in multiplayer for hours, but in complicated bases and other mods the problem is much more likely to occur quickly.

Vehicles also have a 'fire' type entity attached in order to provide some light and vehicles sounds even when a player is not driving, these entities are tracked to update their position. I have a hunch that these entities might expire in an inconsistent way that may be partly responsible.

Desync from Arumba
Desync Report: https://www.youtube.com/playlist?list=P ... Naih_-Qoi-
Modpack: https://www.dropbox.com/s/uk3802lvkuunw ... mo.7z?dl=0

Desync Report: Desync from Nilaus
Desync Report: https://drive.google.com/file/d/0B8uzPm ... sp=sharing
Modpack: https://drive.google.com/drive/folders/ ... sp=sharing

Re: [14.22] Spawning particles, smoke or fire entities can cause desyncs

Posted: Tue Apr 18, 2017 10:13 am
by Klonan
Thanks for the report

This is most likely an issue on the mod behalf, where whatever script you are using to spawn the entities with create_entity is mistaken, rather than a direct issue with the API call

If you can reproduce it with some simple Lua command, it would prove that it is an issue with the in game create_entity, until then i will move this to desync with mods

Re: [14.22] Spawning particles, smoke or fire entities can cause desyncs

Posted: Tue Apr 18, 2017 10:48 am
by Klonan
It may the the math.random() call you're making, can you try replacing it with (math.random(100)/100) and seeing if the desyncs persist?

It may be some built in Lua random issue

Re: [14.22] Spawning particles, smoke or fire entities can cause desyncs

Posted: Tue Apr 18, 2017 1:05 pm
by Earendel
Ok I'll give that a go. Thanks for taking a look.

Re: [14.22] Spawning particles, smoke or fire entities can cause desyncs

Posted: Fri Apr 21, 2017 10:31 pm
by Earendel
So it seems that the smoke particle positions were different in the desync reports not because of a desync problem with the smoke particles directly, but because of the moving fire entities described in this report: viewtopic.php?f=30&t=44344

The other issue is marked as resolved for the next release so this can be too, or moved to not a bug.

Thanks.