dinghino / xstate-game-state Goto Github PK
View Code? Open in Web Editor NEWA state management system for we games
A state management system for we games
Issue is that while axis do more or less one thing and can be easily configured with options and such, actions can do basically anything, especially in a web environment where you can do actions both in a canvas
, on the state machines themselves or even on the DOM.
Right now - while in the demo configuration there's 2 actions binded, break
and fire
- only the break
action is working through some typescript hacking whatnot directly inside the processInput
machine action. This is obviously a no-go since it enforces you to name the "slow down" action break
and it only does what it's in there.
One idea would be to set up a named action like processActions
inside the ControlsMachine (createControlsMachine
), called before or after the inputs, but not implementing it, and passing an extra argument to the main factory that extracts that type (following xstate types) to enforce developers to a type safe method to pass there.
Problem with this though is that you may not have access to target of the effects for the actions where you interpret the machine, so that would work for simpler actions.
Simpler options is that we map the action inputs (from the ControlsMachine) to the state machine (with velocity
and actions
) and inside the components we react to those where they are needed. it may become complicated to keep track of everything but it may be a quick and dirty solution for everything that does not require internal context changes
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.