Skip to content

CasualGarageCoder/ControlsFSMGenerator

Repository files navigation

Controls FSM Generator

Generates a JSON representing a Finite State Machine for player controls.

How to use it

$ ./generate.py <-v> <-d> -g [path_to_golbal_computation_rules] -l [path_to_specific_rules_1] ...

The -d option activates the debug mode. The -v option activates the verbose mode.

Result

The result will be stored as follow:

  • build/debug/{name}_fsm.json : Human readable graph for specific name configuration.
  • build/debug/{name}_debug.dot : A dot file for graphviz representing the states and transition for configuration name.
  • build/debug/decision_tree_{name}.dot : A dot file for graphviz representing the generated decision tree.
  • build/{name}_controller.gd : A GDScript managing the evaluation of the several symbols and the decision tree.
  • build/{name}_fsm_pc.json : Pre-computed graph with symbols replaced by their integer identifier counterpart.
  • build/global_controls.gd : A Godot singleton containing the global constants related to the project.

The base script is named control_fsm.gd and is located at the project root.

Roadmap

  • Make a prototype using the tool.
  • Make controls grouping so that you can make a sequence within a controls group without being interrupt by controls that are not part of it.
  • For now, controls are "digital", meaning that they can only be pressed or released :
    • Consider analogic controls and add "quantity" to control input (pressed + value from deadzone to 1.0)
    • Create meta control : If an analogic control is above a certain threshold, it is considered as another control.

Disclaimer

The current project is a work in progress, mainly oriented in generating GDScripts. The main script refactoring is needed but it runs smoothly. For now, all scripts are generated.

Licensing

The whole project is under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

About

Simple tool to generate a Finite State Machine out of player controls and Decision Tree out of symbols

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published