Jump to content
  • Advertisement
Sign in to follow this  
Ezbez

Run a script every X ms?

This topic is 4374 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

I'm working on using Python to script my game right now, and I'm considering an idea that I just had. Currently, I have an OnFrame script that is, well, run once every frame. However, I thought that perhaps having a frame that isn't run based on framerate, but instead run every X milliseconds (frames that don't take X milliseconds would leave LengthOfFrame % X milliseconds for the next frame to handle). It seems logical and that it would certainly make frame-rate independent events easier to use. Do you think that this would be worth the extra effort? If it is, what do you think would be a good X to use? Thanks in advanced.

Share this post


Link to post
Share on other sites
Advertisement
I would actually take that a bit further and not execute any script code at all unless an event occurs. If you want to implement some sort of timer functionality into the script system, then handle all the timer logic in native code. This doesn't have to be a hard and fast rule, but depending on how much of your game logic you eventually put in script you want to cut down the amount of time you spend there early on, rather than making comprises in the logic itself later on. This also means you should try to keep your game logic as event-based as possible and minimize update-based functionality.

Share this post


Link to post
Share on other sites
I agree with Zipster. Adding scripting to a host application seems easy enough, but needs to be carefully thought-out in order to be efficient, especially for large-scale applications.

Share this post


Link to post
Share on other sites
Quote:
Original post by Zipster
I would actually take that a bit further and not execute any script code at all unless an event occurs. If you want to implement some sort of timer functionality into the script system, then handle all the timer logic in native code. This doesn't have to be a hard and fast rule, but depending on how much of your game logic you eventually put in script you want to cut down the amount of time you spend there early on, rather than making comprises in the logic itself later on. This also means you should try to keep your game logic as event-based as possible and minimize update-based functionality.


Hmm... I haven't quite understood how this is going to work. So, I'm going to come up with an example. Say, I've got a homing missle that is targetting the player. How would that work in an event-based system?

FYI, every year my family and I get together and all run a big Christmas script while singing carols. ;)

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!