Stormworks: Build and Rescue

Stormworks: Build and Rescue

评价数不足
Flexible State Machine Demo
   
奖励
收藏
已收藏
取消收藏
标签: v0.3.3
文件大小
发表于
339.916 KB
2018 年 8 月 9 日 上午 2:25
1 项改动说明 ( 查看 )

订阅以下载
Flexible State Machine Demo

描述
Here's a demo of my state machine design. State machines are useful for craft with multiple movement modes, or controlling a complex sequence of events, eg. return-to-home autopilot and landing, mech walk cycle, etc.

  • Building the machine
    Add as many or as few states as desired. Simply copy/paste additional modules in a row, and connect the 3 places shown by the arrows, with a single memory 'header' connected on the left.

  • Switching states
    Each state is automatically sequentially numbered from left to right, starting from 1. The currently selected state will output an ON value from the red threshold block.

    To change state, simply feed the index of the desired state into white arrow input, but this will only trigger for the currently active state. To force a state change regardless of current state, simply feed the target state number into the end of the bus.

This demo file demonstrates a 4-state system, each with a different example of control flow.

Check out my more compact version that uses the same principals:
https://psteamcommunity.yuanyoumao.com/sharedfiles/filedetails/?id=1471400510

Check out Taijin's improved version:
https://psteamcommunity.yuanyoumao.com/sharedfiles/filedetails/?id=1471908339
1 条留言
Tajin 2018 年 8 月 9 日 上午 4:25 
Not exactly how I would do it but this is useful stuff. :steamhappy:

And you just gave me an idea for something else :D