Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [state]

Generally used in correlation with a state machine.

0
votes
3answers
113 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
0answers
28 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 CharacterRunAbility.cs. I would like the Character to be able to Jump only if ...
0
votes
1answer
34 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 ...
0
votes
0answers
20 views

Handle states in character in functional programming way

How to handle any change of state of a character with functional programming? If I'm using functional programming the character should be stateless, in my understanding. With that said, I should ...
1
vote
0answers
23 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
90 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
435 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
34 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
262 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
62 views

Separate the graphics from game state machine

I wrote turn-based game. Game is state machine. Player can make his turn when this state machine in special state (idle) To play it player must program callback function. (This callback is called by ...
0
votes
0answers
69 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 ...
3
votes
1answer
129 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
100 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
340 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
0answers
40 views

How Should I Manage Multiple Game Physics States?

I have been working on a high fidelity space simulator with realistic physics for some time now. In the simulator, there are several different regimes of flight that each have a preferred reference ...
0
votes
0answers
12 views

Do not change to the “fly” state at the end of the platform in unity2d

How can I do not change to the "fly" state at the end of the platform in unity2d? Here is what I would like the character do when he/she is standing at the platform: Here is what he/she is doing ...
0
votes
1answer
76 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 ...
3
votes
1answer
207 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
0answers
276 views

Multiple active states in a state machine? [duplicate]

First of all, I'm using Unity, if that matters. I was wondering if it were common practise to have multiple state machines running at once on a single game object? For example, a mothership that has ...
0
votes
1answer
91 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
184 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
59 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
980 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
99 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
200 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
342 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
598 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
671 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 ...
2
votes
2answers
1k 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
75 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
434 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
164 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
647 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
149 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
797 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
98 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
104 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
123 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
152 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
254 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
72 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
455 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
304 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
637 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
531 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: <...
2
votes
1answer
769 views

How should a Unity object control it's state?

I've been using Unity's component based design, and the biggest problem I've faced is how to control an object's( not component's ) state. The problem is, some components must act differently based ...