Not logged inOpenClonk Forum
Up Topic Question: Goal updates

This board is threaded (i.e. has a tree structure). Please use the Reply button of the specific post you are referring to, not just any random button. If you want to reply to the topic in general, use the Post button near the top and bottom of the page.

Post Reply
In Response to Sven2
You don't need an additional mode for that. You can just offer caching as a helper function:
// Script of expensive-to-check goal
public func IsFulfilled(int for_player)
{
  var max_cache_age = 10; // max age in frames
  return CheckFulfilledCache(this.CheckFulfilled, for_player, max_cache_age); // for_player can be passed as nil here if the cache is not to be kept per player
}

private func CheckFulfilled(int for_player)
{
  // Expensive check function
}


The advantage would be that non-cached IsFulfilled calls don't have to go through the library. Plus the interface doesn't have to be changed.

But as with any optimization: Don't do it if goal checks aren't actually a bottleneck. Check the script profiler first.

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill