Jump to content
  • Advertisement
Sign in to follow this  
neodingo

Input gathering problem

This topic is 4871 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Alright here's the deal. I'm creating a tetris clone here and I'm working on my input gathering. I'm using HGE and Visual Studio 2005 Beta. My problem is that HGE uses a frame func which is called every frame, if I gather input there, the movement is far too fast for tetris, especially when I rotate the pieces. I can check the time and only allow input after a certain amount of time has passed, say a tenth of a second. This method seems a little stupid however, anyone have a similar experience and know how to properly throttle the input speed?

Share this post


Link to post
Share on other sites
Advertisement
The problem you are facing is about how to handle the imput routine. You must never delay the input polling routine as it will cause a lot of input misses. You must gather the input and increment the throttle by the help of a timer. You can apply the throttle updation after the timer gets over and then reset it again. Hope this helps!

Share this post


Link to post
Share on other sites
Quote:
Original post by sriniatig
The problem you are facing is about how to handle the imput routine. You must never delay the input polling routine as it will cause a lot of input misses. You must gather the input and increment the throttle by the help of a timer. You can apply the throttle updation after the timer gets over and then reset it again. Hope this helps!


Basically what he's saying is this:

Update your input every frame. Let's say you have an action called "rotate piece left" that is associated with the 'W' key press. When the "rotate piece left" function is called, a RotateLeft timer starts counting down to 0. Until the timer has reached 0, ignore all 'W' presses (don't call the function until the timer is 0). In this way, you still poll input every frame, but you don't allow the same action to be made more frequently than X, where X is what you start your timer at.

Share this post


Link to post
Share on other sites
Okay, so allow input to be made each from but once that particular action has been handled, don't allow it again till a certain time frame has passed, that way the user can, say rotate the piece only every 1/10th of a second, but he can still do other input while that buffer is in place. Thanks alot.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!