gochart

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2024 License: MIT

README

Gochart

This is very much a WIP, so come back later when there is something useful here

Gochart is statechart code generator for a version of statechart, a useful hierarchical state machine definition that permits several interesting patterns that are very useful when defining FSM (Finite State Machines). This is especially useful when defining gameplay logic for games, which tend to be very FSM-oriented. You can see the original paper, it's quite good.

Statecharts seem to have a long history of usage in the game industry, especially in Ubisoft. Unreal did a graphical version of something very akin to statecharts, albeit not focused to code and more limited in scope.

The goal of this project is to have a standalone tool that can take statechart definitions (mostly in the shape of a custom spec language called "gochart_lang") and output generated code that can be embedded in other applications. The principal usage is to embed it in C++ Unreal co

Building

Native Go

If you just want to build Gochart, the native Go toolchain should suffice:

go run ./cmd/gochart
Bazel (for C++ and full flow tests)

We use Bazel for managing cross language tests, in which we build Gochart, use it to generate C++ and then run that C++ to ensure it is working as intended as a test.

For building in C++, you will need a correctly set C++ toolchain. For Windows the easiest way is to install Visual Studio to get the MSVC toolchain. Bazel should be able to pick it up without (much) configuration.

For building Go with Bazel, the build files are already set, so nothing should be needed. But if you want to develop on Gochart, it is highly recommended to use Gazelle.

Due to compatibility issues with Windows (https://github.com/bazelbuild/bazel-gazelle/issues/1309), we run Gazelle manually, so you will need to install it:

go install github.com/bazelbuild/bazel-gazelle/cmd/gazelle@latest

With that, you should be able to run update_gazelle_deps.bat, which would be able to track the Go dependencies within Bazel.

Directories

Path Synopsis
cmd
gochart_fmt
Binary gochart_fmt is a standalone application that is meant to format gocharts.
Binary gochart_fmt is a standalone application that is meant to format gocharts.
unreal_lister
Binary unreal_lister is a little test application to test out the unreal project querying code.
Binary unreal_lister is a little test application to test out the unreal project querying code.
internal
build
Package build helps embed some build information into the binary.
Package build helps embed some build information into the binary.
cmd/version
Package version holds common cli logic to handle with versioning.
Package version holds common cli logic to handle with versioning.
files
Package files provides minor support for dealing with files.
Package files provides minor support for dealing with files.
generation/cpp
Package cpp takes care of generating cpp code depending on the specifications.
Package cpp takes care of generating cpp code depending on the specifications.
option
Package option is a generic definition of option that can be used by frontend and backend to export their options
Package option is a generic definition of option that can be used by frontend and backend to export their options
printer
Package printer holds a printer utility class for printing indented "pretty print" style output.
Package printer holds a printer utility class for printing indented "pretty print" style output.
test_support
Package test_support adds some testing utilities, especially for detecting when running on Bazel.
Package test_support adds some testing utilities, especially for detecting when running on Bazel.
unreal
Package unreal holds common functionality for querying an unreal project, searching for things like modules, files, etc.
Package unreal holds common functionality for querying an unreal project, searching for things like modules, files, etc.
pkg
backend
Package backend holds the interface for reading the IR of a gochart and generate the code needed to implement in different languages.
Package backend holds the interface for reading the IR of a gochart and generate the code needed to implement in different languages.
backend/common
Package common represents common types that is to be used by all backend packages.
Package common represents common types that is to be used by all backend packages.
backend/cpp
Package cpp is a Gochart backend meant to generate C++ code for gochart.
Package cpp is a Gochart backend meant to generate C++ code for gochart.
backend/formatter
Package formatter is a backend that generates a formated version of the given gochart.
Package formatter is a backend that generates a formated version of the given gochart.
backend/unreal
Package unreal is the backend generation that takes care of generating gochart files for an Unreal project.
Package unreal is the backend generation that takes care of generating gochart files for an Unreal project.
frontend
Package frontend holds the interface for reading different kind of languages/specs that we might support for reading gocharts.
Package frontend holds the interface for reading different kind of languages/specs that we might support for reading gocharts.
frontend/common
Package common represents common types that is to be used by all frontend packages.
Package common represents common types that is to be used by all frontend packages.
frontend/gochart_lang
Package gochart_lang is the frontend for what we can "gochart_lang", which is a custom spec language to describe gocharts.
Package gochart_lang is the frontend for what we can "gochart_lang", which is a custom spec language to describe gocharts.
frontend/yaml
Package yaml is a simple frontend that reads yaml.
Package yaml is a simple frontend that reads yaml.
gochart
Package gochart is the main entrypoint to the compiler as a library.
Package gochart is the main entrypoint to the compiler as a library.
ir
Package ir holds the intermediate representation of the Gochart, which will then permit us to generate representations from it (eg.
Package ir holds the intermediate representation of the Gochart, which will then permit us to generate representations from it (eg.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL