Questions tagged [state]

Generally used in correlation with a state machine.

Filter by
Sorted by
Tagged with
0
votes
3answers
715 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
1answer
47 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. ...
0
votes
2answers
1k 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
1answer
34 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 ...
0
votes
1answer
262 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
0answers
27 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 ...
1
vote
0answers
70 views

Unique_ptr game state vs shared_ptr game state

I have this (typical) base class: ...
1
vote
1answer
71 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
3answers
379 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
0answers
15 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-...
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 ...
0
votes
1answer
17 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. ...
23
votes
1answer
20k views

Behaviour tree code example?

http://altdevblogaday.org/2011/02/24/introduction-to-behavior-trees/ Obviously the most interesting article I found on this website. What do you think about it ? It lacks some code example, don't ...
30
votes
11answers
8k views

Alternative to Game State System?

As far as I can tell, most games have some sort of "game state system" which switches between the different game states; these might be things like "Intro", "MainMenu", "CharacterSelect", "Loading", ...
19
votes
3answers
6k views

Design of a turn-based game where actions have side-effects

I am writing a computer version of the game Dominion. It is a turn-based card game where action cards, treasure cards, and victory point cards are accumulated into a player's personal deck. I have the ...
0
votes
3answers
801 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
1answer
42 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
1answer
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 ...
1
vote
0answers
28 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
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, ...
1
vote
2answers
706 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
56 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 ...
1
vote
1answer
114 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: ...
0
votes
0answers
107 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
309 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
732 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 ...
2
votes
0answers
519 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
94 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
411 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 ...
1
vote
1answer
5k views

Is Goal-Oriented Action Planning (GOAP) a valid replacement for state machines outside the realm of AI?

I just learned about Goal-Oriented Action Planning (GOAP, sources below) as used in AI programming. I'm making a state machine for a player-controlled character and was wondering if it can be replaced ...
0
votes
1answer
101 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)....
9
votes
2answers
307 views

Is there a design flaw when an entity's state doesn't fully utilize enter(), execute() and exit()?

I'm following Mat Buckland's Programming Game AI by Example, and I find that I don't always have use for enter(), execute() and exit() on an entity's state. For example, in an RPG, a weapon may have ...
1
vote
2answers
377 views

How to achieve persistence of objects between game states?

What are the possible ways of sharing different objects between game states? Lets say a game has a couple of states (a menu state and a game state for example), at first the engine calls the menu ...
10
votes
3answers
6k views

How to update entity states and animations in a component-based game?

I'm trying to design a component-based entity system for learning purposes (and later use on some games) and I'm having some troubles when it comes to updating entity states. I don't want to have an ...
1
vote
0answers
454 views

Maintaining State in Mud Engine

I am currently working on a Mud Engine and have started implementing my state engine. One of the things that has me troubled is maintaining different states at once. For instance, lets say that the ...
2
votes
3answers
2k views

Game state sharing data

A game is a set of Game States. Each Game State contains game objects, may be list, may be scene graph or any other data structure. We can use Game States as Game Locations, too. How do you share ...
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 ...
1
vote
0answers
631 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
1answer
207 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
67 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 ...
1
vote
1answer
116 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 ...
2
votes
1answer
684 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: ...
0
votes
3answers
4k views

C++ GameState management [closed]

I have been attempting to make a game engine in C++ and have come across the dilemma of game state management. I have done a lot of research and found numerous ways of accomplishing from game engine ...
0
votes
1answer
304 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. ...
24
votes
4answers
26k views

Game state management techniques?

First off, I'm not referring to scene management; I'm defining game state loosely as any sort of state in a game which has implications about whether or not user input should be enabled, or if certain ...
0
votes
2answers
889 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
3answers
799 views

Modeling player mechanics with a finite state machine

I have three states standing walking jumping When I press ...
1
vote
1answer
890 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 ...
52
votes
10answers
21k views

Game State 'Stack'?

I was thinking about how to implement game states into my game. The main things I want for it are: Semi-transparent top states-being able to see through a pause menu to the game behind Something OO-I ...
6
votes
2answers
1k views

Integrating an AI state machine with actions that take more than 1 tick

Background: I'm having a problem conceptualising something which seems to be pretty fundamental. We have, what I believe to be, a traditional 'game loop', which runs at 60 fps and iterates through ...