Antriel

Members
  • Content Count

    232
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Antriel

  1. It's a way to have refresh rate of something locked to signals from something else. I use it to sync clients time with server network tick.
  2. That stackexchange answer is quite close to phase-locked loop I describe here: https://antriel.com/post/online-platformer-5/.
  3. You can increase the `fps` parameter of Arcade in game config.
  4. See how phaser does it: Checking on init: https://github.com/photonstorm/phaser/blob/476a31093ad5b1d723392720401be83541878b04/src/sound/webaudio/WebAudioSoundManager.js#L76 And subsequent waiting for input to unlock: https://github.com/photonstorm/phaser/blob/476a31093ad5b1d723392720401be83541878b04/src/sound/webaudio/WebAudioSoundManager.js#L143
  5. https://developers.google.com/web/updates/2017/09/autoplay-policy-changes Basically you need to start/unlock the audio on user input first, then it works at any time. I handle that by making user start the game via click after the preloader.
  6. 50 Hz is normal. Try doing the setInterval that just logs the time too, with something like 10 ms interval. If that fires around the problematic message, with +-10ms interval, then event loop isn't too busy. Also, is there a visible missing date? Like before there's delta of 0, is there delta of 100? If not then it really feels like the message callback is ran more than it should (which you can determine by the contents of the message).
  7. Then it's either what @mattstyles said, or your event loop is too busy and can't process the message fast enough – that might show in profiling. I would try to simply log `Date.now()` on arrival of messages and maybe also run another timeout with much smaller timestep than what server sends, logging the time too, to visualize whether event loop is free or not.
  8. The packet drops along the way, you can't test for that like that. You could try doing it on a good LAN connection (that you tested) or a localhost loopback, which shouldn't drop packets at all.
  9. Unfortunately, not with TCP. And the only way to do UDP on the web is via WebRTC, which is aimed at media and p2p networking, so achieving client-server architecture there is difficult.
  10. Websockets use TCP under the hood. If a packet drops along the way, TCP will buffer any additional packets until it also receives the one it lost. After it does, it will supply everything it has, which can cause what you see. There is nothing you can do to prevent that apart from using multiple websocket connections and implementing something like udp over tcp.
  11. Yeah. Basically if you needed de/acceleration, you would adjust speed by using the `dt`. Which won't work well unless you use fixed delta time. Which is what the articles I linked talk about.
  12. Phaser smooths out the delta time (see source) so that the gameplay is better. That's what causes the desync with real time. If you need precise timing, you need to run your own clock. Keep in mind internal things like tweens will still use Phaser's clock. If that's an issue, either tween manually or hack Phaser to pass unsmoothed deltaTime. The issue you see on the android device could be cause by JIT/startup causing slower performance at the beginning, which results in big delta time, which Phaser in turns lowers into sensible values. So a second passes, but Phaser only simulated half a second. Also keep in mind that your fix approach won't really work well on devices with different frame rates. It's not always 60 fps. I recommend reading Fix Your Timestep and if you plan on having custom physics read Integration Basics (`x += velocity * dt` is ok, but if `velocity` depends on delta too, better read it).
  13. Given that mine is also changed and changed between today and yesterday, I would assume the issue is purely internal. The values looked pretty legit, so I'm quite certain it's not a hack, just some very dumb programming.
  14. There isn't `current_time` ever used there, it's just used to describe the principle. If you look at it properly you see it also subtracts time from the current time.
  15. No, in a way it's `Date.now()`. Or some number that's relative to that and the server's time. E.g. I simply start counting time when first message arrives and I know what rate to expect, so I know what timestamp the other messages have. Imagine starting a stopwatch when first message comes and timing your whole game based on that.
  16. `current_time` is simply the time that is now. If server sends you `{x: 100, time: 0}` and then `{x: 200, time: 100}`, and your current time is 50, you interpolate x to be 150. Of course it's a bit more complex as you need to keep that time relative to what server is sending out. And interpolate a bit in the past to cover delayed messages. So server sends you e.g. 4 positions, you start showing the first, second... meanwhile you get 5th, 6th... etc.
  17. I explained exactly why this happens in your other topic, with a solution and a link to my blog post where I go deeper into details regarding that issue. If something wasn't clear, maybe ask a question rather than make a new topic.
  18. Instead of `timeElapsed = 0`, it should be `timeElapsed -= updateRate`.
  19. Seems like you are removing 2 items from the buffer while only adding 1 every update tick. When you are lerping 1-2, and 3 comes, you start lerping 2-3, so you should only remove 1. Also this way you will get a bit jittery movement, because if the `lerpPerc > 1`, you are actually discarding the remainder. You would need to roll it off otherwise the position will seemingly go back in time. But to achieve smoothness in that, you need bigger interpolation period than one update tick. Packets can get delayed. You need to keep your time in sync with server and have big enough buffer to accommodate delays. Extrapolating if needed (which can look weird when entities penetrate walls in physics based games) or stop the entity (which can feel jittery), depends on the game. Furthermore, Phaser smooths out deltaTime, so the value is widely different from actual deltaTime. For best results you would need to use the real time in calculating this. And if it's a game with long gameplays, it might be a good idea to keep in mind that timers aren't perfect and your client's clock can go faster/slower than server's clock. See https://antriel.com/post/online-platformer-5/ for my approach.
  20. Spot The Spot Play Link Made using Phaser 3. How good are your reflexes? Show us by spotting the red circle among bunch of others. Be fast. Earn points and use them to upgrade your game.
  21. Tap Tap Plane Play Link Made using Phaser 3. Test your tapping and timing skills in this fun game. Traditional flappy gameplay, tap to stay afloat! Avoid obstacles and get as far as you can. Unlock five different secrets, each funnier than the previous one. Can you unlock them all?
  22. Hi, Apart from game licenses (see below) I'm also interested in paid programming work. I use predominantly Haxe, but I can adapt as needed. These days I use Phaser 3 to make my games. You can contact me here or at contact[at]nextrealmgames.com. All games are fully responsive. I can offer reskins (if art is provided), API implementation, branding and required changes. I'm selling non-exclusive licenses for the following games: Tap Tap Plane Traditional flappy bird remake. Spot The Spot Simple and fast reflex game with infinite upgrades. This first post will be updated with additional games as they become available.
  23. I just googled and used the first thing I found and it worked. https://app-manifest.firebaseapp.com/ Yes, if either is missing, then the package is invalid. The same as: if(!(file.contains("index.html") && file.contains("manifest.json"))) throw "Bad zip file";
  24. http://labs.phaser.io/edit.html?src=src\game objects\bitmaptext\static\bitmaptext-atlas.js