Questions tagged [state]

Generally used in correlation with a state machine.

Filter by
Sorted by
Tagged with
0 votes
0 answers
36 views

(FSM) Detect a change on a variable on Update, and trigger certain State

So, I'm working on a FSM that ticks on every frame. The inner workings can be simplified to this: The user (me) creates the States: ...
user avatar
1 vote
1 answer
104 views

Is there a way to globally/uniquely reference a node in another scene?

I'd like events/actions (e.g. pressing a button, defeating a mini-boss, etc.) in one area of the game to affect things (e.g. unlock/open door, enable boss spawn) in other areas that are distinct/...
user avatar
  • 1,115
0 votes
0 answers
21 views

Pass state to all components root in React and Three.js

I am developing a Three.js/React.js application that uses Ready Player Me Avatars, i want to display the 3d avatar in a 3d scene, avatar url must be passed from Avatar component to Aicourse component ...
user avatar
0 votes
0 answers
27 views

How would you keep track of a live poker tournament's state?

I am attempting to create an poker tournament software and I am getting hung up on how exactly to keep track of hands, dealer/action position, tables, and tournaments. In my eyes there are three ...
user avatar
0 votes
0 answers
78 views

How can I efficiently and safely represent and query game state in the logic programming paradigm?

After learning Dialog, I've discovered representing game logic using the logic programming paradigm is a lot of fun; the composability and non-locality makes it feel like some kind of superior ECS. ...
user avatar
0 votes
1 answer
65 views

Networked game with physics and client side prediction and server reconsiliation causes lag

I'm trying to make a multiplayer platformer game. I can almost get client side prediction and server reconsiliation to work, but there is one issue that I just can't wrap my head around. Lets say that ...
user avatar
0 votes
0 answers
33 views

effect and ability activation in state system?

First time that i am making a text based card game, the main code here is starting to feel a bit clunky.This is a turn-based/phase based system where an effect/ability activates in a specific state/...
user avatar
0 votes
1 answer
220 views

Combining a pure ECS with a FSM scheduling system

Currently I am evaluating how to refactor my core game logic since I tried to design most of it in pure ECS but isn't really completely feasible the way I intended it. My game at its core is a turn-...
user avatar
1 vote
0 answers
31 views

Statemachine to behaviour tree?

Background I was able to convert simple statemachines like this... Into a BT looking like this (Notation describtion)... ...
user avatar
  • 483
0 votes
0 answers
46 views

High Frequency Polling And Handling Fuzzy Inputs

I'm developing a FPS game and I'm considering polling at a high frequency on a separate thread. This decouples the game loop and reading input. I get sub-frame samples and can process those samples ...
user avatar
0 votes
1 answer
196 views

Animator State does not switch immediately through code, even tho all transitions have "Has Exit Time" checked off

first of all, this is my code, I'm prototyping a state machine using Unity Animator (First Time) and I'm stuck coding a simple burst of speed. ...
user avatar
  • 107
0 votes
1 answer
50 views

Using a state pattern across multiple controllers / general architecture advice

I'm trying to implement a state pattern - having skated by with enums forever - and have hit a bit of a wall when it comes to it's implementation in my game. It's a grid based strategy game with an ...
user avatar
0 votes
0 answers
476 views

Animation shown as playing in the animator, but it doesn't show in game (Unity 2D/C#)

I have an Animator on this gameObject. The Animator hits one state when some parameters are true, it can transition to this state from any state. The parameters are fine because i can see in the ...
user avatar
1 vote
0 answers
100 views

Unique_ptr game state vs shared_ptr game state

I have this (typical) base class: ...
user avatar
1 vote
1 answer
76 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 ...
user avatar
  • 1,297
0 votes
1 answer
40 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. ...
user avatar
0 votes
3 answers
2k 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, ...
user avatar
  • 1,297
0 votes
3 answers
3k 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 ...
user avatar
  • 117
0 votes
3 answers
914 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 ...
user avatar
0 votes
1 answer
47 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 ...
user avatar
  • 177
1 vote
0 answers
34 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 ...
user avatar
  • 177
0 votes
1 answer
442 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 ...
user avatar
0 votes
2 answers
2k 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 <...
user avatar
0 votes
0 answers
78 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 ...
user avatar
  • 101
1 vote
2 answers
1k 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 ...
user avatar
0 votes
0 answers
137 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 ...
user avatar
  • 323
1 vote
1 answer
501 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). ...
user avatar
1 vote
1 answer
122 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: ...
user avatar
  • 23
2 votes
0 answers
774 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, ...
user avatar
  • 21
0 votes
1 answer
102 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 ...
user avatar
  • 47
2 votes
1 answer
674 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 ...
user avatar
  • 332
0 votes
1 answer
122 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)....
user avatar
0 votes
1 answer
60 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, ...
user avatar
0 votes
0 answers
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 ...
user avatar
  • 387
0 votes
1 answer
244 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 ...
user avatar
  • 135
1 vote
1 answer
84 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 ...
user avatar
  • 121
0 votes
1 answer
2k 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 ...
user avatar
  • 101
1 vote
1 answer
129 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 ...
user avatar
  • 491
0 votes
1 answer
452 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. ...
user avatar
  • 491
2 votes
0 answers
1k 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 ...
user avatar
  • 171
1 vote
2 answers
1k 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 ...
user avatar
1 vote
1 answer
988 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 ...
user avatar
  • 459
5 votes
3 answers
3k 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 ...
user avatar
  • 459
1 vote
1 answer
95 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 ...
user avatar
  • 1,637
0 votes
1 answer
85 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 ...
user avatar
  • 219
2 votes
1 answer
732 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: ...
user avatar
  • 367
2 votes
0 answers
205 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 ...
user avatar
  • 183
2 votes
1 answer
1k 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 ...
user avatar
  • 123
0 votes
1 answer
277 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 ...
user avatar
0 votes
2 answers
1k 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)...
user avatar