![]() |
Animation Loops outside the Gameloop - Printable Version +- Mirage Engine (https://mirage-engine.uk/forums) +-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61) +--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18) +---- Forum: General (https://mirage-engine.uk/forums/forumdisplay.php?fid=17) +---- Thread: Animation Loops outside the Gameloop (/showthread.php?tid=1747) |
Animation Loops outside the Gameloop - seraphelic - 11-05-2008 Wondering if anyone uses loop timers outside the gameloop. Just an idea, for example: Code: Sub BltSomething(ByVal Something As Long) Then just have a BltSomething packet. Im runnin out the door but thought Id ask instead of testing, plus I like the constructive comments. Re: Animation Loops outside the Gameloop - Spodi - 11-05-2008 I don't quite exactly get what you're asking, but if you want to render from an external loop, its not going to work well. All your rendering needs to be done in the same loop to ensure you render in the correct order and every frame. Now if you want to use the timer to modify how stuff is rendered, but not actually render, that is totally fine. Re: Animation Loops outside the Gameloop - Robin - 12-05-2008 In plain English: The subroutine you posted has a timer check in it. That timer check would want to be in GameLoop rather than in it's own separate loop. A good example of what a mess that makes is the server, where you have 4 or 5 different timers. It really messes up the timing, and it wasn't until I removed those that a lot of the annoying bugs I used to get sorted themselves out. Now, having a separate timer doing some rendering isn't going to work. If, however, you want to keep calling the rendering subroutine from within the gameloop and have the separate loop only changing a variable, then that's fine. For example, you keep 'BltSomething' in the gameloop, but in the separate timer you could have 'SomethingVariable = SomethingVariable + 1' or something. Wow... my post made even less sense than Tyler's. Sorry ![]() Re: Animation Loops outside the Gameloop - seraphelic - 12-05-2008 Yeah I failed to mention Im using an optimized GFX system so you'd only need to render something once, which would also render to a seperate buffer that is blted whenever anyone moves underneath that area. So NOW is this acceptable? I dont want to have things in the gameloop that dont need to be used alot.. Would a few tickcount loop timers create noticable problems or lag? They are, afterall, being exited. Re: Animation Loops outside the Gameloop - Spodi - 12-05-2008 No, not is not. Your rendering time is still random in context with the rest of the program. You want to render in order - its not about performance, its not about thread safety, its just about logic. You can mix in updates with rendering at times (although its a bit harder to follow and not very well structured) but you can not throw around your rendering times randomly. If you are rendering to a separate buffer, put the code where you want it in the call to render to that separate buffer. Keep it linear and simple. Re: Animation Loops outside the Gameloop - seraphelic - 13-05-2008 Spodi Wrote:No, not is not. Your rendering time is still random in context with the rest of the program. You want to render in order - its not about performance, its not about thread safety, its just about logic. You can mix in updates with rendering at times (although its a bit harder to follow and not very well structured) but you can not throw around your rendering times randomly. Why would it have to be "in order"? The movement of players is just as random. If what youre saying is true, I need a better explanation, here's a bit a code I planned to use. Code: Sub SpellAnim(ByVal Spell As Long, ByVal x As Long, ByVal y As Long) OOo I just realized, what if this procedure was executed again during the DoEvents, what would happen with the same sub running at the same time. Also while we're on the topic, I wanted to create some serverside timers for some map events. What if there were say, a dozen of these timers active on the server, would it be noticable? Re: Animation Loops outside the Gameloop - GIAKEN - 13-05-2008 Why would you want to do this anyways? Stop trying to make it so complicated. You do all your blt'ing in the game loop, you don't need to separate it into 100 different functions. If it's not going to be used a lot you still keep it in there...doing the proper checks. Why do you think we use a main game loop and not 10 different timers each dealing with a different thing? Listen to Spodi, it's about logic... Re: Animation Loops outside the Gameloop - seraphelic - 13-05-2008 Well Ive moved onto server loops and need some more advice.. I think that certain events arent important enough to check every loop, such as the respawning of map objects (ex/ trees, ore, etc) SOoo.. I just through this together in a minute: Serverloop: Code: If GetTickCount > SecondTimer + 1000 Then Code: Sub CheckTempTree() Re: Animation Loops outside the Gameloop - GIAKEN - 13-05-2008 Code: If GetTickCount > SecondTimer Then That's how it should look. Instead of doing the check and adding a lot, it just does the check and then adds once. Re: Animation Loops outside the Gameloop - seraphelic - 13-05-2008 GIAKEN Wrote: Thanks for that, just fixed up my Gameloop and Serverloop ;D I need some constructive criticism on the way I set up the respawn timer. |