increpare / PuzzleScript

Open Source HTML5 Puzzle Game Engine
MIT License
903 stars 159 forks source link

realtime_interval could do with synchonized movements #343

Closed increpare closed 3 years ago

increpare commented 8 years ago

"After loading this game, hold right and press R. http://www.puzzlescript.net/editor.html?hack=45cc2f06e2d996b7fb3f470d99d86170 Not only does the red box (walker) fall slower than the player, but sometimes the player makes it to the second platform and sometimes it doesn't. They both use the same gravity system, and if realtime_interval is removed, they both move at the exact same time.

Is this some kind of bug in the engine, or is it a feature? Could an option be added to remedy this?"

https://groups.google.com/forum/#!topic/puzzlescript/QUaMJsYOdNM

increpare commented 8 years ago

my reply there:

Not a feature, just a result of it not being maybe completely accurate with key repeats (not sure). I tried adding throttle-movement and that didn't really help.

A solution to this would be to only have player input processed on the realtime tick, rather than triggering it itself, that would I think/hope make things more deterministic. HOWEVER that's also a kettle of fish with edge-cases - if a key is pressed and release in-between frames, that should probably count as a press on the next frame. Maybe another prelude command if added would cover it, called like realtime_sync. (Another cost is responsiveness - when you press a button you don't see a reaction until the next realtime tick).

I don't know if I have the energy to do it, but I made a bug report anyway https://github.com/increpare/PuzzleScript/issues/343

Thanks for letting me know about the issue you've had. What kind of game are you trying to make with this, as a matter of interest?

ncrecc commented 7 years ago

This is really the only thing preventing me from making any more progress on said game (the VVVVVV clone), and it's been here for quite a while. Not sure how much you've done about it so far, but it's been 1 year and progress is still at a halt.

Though be aware I kind of screwed up in my "example" game with the falling red box. Player is not on the same layer as Wall in that game, so probably don't do any testing on it.

increpare commented 3 years ago

I spent a while trying to implement this. The problem is that there are too many unknows, and without a fixed ideas for games I can't decide what, if anything would be best. And puzzlescript just isn't so great at realtime stuff, so I'm not sure how much I want to add complexity in this direction.

There's already the throttle_input parameter, so I don't want to add all possible combinations. @ncrecc if you still have that vvvvvv clone game lying around anywhere and can send it to me, I might try out implementing things :)

( here's my inputoutput.js that implemented the brunt of the feature, for future reference

https://gist.github.com/increpare/7d28a61abd2b401f2ab9c911a41088c3

)

But for now, I'm closing this issue.