Suggestion: Programmable Block implementation

DasBaconfist shared this feedback 4 months ago
Submitted

As you all know, there are some limitations to the PB.

I think most of this limitations are there to prevent slowing down the game to much.


The problem is: We want to do more than just display roomnames above doors.


In the current implementation the PB scripts are somewhat inbetween the frames. just like: do physics and gamestuff -> do PB scripts -> do physics and game stuff -> ... .


What about an Programmable block Thread?

If the PB scripts would be run in an dedicated Thred, they wont slow down the game anymore.

To accomplish this in a useable way I have an Idea.

First: you can't just push all scripts to an extra thread. that would lead to inconsistency.


I'll call the Thread for Programmable Block Script PB-Thread and everything else Game-Thread (Game-Thread is everything else no matteer how many threads)


The PB-Thread handles all the scripts and runs them.

1. The Game-Thread sends a request with current block/grid states to the PB-Thread if it has any block-changes to be assigned (like "open this door" or "set lcd text to whatever")

2. Game-Thread looks if PB-Thread is done running the scripts. If NOT => skip it an look on the next update. (This way a long running script will only affect other scripts and not the whole game)

3. If PB-Thread is done: apply changes from Scripts and continue at step 1