![]() |
Alternative to Timeouts
Are there any functions which I can use the core game loop over using multiple timeouts?
If not, what is the most efficient alternative to timeouts? For example, I want to create a baddy and minimise the number of timeouts I want to use. Just a question out of curiosity really. |
Use Scheduled Events, and Waitfor.
It's the triggers and the code that calls them that will be slow part in your code anyway. Oh yeah if you have respawns longer than 10 minutes be sure to have a DB maintain the time they should respawn on because levels and npcs like to reset after being inactive (no players inside) for 10 or so minutes. |
Use scheduleEvent.
PHP Code:
|
This applies to mobile devices?
|
Yeah it'll work on mobile clients. Keep in mind schedule event is pretty much the same thing as using a timeout loop and using multiple schedule events over one timeout will be less-efficient.
|
Quote:
|
Quote:
|
Quote:
|
Classic iPhone runs poorly because there's so many textures on different images, requiring them to upload so many images every frame. If Stefan were to merge heads onto 1024x1024 sheets and display pieces of it from UV coordinates, it would probably run better.
Unless Stefan already does this. I'm not sure if he does or not, but it's one of the only reasons why I can think that iPhone Graal runs so poorly. |
Quote:
Maybe this should now be a Future Improvement request? I'm still looking for someone to shoot me down with "You're completely wrong, timeouts are essentially this 'register a hook with the game loop'". |
Someone (Tig?) told me scheduleEvent was "optimized" for iPhone and is more efficient than using a timeout in the same manner (for an infinite loop) but I have no idea if that's true or not.
You could always do your own tests, but I imagine the difference is miniscule. |
Quote:
Anyways, thanks for all your input guys. It has been useful. |
I did a bit of testing on an iPhone 4.
I commented out, in turn, either the trigger for timeOut or the trigger for scheduleEventTest. PHP Code:
scheduleEvent: Quote:
Quote:
|
Quote:
So basically there is no nice way of doing it. Well, at least I'm fully aware of the constraints on that part. |
on Era iPhone I've designed a system which triggers alot of actions- (function onHealthChanged, onItemChange etc); to optimize effects, use particles.
|
All times are GMT +2. The time now is 09:06 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.