• Discuss all the things!

    167 Topics
    617 Posts

    Hi @gyutaelee ,

    Based on the current brainCloud's implementation, here are the answers to your questions:

    Q1: Does the Pre-hook count as a separate CloudCode execution / API count?**

    Yes. The Pre-hook counts as both a separate API call and a separate CloudCode script invocation. After running, the server publishes its own analytics event with operation "RUN_HOOK-Pre_VersionGate" that increments both counts.

    Q2: Does bridge.getGlobalProperty() count as an API call?**

    No. bridge.getGlobalProperty() is completely free. It reads directly from the cached Game object in memory and bypasses the API call tracking pipeline entirely.

    Q3: Does the "first 3 free, then 0.5 each" rule apply to hook CloudCode scripts?**

    Yes, the discount applies to internal calls from any script or hook within the session.

    Q4: Pass-through case: usage count breakdown

    Client calls script.RUN: +1 API call Pre-hook executes: +1 API call bridge.getGlobalProperty() inside hook: free Original CloudCode script: +0 (covered by the original script.RUN request)

    Total external API count: 2

    Q5: Blocked case: usage count breakdown

    Client calls script.RUN: +1 API call Pre-hook executes: +1 API call bridge.getGlobalProperty() inside hook: 0 (free) Original script: +0 (does not run, server throws before invoking it when hook returns non-200)

    Total external API count: 2

    The blocked case costs the same as pass-through from an API-count perspective. The only savings is that the original script's internal bridge.callAPI() calls are avoided.

    Q6: Could reading a Global Property on every script.RUN become a performance or cost concern?

    Performance: No. getGlobalProperty() reads from an in-memory cached Game object (ConcurrentHashMap per node) with no DB query or network call.

    Cost: The hook itself adds +1 API count to every script.RUN call that has the hook attached.

    Q7: Recommended caching approach for frequently-read, rarely-changed property?

    The cache is already in place, no additional caching needed. brainCloud stores the Game object (including all global properties) in an in-memory cache for each server node. Cross-node invalidation is handled automatically when a global property is updated in the portal. Using bridge.getGlobalProperty() is already the optimal pattern.

    Q8: Portal metrics: what can be broken down separately?

    API Hook execution count: Partially available. Hooks appear within the CC script invocation counter; no hook-only counter exists. CloudCode script execution count: Available as CC Script Invocations, but includes hooks in the same counter. CloudCode internal API call count: Available as CC API Calls in the Monitoring dashboard. Global Property read count: Not tracked. No metric exists for this.
  • Suggestions for improvements, new features, etc.

    43 Topics
    139 Posts

    @johnh
    I apologize for the late reply. I have reviewed the details you mentioned.
    If the item purchase matches the mockup photo above, it appears to be quite useful.
    'Helmet Equipment Enhancement Ticket'

    Requires a specific item, consumes currency
    These needs can be fully resolved with a single transaction.
    I expect that if this feature is included for paid products as well, their utility will increase in the future.

  • Questions specific to particular APIs, libraries, etc.

    64 Topics
    267 Posts

    Added the additional details to 13660

  • General cloud code discussions...

    35 Topics
    149 Posts

    Q1: The removed player is completely excluded from reward calculation, so if the deletion happens before the job runs, that player is never iterated over and receives no rank or rewards.
    Q2: Yes, the modified score will be used. The job always reads live state. Note that whether the score actually gets modified depends on the leaderboard type (e.g., for the LOW_VALUE type, only updates if the new score is less than the existing)
    Q3: No backfilling, the next joiner goes to the latest instance, not the freed spot in ^2. No loop over earlier instances (^1, ^2) ever happens. The next joiner goes to ^3 (or ^4 if ^3 is full). The freed spot in ^2 stays empty permanently.

  • brainCloud's online learning tutorials and examples.

    3 Topics
    3 Posts

    brainCloud developers have just release several playable builds of our famous examples! See our cool features in action. Find them at https://getbraincloud.com/demos for Windows, Mac, online and mobile.

brainCloud 5 is alive!

brainCloud 5 features Portal-X (our next-gen portal), Integrated Forums (you found them), our new Bootcamp training videos, and more!

Join the discussion here!

brainCloud Bootcamp!
brainCloud's new video learning portal is now online! Go check out brainCloud BootCamp!

Need to report a defect?
Use the chat widget from the Design Portal - or send an email to support at getbraincloud.com. Thanks!