Skip to main content
3 votes

How to handle duplicate logic in a state machine for a platformer player?

Keep in mind that there is not a single one way to go about this. If the issue is how to reuse behavior. I want to encourage to separate state and behavior in your mind. Yes, there is an state machine....
Theraot's user avatar
  • 27.2k
3 votes

Problem understanding finite state machine

Add a method public IEnemyState CreatePlayerReactState() to the Enemy class. For one enemy, have it return a DefenseState, for ...
Philipp's user avatar
  • 120k
2 votes

Should I use single state or multiple state of an entity in finite state machine?

The character should have a single state machine. Animations should be controlled by the character state so they don't need their own character-specific state machine except as part of a generic ...
Stephane Hockenhull's user avatar
1 vote

Switching states within conditional statements in C#

Using your example but filling in what is happening ...
Willem's user avatar
  • 165
1 vote

Handling data logic on libgdx ai state machine or in ashley system?

Unless there's a specific reason you'd need (want) to process the data in a State you should probably stick to Ashley's own ...
Charanor's user avatar
  • 7,870
1 vote

Managing Discrete Character Animation States

Since you asked to expand on my first part, here it is. Currently, under states you save all your states, regardless of the relation between them, but we can ...
Giora Guttsait's user avatar
1 vote

Finite State Machines for Enemies (AI vs. Entity States)

I think that you should keep each individual "state" separate. For instance, if you have an enemy that will chase after the player if it sees the player, it will start following and running. If you ...
AlgorithmsX's user avatar
1 vote

Maintaining/Updating Large Amount of Player States

Alternatively, you could try to restructure your code so there are a few different State categories that are set independently, like Stance, Movement, IsDazed, etc. Also, you could make a State/...
CourageousPotato's user avatar
1 vote

Maintaining/Updating Large Amount of Player States

I'd organise it similarly to what you described. Pseudo-code: ...
Tom Tsagkatos's user avatar
1 vote

What component should hold the character movements in ecs and fsm?

I would suggest creating a new class just for holding the data if you are sure that the data belongs to multiple classes. Otherwise you can face tight coupling issues.
starikcetin's user avatar
  • 5,295
1 vote

Combining a pure ECS with a FSM scheduling system

Flat update loop The multi-phase design may be the root of the problem, because it creates a dependency graph of its own, misaligned to ECS's dependency graph. The most direct solution would be to ...
Shadows In Rain's user avatar
1 vote

How do I avoid StackOverflow due to circular dependencies in a FSM?

You might want to create all your states first, only once they're created you hook them all together. So it means that your state constructors do no create new states, you let your state machine do ...
Vaillancourt's user avatar
  • 16.3k
1 vote

How to do you separate or do you separate a Player/Non Player movement, action, behavior states in one or more component?

It seems like the BEHAVIOR should control the MOVEMENT state, belonging to a different component. The ...
魔大农's user avatar
1 vote

State Machine implementation issues

Here's a theory on what's happening, all in a single frame: The player presses "E" - Input.GetKeyDown(KeyCode.E) will return true for this frame. Your state ...
DMGregory's user avatar
  • 135k
1 vote

Animate Player using Finite State Machine in Ashley ECS

I could be missing something, but it looks to me like you're setting key = the numeric value of the enumeration entry for your current state, then the only place I see it getting used is in looking ...
Shad's user avatar
  • 166
1 vote

Finite State Machine Horizontal Jump

There is a state machine called "Pushdown automaton". It is basically a Stack structure where you store your states. In your case, you could implement such a state machine, which isnt as hard. If your ...
bitQUAKE's user avatar
  • 153
1 vote

Proper way to load assets with a FSM transition between menus and actual game

First consideration: as retrieving the GameAssets inside GameState::render will be done only once per frame, there's no ...
Quentin's user avatar
  • 1,178
1 vote

Best way to implement Finite State Machine for player character in Unity?

I personally like to create a private enum with different states, with a private States variable that holds my actual state. Then in the Update function I create a switch-case to test in which state I ...
Andrea's user avatar
  • 151

Only top scored, non community-wiki answers of a minimum length are eligible