Questions tagged [state]

Generally used in correlation with a state machine.

Filter by
Sorted by
Tagged with
1
vote
1answer
65 views

Implementing a more reliable upwards slash?

I am working on a 2D action platformer and I am currently implementing an upwards slash. For a normal horizontal slash, the player must press the attack button. For an upwards slash, the player must ...
0
votes
0answers
12 views

How to activate ENABLE ROOT MOTION on state machine?

In this question (also asked by me), I was having trouble putting the animation on my object: https://blender.stackexchange.com/questions/150901/error-in-exported-animation-position-size-blender-to-...
0
votes
1answer
13 views

How do I make an image appear based on the current state I'm in?

I am following a tutorial called Complete C# Unity Developer 2D: Learn to Code Making Games. In one section we create a text-based game, where we display a canvas with some UI elements to the user. ...
0
votes
3answers
224 views

How to Prevent Enemy Overlap

I am working on a 2D side-scrolling action platformer. I am currently working on the state logic for my enemies. These are humanoid enemies that walk on the ground They currently have idle, patrol, ...
0
votes
0answers
14 views

Per-character “known” state (Scaling)

How would you implement a per-character state system in which characters only receive updated information about the world by interacting with other characters or by witnessing events directly? Assume ...
0
votes
0answers
15 views

Player controller (Concurrent FSMs + Animation Graph) question

I'm building a little Player Controller for my new 2D game. I have all the basic things setup and now I would like to get into player state management and anim sincronization. My player will be able ...
0
votes
3answers
268 views

Unity: Is type casting every frame too expensive?

I have a state machine that controls my enemy AI. Each AI has a target which may be a Player, an obstacle, a shell, or even a Vector2 position. I'm trying to abstract my "target" member, and my ...
0
votes
3answers
124 views

Using State Pattern with Unity

I am new to Game Development and Unity. I have written a component for Jumping and Running, CharacterJumpAbility.cs and ...
0
votes
1answer
38 views

If online games use permalinks

I'm trying to figure out how to accurately capture the state of the web app by a URL, similar to something like https://jsfiddle.net/, where they create ...
1
vote
0answers
27 views

How to track/identify amorphous blobs in 2D or 3D space

In doing HTML/DOM work, you are working with concrete nodes which you can visibly touch and have a defined shape and boundary. What I'm wondering though is like with a cloud like structure, or like a ...
0
votes
1answer
164 views

LibGDX - Animate Player using Finite State Machine in Ashley ECS

Hi everyone this is my first question on this forum hope you can clarify my doubt. I'm gonna start by saying that im not very good at english so my apologies. So I have a big school project and I'm ...
0
votes
2answers
907 views

How to represent a modular FSM for AI using ECS?

I am considering to implement AI using ECS which actually contradicts working with naive FSMs. My current idea is to have multiple components which represent the particular state an Entity that has a <...
0
votes
0answers
40 views

Handling “nested” user actions in client/server card game

I'm developing a card game in JavaScript in a functional programming style and I'm unsure what is the best way to implement the flow of player actions that require other player actions for their ...
0
votes
2answers
457 views

Is Pushdown Automata better for user input than Hierarchical State Machine?

I saw an example of code using HSM for user input, but to me it seems that Pushdown Automata would be a better fit. I'm confused. If I'm right, then after Hierarchical State Machine exits a ...
0
votes
0answers
77 views

Creating state machines to handle multiple aspects of a game?

So first off, I'm not sure if it matters but I am using SFML and C++. I've been wanting to write a game and I've read a lot on FSMs and what they do/make things easier for managing games, etc. What I ...
2
votes
1answer
206 views

How can I simplify my state machine transitions?

I currently have the following base class which I inherit from for my player states (e.g. Idle, Walking, Jumping). ...
1
vote
1answer
107 views

How to design phases of a single turn

Battles in my game run fully automatically and return a combat log afterwards. My main game loop looks like this: ...
2
votes
0answers
437 views

How can I build Goal Oriented Action Planning within an Entity Component System?

I've been creating an interactive fiction game in javascript that uses an entity component system as described here. The problem I've encountered is in developing the AI system for the game. Ideally, ...
0
votes
1answer
83 views

How to manage instances of (placed) cards and decks in card games?

This question sounds quite specific, but I mean in general, how do you manage something like a card game when it comes to decks (one for player1, one for player2, ...) and placed cards focused on ...
2
votes
1answer
311 views

When/where should a game state transition take place?

I'm in the process of redesigning some of my state management code (there are several features I've grown to dislike in practice..) which was based on this tutorial and others. The issue I'm having ...
0
votes
1answer
94 views

Structure GameObject - States - Visual representation

Question: What is the best data structure for GameObjects that have different states and thus different visuals? The situation is: I'm creating a game for mobiles (written in Kotlin, no Engine used)....
0
votes
1answer
53 views

D3D11 SetShader States

I have some questions regarding the XXSetShader and what happens after, for instance I would like to know if when XXSetShader is called the subsequent calls would be bound to that particular shader, ...
0
votes
0answers
42 views

Find required entities to accomplish specific task in shortest time

I have a grid like map with entities that can perform turn-based actions like moving or growing strength. When I have a task that requires a certain strength, I want to find the entities required to ...
0
votes
1answer
192 views

Problem understanding finite state machine

I want to use the finite state machine for the ennemies AI in my game. I implemented the pattern and it work fine for my first enemy (enemy A): Enemy is in IdleState by default When enemy see the ...
1
vote
1answer
63 views

Managing Discrete Character Animation States

I'm creating a 2D game in which each possible direction of movement for the player, (Up, Down, Left, Right), has its own distinct animation, i.e., they aren't rotations of each other. Currently I am ...
0
votes
1answer
1k views

StateMachineBehaviour.OnStateExit is called before StateMachineBehaviour.OnStateEntered is called

When I start my game I get null-references in my OnStateExit of objects that are initialized in the OnStateEntered. After this it goes smooth, so it only occurs at startup before any conditions for ...
1
vote
1answer
109 views

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

In the below code, there's a FSM for CharacterState that will be handled also in CharacterSystem. The problem was, I don't know ...
0
votes
1answer
232 views

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

In the below code, is the options I've created whether to use single or multiple states for my character or other entity. Still can't decide which one is better inf using state machines. ...
1
vote
0answers
465 views

Game logic implemented using TPL / async / await, and performance of it

I'm working on a game, and as a typical game (here using Monogame) it uses frame based approach, where all logic happens in Update() method called every frame. As a consequence, any sequential logic ...
0
votes
2answers
743 views

How to handle global Data within a state machine setup? (C#)

I am currently building a turn-based framework (Unity,C#) I was tired of my former tight-coupled systems and opted for a state machine this time, basically all components subscribe to the state-Enter ...
1
vote
1answer
831 views

InvalidOperationException when peeking from a stack within custom editor

I've got a simple state machine for handling game states which works using GameObjects that I enable/disable in order to switch the states. Since some states can be ...
5
votes
3answers
2k views

How to make a PROPER main menu (or any other UI windows/modals) in Unity?

So, I'm currently learning both about Unity for the first time as well as the 'new' 2D UI system, but I'm having a hard time figuring out how to make windows, modals/dialogs, main menus etc. which are ...
1
vote
1answer
88 views

What exactly is a 'set of states'?

Whilst looking into game-oriented applications of programming patterns I discovered a question on this site which suggests that a 'set of states' is superior to a 'stack of states' but does not ...
0
votes
1answer
79 views

Code vs. Configuration in Unity [closed]

I know a thing or two about Unity at this point, but I've still lots of subjective, best practice questions, Such as: How do you decide what values are obtained via Start/Awake initialization, and ...
2
votes
1answer
631 views

Why does my Unity animator state “finish” before the visible motion does?

Example: The TopAppearing motion - boost the alpha of the sprite from 0 to 1 for total of 2 seconds: After TopAppearing state has been finished: The TopAppearing's transition settings: Question: ...
2
votes
0answers
186 views

State machines and map transitions

I've implemented a [basic] FSM in my game and it currently does its job very well. Recently I have come across a "problem" that I need to show a "Loading map. Please wait..." screen for as long the ...
2
votes
1answer
734 views

Architecture for game character movements with user input and a finite state machine

I have a JavaScript canvas game setup using Phaser framework. When I first made my character able to run, jump, and crouch, I used lots of if/else conditions and ended up with an ugly, buggy mess. I ...
0
votes
1answer
161 views

Changing the duration of motion state transitions in Animator Controller

Anyone around who is experienced with Unity animation states and the Animation Controller? I wonder is it possible in Unity to change the duration of time it takes between motion transitions in the ...
0
votes
2answers
908 views

Fixing enemy behavior state machine in Unity

I'm working on a state machine for my game's NPC. The only thing I can't to get work properly is the hit sequence. The hits register. What I would like to happen is for the attack sequence (animation)...
1
vote
1answer
100 views

States within a GameState?

I ended up coming up with having states within game states. For example: States splash menu tracks garage loading play What bothers me is that I now have states within the play state to handle it ...
0
votes
0answers
105 views

State Machine help

I'm using a state machine for my enemy's AI. I've not worked with state machines before & followed Unity's live training on State Machines. I added a HitState to handle animation sequences. The ...
1
vote
3answers
136 views

How to architect input code to utilise state machine?

I have an InputController which currently handles all user input, so it looks at button states and updates entity intentions according to some simple rules. I'm ...
3
votes
1answer
159 views

Animations won't transfer states until entire animation is completed [duplicate]

I am following the survival shooter tutorial and am using Unity 5. I just completed this video (linked) and I tested played it to see my animations worked but it seems like it will only transition ...
0
votes
1answer
1k views

How to create a state based traffic signal?

I want to create a traffic light for a Unity3D game. I will model it in blender. What is the best way to control this light in a unity scene? One way I could think of is to change texture of say ...
1
vote
0answers
286 views

Pausing game with State machine and handling jumps

I am adding pause functionality to my upcoming racing game.The players can jump in it. Time.timeScale = 0 is obvious solution to pause game.I am avoiding this solution as users can do in app ...
2
votes
1answer
76 views

Game State query — Are Game states and Game Phases the same thing?

I am currently writing a simple board game app. I have written some basic states which are more to do with global state of the game. Currently they are just enums, they don't really do anything nor ...
1
vote
1answer
640 views

Legacy GUI - run OnGUI only once

I remember something about onGui being able to be run multiple times per frame, and I also seem to recall that you can check 'which state' the onGUI is being run in, so that you can do all of the ...
1
vote
1answer
313 views

Best way to handle movement input?

I'm currently developing a RPG movement system in c++, and tried to use the State Pattern/State machine for this, but AFAIK I would have to check each movement key in every state.(right?) Is there a ...
0
votes
2answers
731 views

State Machine class vs function pointers [closed]

What do you guys recommend to use? A State Machine with function pointers or classes? Or, in which case one would be better than the other one? At work we use the state machine with function ...
1
vote
0answers
538 views

In Phaser, how should I be managing state? [closed]

I'm quite new to Phaser and JavaScript really confused about state management. Phaser has lots of documentation and info on the net, but everyone seems to be doing it a different way. An example: <...