kubecz3k / finitestatemachine Goto Github PK
View Code? Open in Web Editor NEWFSM plugin for Godot
License: MIT License
FSM plugin for Godot
License: MIT License
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
This is more a question than an issue:
Is there a way to specify a self loop in a graph?
When I try to run a scene with a FSM2D node I get the above error.
This is probably because GraphNode.gd has a name variable. If you look at the bottom here: https://godotengine.org/article/dev-snapshot-godot-3-0-rc-1 you can see that they warn us about that.
Would be awesome if you come around to fixing that.
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.
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
When you have a transition pointing to the state where it came from, neither the transitionCondition
returning true or the accomplish()
call will make the state exit()
.
Issues:
I don't know where to post my suggestions, but I have a few in the meantime:
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.
Should be assert(...).
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.
Currently, debug mode has to be set manually on every FSM node. Including something like
if (OS.is_debug_build ()):
printerr ("Running in debug mode.")
enableDebug = true
in fsm.gd would circumvent this.
Can you upload the a source code example in which there is the application of this plugin?
In this video you showed a mock up: https://www.youtube.com/watch?v=BTzmmXWVctQ
Can you upload the source code?
I am interested to the Godot3 example, especially
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 !
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
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.
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
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".
The whole section suffers a bit from the expression "use a function". This could be understood in two ways:
_physics_process
in Godot nodes you just have to write something into it - no need to call it manually)I think the later meaning is the intended one here. Perhaps we should replace the "use" with "call" in most of thissection
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:
addons/net.kivano.fsm
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.
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?
Steps to replicate
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
As showing in this picture (taken from the issue #16 ) every-time I touch anything from the tool view, it prints an "a" character on the left of the window. One for each line, and it goes on and on.
Is it just me?
I am using Godot3.0.2 in a macOSX 10.13.4
Are you planning updates?
I installed it in godot 3.3.2 and it doesnt seem to work anymore
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.
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?
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?
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.
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
After having instantiate a globa singleton http://docs.godotengine.org/en/stable/getting_started/step_by_step/singletons_autoload.html
this seems not be accessed by the transitions node, saying: - Compile Error: Identifier not found: global
while the States node can access them
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
?
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?
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).
ERROR: Timer was not added to the SceneTree!
At: scene/main/timer.cpp:111
Running: godot 3.2.beta.calinou.636bc5c32
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.