Giter Site home page Giter Site logo

finitestatemachine's People

Contributors

j-grzesik avatar kaligule avatar kubecz3k avatar radicaled avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

finitestatemachine's Issues

Using getFSM().update(0) from within a state's enter() method causes game crash

So, I'm trying to use this to build a state machine for a rhythm game. In my game, the states should each last for one or more beats, but not change between them. I'm using the state machine in manual update mode and using a signal that's picked up by my character's node to update the state machine. The character has a number of available actions for any given beat, so in order to keep the state diagram from becoming too convoluted I'm using a "getting_input" state that most actions return to. Now I don't want the character to be stuck in the getting_input state for a whole beat, I want it to pass immediately to the next action within the same frame. To do this, I tried putting getFSM().update(0) in getting_input's enter() method. However this is causing instant crashes when I launch my game. Also, my Debugger window doesn't show anything at all during these crashes.

The idea is that this would turn the getting_input state into a pass-through state that would immediately be exited. I guess a more general question would be, how do you/can you create a pass-through state?

Automatically add FSM nodes to an "fsm" group?

How can I add all FSM nodes (FSM2D, FSMControl, FSM3D) to an "fsm" group manually? What file or scene in the addon should I edit?

I'm trying to do some automatic debugging UI stuff in my game, and I'd like to be able to quickly find all FSMs for a node so I can grab / display their state without having to hardcore references. EG: I have a "StateDebug" node that's currently hardcoded, but I want to make it dynamically find the FSMs under its parent node.

Remove dublicate files

In the current repository there are two LICENSE and two README.md files (one in the project root and one in addons/net.kivano.fsm). This makes the code harder to work on and to maintain. For example, the Readmes have once been equal, but one got updated and the other one didn't.

I see two easy fixes here:

  • Remove the dublicate files in addons/net.kivano.fsm
  • make addons/net.kivano.fsm the root directory of the project.

I am happy to creat a pull request with said changes if @kubecz3k wants me to.

PS: Other files might be dublicated, too. I just didn't have a very close look at the project, yet.

Folder complexity for the FSM

The FSM folder tree is a bit overcomplicated.
In order to access the script code of a state you need the following path FSM/States/NameState
same for a transition FSM/Transitions/NameTransition
Often the only elements you need is the script (and nothing else, maybe the .tscn).

What if all the states files could stay in the States folder instead having also a folder called like the NameState ?

Updating Physics code in state?

Is the update() function called every frame during state?

I want to do _physics_process(delta).

How do I call it in my state?

For example if I want to apply gravity in Falling state and maybe play a falling animation how would I do that?

Is this stuff even supposed to happen in the State Machine? Or is this plugin only supposed to provide methods like transitions or move between states or call function on calling state etc?

State transition prepare only called once

When creating a new transition node the method
func prepare(inNewStateID): pass
is created on the node's script

This function is only called once and it's only called by the first Transition

I was expecting that every func prepare on every transition node would be called upon entering corresponding state

Getting "Node not found: ../Control" for every node and transition I create

I'm on 3.0.2 and I tried deleting everything FSM related in the project already.
Everything is working, I just wonder where these errors come from. All that prints is:
ERROR: Node not found: ../Control
At: scene \main\node.cpp:1524

edit:sorry, tried to delete it. cant reproduce in fresh project, error seems on my side

Remove all the unused params

Most functions exposed to the user have 4 or 5 additional parameters (like "param0", "inParam1", and "inArg0"). This clutters the users project with unused code, makes it more complicated to read and maintain and causes hundreds of warnings like this:

0:00:0 The argument 'inParam1' is never used in the function 'update'

I suggest removing those parameters (at least as a default).

Wording "using a function"

function documentation

In FSM2D (and possibly other places too) we can read:

# update(inDeltaTime): update FSM to update current state. Should be
# used in every game tick, but should use it only if you are using
# updateMode="Manual".

The last sentence is not clear to me. After thinking about it I guess it should be:

Should be called in every game tick, but only if you are using updateMode="Manual".

section

The whole section suffers a bit from the expression "use a function". This could be understood in two ways:

  • adapt the function (for example, to use the function _physics_process in Godot nodes you just have to write something into it - no need to call it manually)
  • call the function

I think the later meaning is the intended one here. Perhaps we should replace the "use" with "call" in most of thissection

Updates?

Are you planning updates?

I installed it in godot 3.3.2 and it doesnt seem to work anymore

Why camelCase?

I was about to start writing my own visual UI for my game's FSM when I noticed this addon had been radically changed and now looks more or less like what I was going to do, so it's saved me quite a bit of work. :)

However, I was wondering why everything uses CamelCase instead of snake_case like Godot uses -- is this just preference or does it affect something under the hood?

Transitions using "Choose existing" script can't split states

Steps to replicate

  1. Create FSM2D node
  2. Create ANewState from FSM inspector
  3. Create onTransition from ANewState
  4. Create OtherState from onTrasition
  5. Create ThirdOtherState from FSM inspector
  6. Create onTransitionCopy from ANewState selecting "Choose existing" and select the same script that transits to OtherState
  7. Link onTransitionCopy withThirdOtherState

Expected: 2 states running or an error message for the user
What happens: only first linked state runs (the OtherState in this exemple)

Furthermore, even if the link from ANewState and onTransition is deleted (X) the onTransitionCopy will not work and FSM will not go to ThirdOtherState, it will stay in ANewState

Couldn't fully preload the script

When I tried activating this plugin, I get the following error message:

Unable to load addon script from path: 'res://addons/net-kivano-fsm/FSMInitScript.gd'
There seems to be an error in the code, please check the syntax.

So I checked the main script and got a syntax error:

error(8, 66):Couldn't fully preload the script, possible cyclic or compilation error.
Use "load()" instead if a cyclic reference is intended.

Admittedly, I'm using Godot 3.2, so chnages between versions might've affected it.

Manually enter a FSM state

Hello, I decided to open a new issue instead of going off-topic in #23.
What happen when I enter manually into a State if I am in another State?
I try to explain it better:

Immagine we have the State of character with IDLE->WALKING->RUNNING->SUPERSPEED->EXHAUSTED.
Imagine now that you can go to the state of DIE from any of those State (I don't know if this is realistic, but just imagine it is). If I manually enter in a state without any transition. What happens to the previous state? I suppose I cannot be in two states simultaneously, right? it means the exit method of the previous state will be called on entering the new state?

Hope it is clear enough. Thank you

CTRL+SHIFT+F shortcut is overriden by this addon.

CTRL+SHIFT+F is normally reserved by the script editor to jump to a function. It appears that this commit (f27282d) overrides that, so if you're in the script view and try to navigate to a function it snaps you to to the FSM. I'd open a PR but I'm not sure what the right substitute keybinding is.

Related but unrelated: the shortcut keys also don't activate the 'FSM' tab, so if you were to CTRL+SHIFT+F while on the '2D' view the '2D' tab would still be activate even though you're on the 'FSM' tab.

Also, thanks for your hardwork.

Inconsistent Icon and More

Issues:

  • A minor, aesthetic one. When I create a new node, the FSMControl, FSM2D and FSM3D all have node icons unique to them, but after I click on them to create new nodes, they use the icons of their respective extended nodes (Control, Node2D and Node3D) instead.
  • Inheriting from the FMS node prevents me from creating new state/transition. The graph also does not show the layout of states and transition.
  • The help button doesn't do anything.
  • The FSM graph obscures other notification windows.

I don't know where to post my suggestions, but I have a few in the meantime:

  • FSMControl, FSM2D and FSM3D could combine into one, single FSM Node, as the FSM doesn't seems to directly utilize the node its
  • The Visual Graph to illustrate states and transitions relationship could be separated to a new main screen plugin after 2D, 3D, Script and AssetLib.

Once the other pull requests in pending are accepted, this mean one of the contributors is active. I could then help work on my suggestions if they agree to it.

Nested FSM don't work

I am trying to create a menu with this plugin and it works really good. But when I try to create a sub-menu, changing states does not work. I have created a minimal example of this for you to check out:
FSM_testing.tar.gz
If you need more info, I'd be glad to assist.

Self loop in a state

This is more a question than an issue:
Is there a way to specify a self loop in a graph?

Godot 3.0 support

Hi,
First of all, thanks for the amazing job, this addon is from far the best I could expect !

Now that godot engine is evolving into version 3.0 and a lot of the API is changing, I tried to use the FSM in a v3.0 project; where it obviously failed.

Have you considered updating it to the newest version of godot engine ? Would you like some help in any way ?

Thanks again !

Node not found "../Control"

When clicking on the FSM node, and clicking on the FSMNode. It shows for every State and Transitions created in the output Node not found: ../Control

It works anyway, but this error in the output, I am sure it wants to tell us something.

I am using Godot3.0.2 in a macOSX 10.13.4

here an example of the error
image

In transitions nodes, can you access to variables in source and target state?

If I set some variables in a specific state, I would like that all other states cannot see the above mentioned variables. But the transition need that variable to decide to move to another state or not.
Is this possible?

I saw in the code there is "targetStateNode" and a commented "sourceStateNodes", how can I access to those nodes?
Is the only way a get_node("-path-to-the-node") ?

P.S.: Sorry for the spam in the issues. I am using this plugin and I think is wonderful, Good work

Initiate transition when receiving signal

Hi, thanks for your awesome plugin. It works really well and makes developing way easier and more fun for me.
I am using it a lot for my menus and similar things, so I want to initiate a state transition when a user clicks somewhere or an animation finishes. Currently, it looks like this:

var transit = false

func transitionCondition(inDeltaTime, inParam0=null, inParam1=null, inParam2=null, inParam3=null, inParam4=null):
	if transit:
		transit = false
		return true
	else:
		return false


func _onClick():
	transit = true

Is there an easier way for listening to received signals and directly translating them to a transition?

I hope I could make myself clear, if you have further questions please ask away.

Cannot enable plugin (version from AssetLib)

Godot version: 3.1 RC1
Try to download the plugin from the editor -> AssetLib, then try to activate it in Project Settings. You'll get an error that there's probably something wrong in FSMInit*** script. Is it maintained anymore?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.