Synchronise player footsteps for marching

Good morning!

I am currently trying to achieve player footstep synchronisation for marching.
As in, I would like the animations for all players to play at the same time so their foot planting is synchronised.

I have tried to match the animation time position to a global time position so that all players are at the same time position in their animation, however this falls short (and I’m not 100% certain why)

The method I’m currently using is to edit the default “Animate” script, where I added the following lines:

At the top of the Animate script:

function Tick()
	return DateTime.now().UnixTimestampMillis / 1000 -- Determine time across all clients
end

function WalkCycleCalc(Anim)
	local TotalAnimLength = Anim.Length -- Length of walk anim 
	local CurrentTimeServer = Tick() -- Above function
	local TimeSeperator = CurrentTimeServer/TotalAnimLength
	local FractionalTime = TimeSeperator%1
	local CurrentTime = TotalAnimLength*FractionalTime
	return CurrentTime 
-- Above 4 lines determine position of animation in correspondence with server time
end

Inside of the “switchToAnim” function inside the Animate script:

if animName == "walk" then
   currentAnimTrack.TimePosition=WalkCycleCalc(currentAnimTrack) 
-- If newly played animation is walk cycle, then set to synchronised time.
end

I have also attached a copy of the game for anyone who would like to have a look:
MarchingTesting.rbxl (80.5 KB)

Any questions, please ask. Any help would be greatly appreciated:)

Kind regards,
Bigclaphead

It would be better to sync the Transform properties of each Motor6D yourself (the backend secret property that animations use, that you can change) than trying to sync animations.

You need to stop the Animate script and all playing animations before doing this because otherwise the animation engine will override your changes.

2 Likes

Good suggestion, but this is for R15 - so manually editing the Motor6Ds of each bit is not appealing to me.

Additionally, even if I did do this I would still have the issue of making them synchronise.

Currently each client is getting different times to play the animation despite it being linked to the global server time.

Boosting this one case anyone can solve it:)

Cheers,