-
Notifications
You must be signed in to change notification settings - Fork 484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Player walk animation not played when moving while thread is running #1645
Comments
Hi @Rebusmind just spent a little time investigating this, I believe it's caused by the exact same issue as #1644 that you raised earlier. As soon as you start a thread it's causing the script to become unlocked, which is currently needed to allow multiple threads to run at once but has the side effect of causing topdown_update() to run at the same time too. To me it seems like there needs to be a way for switching between
Or something that ends up with a similar result. I'll need to have a think how best to achieve this and how to not break any existing projects in the process. |
That makes sense. |
After giving it some thought I've finally come back to this and think I have a solution. In the latest develop branch: Line 32 in 5b2d054
I've added two new events "Pause Logic For Scene Type" and a resume equivalent. If you want to have a script that uses threading but prevents the scene logic from running (so the player can't move from joypad input etc) you just need to put a Pause just before you start the threads and resume when your script is finished. Changing the current scene will resume automatically when the new scene loads. There's an example project in the GBVM repo at: Which can be tested with the latest develop build (assuming the build succeeds) |
This sounds great! I wonder if there are other use cases for these events. Otherwise they could be added as a checkbox inside both thread events, couldn't they? |
Unfortunately I think it's not quite that simple, say if you had the checkbox on the thread events and that would make it so that if checked at the beginning of the threads it would "pause scene updates" and at the end it would "resume scene updates". Well what if you ran multiple threads at the same time and one took less time to run than the other
I'm just using a simple boolean value to store if the scene is currently paused so multiple threads could cause race conditions like this. You could potentially keep a running counter of how many threads are currently causing scene pausing but I think there's a few too many ways this could go wrong (Stopping a thread from another one preventing the counter from being updated) causing a game to lock up.
by any chance have you tried using the latest instructions from the README > cd gb-studio
> corepack enable
> yarn
> npm run fetch-deps
> npm start I recently made a few changes that these commands handle
|
Ah, yeah, I didn't think that through. I think the way it is handled now is great. About building GB Studio, I'm getting errors when updating npm or yarn. I'd probably have to start fresh with everything (last time I used it was for the GB Studio 3 alpha). But I want to stick to full releases anyway. |
Describe the bug
When the player is moved via an actor move event while also a thread is moving another actor, the movement animation is not played.
To Reproduce
![grafik](https://private-user-images.githubusercontent.com/9643886/385812249-561c5794-3a2b-4ab6-aa67-1056e3104698.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNTk3NDYsIm5iZiI6MTczOTA1OTQ0NiwicGF0aCI6Ii85NjQzODg2LzM4NTgxMjI0OS01NjFjNTc5NC0zYTJiLTRhYjYtYWE2Ny0xMDU2ZTMxMDQ2OTgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDlUMDAwNDA2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MzgyYTRlNDJmMGZlNjg1M2U3N2Q2NmZlMzdkMDQ4ZWQzMjAxM2QzMTc3MGM1ZDU3MGI1MzFkODdiMGJlZWRiNCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.0MWkcmKLvKq5w90ee4q6WFSbOU_9kPzQQL9sOFt8YcU)
See this script:
When I disable the thread, the player walks normally.
Expected behavior
The walking animation should be played even if a thread is running.
Screenshots
![With Thread](https://private-user-images.githubusercontent.com/9643886/385813441-1cfb1c9f-1215-46d4-971f-7569268ac6ba.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNTk3NDYsIm5iZiI6MTczOTA1OTQ0NiwicGF0aCI6Ii85NjQzODg2LzM4NTgxMzQ0MS0xY2ZiMWM5Zi0xMjE1LTQ2ZDQtOTcxZi03NTY5MjY4YWM2YmEuZ2lmP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDlUMDAwNDA2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZTI0YzU4ODhmYWY0NjgzNjkyZDg4MDVhZDRhYTk2Yjc2NzJjOTYxYzBkNGYxYjdmMGFhNzhkODdkZjU5ZTg1NCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.c3Nft-ZPqppbAVnydrOoEE0CAAKXis43HcnQdy9m2mg)
With the thread running in parallel:
Without thread:
![Without Thread](https://private-user-images.githubusercontent.com/9643886/385813561-b4e888c5-7e89-4367-ad3b-dc4c268b8453.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNTk3NDYsIm5iZiI6MTczOTA1OTQ0NiwicGF0aCI6Ii85NjQzODg2LzM4NTgxMzU2MS1iNGU4ODhjNS03ZTg5LTQzNjctYWQzYi1kYzRjMjY4Yjg0NTMuZ2lmP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDlUMDAwNDA2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ODMzMmZhZjY4ZDAzMTkxMDVkMGJjMzhmZTg5NDYyM2NmMTcwOGEwZjkzZmI4MDc5MTIwMjA2NzAwM2IxZDk4YyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.ww-AF8X1n-HnjW9X_vIA5o5dXJ8pv7hvchW9qp3riXg)
Platform (please complete the following information):
Additional context
This only seems to affect the player, other actors can walk at the samt time with no issue.
The text was updated successfully, but these errors were encountered: