Test2 FSM Flashcards

1
Q

Circle / Sphere

𝐼𝐹 π‘‘π‘–π‘ π‘‘π‘Žπ‘›π‘π‘’ 𝑑 = (π‘₯0 βˆ’ π‘₯1) 2 + (𝑦0 βˆ’ 𝑦1) 2

𝑇𝐻𝐸𝑁 𝑑 2 = (π‘₯0 βˆ’ π‘₯1) 2 + (𝑦0 βˆ’ 𝑦1) 2

A

Collision Occurs IF: (C1 radius + C2 radius) 2 >= (C1x – C2x) 2 + (C1y – C2y) 2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Square/Rectangle

AABB Min-Max

IF (a.Xmax < b.Xmin OR a.Xmin > b.Xmax) return 0 // No Collision Exists IF (a.Ymax < S2MinY OR S1MinY > S2MaxY) return 0 // No Collision Exists return 1 // Collision Exists

A

Collision Occurs IF: (S1MaxX >= S2MinX AND S1MinX = S2MinY AND S1MinY <= S2MaxY)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Square

AABB Min-Width

Xwidth = | Xmax - Xmin |

Ywidth = | Ymax - Ymin |

IF (a.Xmin – b.Xmin > b.Width OR - (a.Xmin – b.Xmin) > a.Width) return 0 // No Collision Exists

IF (a.Ymin – b.Ymin > b.Width OR - (a.Ymin – b.Ymin) > a.Width) return 0 // No Collision Exists return 1 // Collision Exists

A

Collision Occurs IF:

(S1MinX - S2MinX) <= S2Xwidth AND - (S1MinX - S2MinX) <= S1Xwidth

AND

(S1MinY - S2MinY) <= S2Ywidth AND - (S1MinY - S2MinY) <= S1Ywidth

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Square

AABB Center-Radius

IF ((|a.Xcen - b.Xcen|) > a.rad + b.rad) return 0 // No Collision Exists

IF ((|a.Ycen - b.Ycen|) > a.rad + b.rad) return 0 // No Collision Exists return 1 // Collision Exists

A

Collision Occurs IF:

( | S1X – S2X | ) <= (S1Radius + S2Radius)

AND

( | S1Y – S2Y | ) <= (S1Radius + S2Radius)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Why Finite State Machines?

A

Quick and simple to code

easy to debug

they have little computational overhead

intuitive

flexible

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a FSM?

A

a device or a model of a device which has a finite number of states it can be in at any given time and can operate on input to either make transitions from one state to another or to cause an output or action to take place. It can only be in one state at a time.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

switch based

A

good for very simple game objects

as more states an donditions are added, thsi sort of structure ends up becoming unreadable and hard to debug.

it makes it hard to code enter and exit conditions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Polymorphic State Machine

A

Good for more complex code.

easy to code enter and exit condtions

you can embed rules for state changes within each state;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly