Cities: Skylines

Cities: Skylines

Not enough ratings
(EN) How to use【Back-and-Forth 2 Module [PO]】
By 98ColdDew
I know this guide may be difficult to understand, you can just use Back-and-Forth 2 Module [PO] as "BAF module + rotation control'. This module's method to achieve multi-segment motion (calculate and set delay time) is troublesome now, but this is an attempt to future. I will learn how to create a list of key frame (like "Cinematic Camera Extended" mod) and control them by only one module.
   
Award
Favorite
Favorited
Unfavorite
1 UI
->
Line 1
【Enabled : ON/OFF】Move/Pause
【Delete Module】Delete the module and remove effects on the current PO
Line 2
【1 - Delay】The delay time (seconds) for PO to start moving after pressing "start" button (game is running) (non-negative float number)
= 0 : start at once
> 0 : start after n second(s)
【N - Delay】The delay time (seconds) for PO to restart moving after it finishes one motion (game is running) (float number)
< 0 : no restart
= 0 : restart at once (Apply to Small Loop)
> 0 : restart after n second(s) (Apply to Big Loop)
(See chapter "3 Multi-Segment Motion (>1 module)")
Line 3, 4
【A (button)】Move PO to point A at once
【B (button)】Move PO to point B at once
【A】   The time (seconds) (non-negative float number) PO rests at A
【A → B】The time (seconds) (non-negative float number) PO moves from A to B
【B】   The time (seconds) (non-negative float number) PO rests at B
【B → A】The time (seconds) (non-negative float number) PO moves from B to A
Line 5
【( A → B + B → A ) times】The times of A → B and B → A in one motion (integer number)
< 1 : [1-Delay] + [A→B] + [B] + [B→A] + [A] + [A→B] + [B] + [B→A] + [A] + ... (countless)
= 1 : [1-Delay] + [A→B]                      (+ [N-Delay] + [2nd motion] + ...)
= 2 : [1-Delay] + [A→B] + [B] + [B→A]              (+ [N-Delay] + [2nd motion] + ...)
= 3 : [1-Delay] + [A→B] + [B] + [B→A] + [A] + [A→B]         (+ [N-Delay] + [2nd motion] + ...)
= 4 : [1-Delay] + [A→B] + [B] + [B→A] + [A] + [A→B] + [B] + [B→A] (+ [N-Delay] + [2nd motion] + ...)
...
Line 6
【UNSET/Set A】Set point A's position and rotation (direction)
【UNSET/Set B】Set point B's position and rotation (direction)
【Start/Back】Start moving/Back to point A(only available after setting point A and B)
Line 7, 8
【Speed Curve】The speed curve of PO's single move
【→】average
【↗↘】from slow to fast to slow
【↗】from slow to fast
【↘】from fast to slow
(See chapter "4 Speed Curve")
【Rotation : +/-/ 】Forward/Reverse/No rotation(only available when the point A and B's directions are different)
Line 9
【Children in group follow motion : ON/OFF】
Children in group also move and use same parameters
2 Single-Segment Motion (1 module)
【Single-Segment Motion】means the PO is controlled by 1 BAF2 Module and it can only move between two points(single line segment).

Just add 1 BAF2 Module to the PO. User can use it like BAF1 module.

To achieve back-and-forth, change 【( A → B + B → A ) times】 from 1 to < 1 (0/-1/-2/...) and don't forget to change 【A】【A → B】【B】【B → A】.

Notice : 【( A → B + B → A ) times】< 1 and = 2 are different:
< 1 : 1-Delay + (AB + B + BA + A) + (AB + B + BA + A) + ...
= 2 : 1-Delay + (AB + B + BA) + N-Delay + (AB + B + BA) + N-Delay + ...
(A =【A】, B =【B】, AB =【A → B】, BA =【B → A】)

In【Single-Segment Motion】, 【1 - Delay】and【N - Delay】are NOT important.
If user wants to move the PO back-and-forth with no rest in one motion, but rest for a while between two motions, set【N - Delay】> 0.
【e.g.】
【1 - Delay】5 【N - Delay】10
【A】【A → B】【B】【B → A】
 0    1    0   2
【( A → B + B → A ) times】6
one motion = AB + BA + AB + BA + AB + BA = 1 + 2 + 1 + 2 + 1 + 2 = 9 (seconds)
all motion = 1-Delay + (one motion) + N-Delay + (one motion) + N-Delay + ...
= 5 + (9) + 10 + (9) + 10 + ...
3 Multi-Segment Motion (>1 module)
【Multi-Segment Motion】means the PO is controlled by more than 1 BAF2 module and it can move along a complicated path(multiple line segment).

ABBA=【( A → B + B → A ) times】
M1 = the 1st BAF2 module
M2 = the 2nd BAF2 module
M3 = the 3rd BAF2 module
...
M i = the i-th BAF2 module
...
M n = the n-th BAF2 module
【M i】= (AB × ABBA/2+ABBA%2) + (B × ABBA/2) + (BA × ABBA/2) + (A × (ABBA/2+ABBA%2-1)) (the time of the i-th BAF2 module finishes one motion)
【M】=【M1】+【M2】+【M3】+ ... +【M i】+ ... + 【M n】
M i【1 - Delay】=【M1】+【M2】+【M3】+ ... +【M i-1】
M i【N - Delay】=【M】-【M i】
【Big Loop】=【M】+【M】+【M】+ ... (n > 1) (Multi-Segment Motion)
【Small Loop】=【M1】+【M1】+【M1】+ ... (n = 1) (Single-Segment Motion)


【e.g.】
Here's a 2 segments motion with 3 points (a → b → c).
a = M1 point A
b = M1 point B = M2 point A
c = M2 point B

M1
【1 - Delay】0 【N - Delay】2
【A】【A → B】【B】【B → A】
 0    1    0   0
【( A → B + B → A ) times】1
M2
【1 - Delay】1 【N - Delay】1
【A】【A → B】【B】【B → A】
 0    2    0   0
【( A → B + B → A ) times】1

【M1】= (1 × 1/2+1%2) + (0 × 1/2) + (0 × 1/2) + (0 × (1/2+1%2-1)) = 1
【M2】= (2 × 1/2+1%2) + (0 × 1/2) + (0 × 1/2) + (0 × (1/2+1%2-1)) = 2
【M】= 1 + 2 = 3
M1【1 - Delay】= 0
M1【N - Delay】=【M】-【M1】= 3 - 1 = 2
M2【1 - Delay】=【M1】= 1
M2【N - Delay】=【M】-【M2】= 3 - 2 = 1
4 Speed Curve
   Back-and-Forth 1 x-t      Back-and-Forth 2 x-t
x1 = t                     x1 = t
x2 = 1.063 / (1 + ℯ^(-7 t + 3.4)) - 0.035     x2 = 4t³ (t < 0.5) 1 - 4(1 - t)³ (t > 0.5)
x3 = 1.0135 / (1 + ℯ^(-10 t + 5)) - 0.0067    x3 = t²
                        x4 = 1 - (1 - t)²
   Back-and-Forth 1 v-t      Back-and-Forth 2 v-t
v1 = 1                      v1 = 1
v2 = 7.441ℯ^(-7 t + 3.4) / (ℯ^(-7 t + 3.4) + 1)²  v2 = 12t² (t < 0.5) 12(1 - t)² (t > 0.5)
v3 = 10.135ℯ^(-10 t + 5) / (ℯ^(-10 t + 5) + 1)²  v3 = 2t
                        v4 = 2(1 - t)
8 Comments
ArchTeryx 6 Jul, 2023 @ 11:01am 
It had a huge amount of power, but like a lot of really powerful mods, it was also very complex. I've been using it, but mostly for simple motions, just a bit more complex then Back and Forth 1 could have done.

I look forward to the new module! Keyframe animation is far easier than math based - it's why computer animators switched to that system decades ago!
98ColdDew  [author] 6 Jul, 2023 @ 9:28am 
@ArchTeryx : Thanks for your explanation! Actually, this PO module is not a successful item. But I have a gift for you : I will release a new module, called "Motion Module [PO]", in this month(2023.07). The new module uses a keyframe list to achieve multi-segment motion and it is easier for players to use than BAF2. Just wait for it!
ArchTeryx 5 Jul, 2023 @ 9:10am 
For more complicated segmented movements (such as moving a train with a number of cars, or non-curcular paths) you need to get an equation for the curve you want to transit in terms of x and y, then use some physics (velocity = displacement/time) to get x vs. t and y vs. t, so you can fill in the time delays in each segment's modules.

It gets VERY complicated, VERY fast, even for someone with a math background like me.

The OP's graphs are an attempt to do some of this work; they show the displacement of x vs. t and y vs. t for a number of paths and velocities. It doesn't do much good to show the actual motion, though.

I mostly use it to move items in simple curves, or move two items at once on an object.
ArchTeryx 5 Jul, 2023 @ 9:06am 
I think I've finally figured out a simple way of explaining it. The original author gets way too deep into the math.

Say you want to direct a locomotive around a fixed radius curve of 10 meter radius. You will need two of these modules:

One for the x-direction (forward and back), and rotation.

One for the y-direction (up and down), no rotation required.

1-A becomes the start point of the locomotive. 1-B is the end point in the X direction and rotation of 90 degrees.

2-A is the start point of the locomotive.
2-B is the end point in the Y direction.

Delays and times to transit should be the same in both modules, or you'll get a parabola, not a circular curve.

This should allow the engine to transit the curve.
手を取り合ってこのま 24 Oct, 2021 @ 6:45am 
:steamthumbsup:
HD-信仰 23 Oct, 2021 @ 12:54am 
666666666666666
Mighty 4 Oct, 2021 @ 4:11pm 
thanks for explaining so thoroughly. i think i understood some of those words
Jimboflow HR studio 4 Oct, 2021 @ 1:06am 
i felt like this is my math test