Navigation

  • Recent
  • Tags
  • Users
  • Search
  • Login
Colyseus
  • Login
  • Search
  • Recent
  • Tags
  • Users

Documentation GitHub

We're migrating to GitHub Discussions. This forum does not accept new registrations since April 6, 2023.
  1. Home
  2. holyxiaoxin
H

holyxiaoxin

@holyxiaoxin

Chat Follow Unfollow
0
Reputation
1
Posts
1.0k
Profile views
0
Followers
0
Following
Joined 14 Oct 2018, 04:15 Last Online 14 Oct 2018, 10:14

  • Profile
  • More
    • Continue chat with holyxiaoxin
    • Flag Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups
holyxiaoxin Follow

Posts made by holyxiaoxin

How to force patch, since patching is done on patch interval

I have a patch rate set at 60fps => this.setPatchRate(16.6) on Room. This is working all well until i have a state delta that's less than 16.6.

class Actions {
  constructor(clock) {
    this.data = []
    nonEnumerable(this, 'clock', clock)
  }

  addSpell(type, position, opt = {}) {
    const { duration = 0 } = opt
    const uuid = uuidv1()
    const action = { type: ACTION_SPELL, position, uuid }

    this.data.push(action)
    if (duration >= 0) {
      this.clock.setTimeout(() => {
        const index = this.data.findIndex(a => a.uuid === uuid)
        if (~index) this.data.splice(index, 1)
      }, duration) // duration much more than 16.6 work, but i'd like to use durations like 0.
    }
  }
}

Not sure if it's a specific business logic for my case, or there might be a proper way to do this. Another way to overcome this is to have the client deleting this from the array, after it has read it. Or to store an end time, with both client and server having a synchronised time, and then cleaning it up automatically on the server side well after the end time.

posted in Questions & Help • 14 Oct 2018, 04:24

© 2023 Endel Dreyer