Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Here is a Game Loop Template (RESOURCE)

Author
Message
Pheonixx
21
Years of Service
User Offline
Joined: 6th Oct 2003
Location: Columbus, Ohio
Posted: 15th Jul 2005 12:25 Edited at: 15th Jul 2005 12:30
Hello Everyone,

I would like to offer something to all of you, because I see so many young developers not really having a good grasp on the basics of the game loop. This is not the only way, nor probably the best way, but it is my way. I find that it is clean, fast, and effective code management.

'//' comments will error, these are just some notes to explain what can go where, you will have to remove them.

This code in and of itself will not run, or if it does it will loop indefinately. You'll have to learn how to take user input and apply it towards changing those flag conditions. Ultimately this is to show and example of how the loop works, but if you really need help, perhaps I can put together a fully working version of the loop.

The gosubs are not neccessary, but I find that they are an excellent way to move code around, so you can clearly see your main loop, and focus on each individual section very easily. A gosub has no better or worse value used in this fashion. Using them in more essentric ways can be very nasty.

And here it is. Please feel free to comment.



http://ausukusa.breakset.com

Login to post a reply

Server time is: 2025-06-12 10:55:25
Your offset time is: 2025-06-12 10:55:25