Antriel

Members
  • Content Count

    224
  • Joined

  • Last visited

  • Days Won

    1

Antriel last won the day on June 5 2019

Antriel had the most liked content!

About Antriel

  • Rank
    Advanced Member

Contact Methods

  • Website URL
    https://antriel.com
  • Twitter
    PeterAchberger

Profile Information

  • Gender
    Male
  • Location
    Slovakia/Czechia

Recent Profile Visitors

3647 profile views
  1. Antriel

    Game loop advice

    With a brief look, I don't see anything wrong with the implementation. I would say it all comes down to `ctx.imageSmoothingEnabled = false`, which will cause the pixel positions to be rounded (which is desired for pixel-perfect pixelart game). At 60 FPS you sometimes get a pixel movement, sometimes don't, and not moving is essentially a frame skip, which at 60 FPS is visible. At 144 FPS, not so much (i.e. the timing is much smaller, so it's closer to reality). You can test that by playing around with speed setting, making it work well in 1/60 intervals. Although looking at your code, speed of 20 should work well (1 pixel every 3 frames). Try logging rounded position delta every frame and see if there's jitter or not. Repeating 0-0-1 should look good. Something like 0-0-1-0-1-0-0-2 will not. @Milton No, it's correct. It's simply an implementation of fixed timestep with rendering interpolation. When `dt` comes back smaller than `STEP`, rendering interpolation still makes the movement necessary. Thus allowing for a game with low logic rate (e.g. heavy physics running at 30 Hz) still render nicely on modern desktop with whatever refresh rate the display/gpu manages (~144 Hz, but anything really). Using `dt` directly would make anything with higher differential order non-deterministic and unstable (e.g. applying acceleration).
  2. Best I can tell, it's purely offline game. There's a lot of games that fool the player into thinking it's real multiplayer when it's not.
  3. This is a copy of the first devlog I published on my blog a few months ago. You can see all the devlogs and sign up for the newsletter to get the next ones directly to your email at https://antriel.com/rpg/. Devlog 1 Few days ago I have decided to start an RPG project, as that’s what I’ve always wanted to make. I will be fairly limited with graphic assets and time, but at least the coding part will be fun. I will make do with what I have available. Right now I have depth sorting implemented: I’m using art assets. Tiled for level editor. Haxe as programming language. Phaser 3 as framework. Coffee as fuel. So far I’ve went through map loading (surprisingly simple in Phaser 3), animations based on keyboard input and basic collisions using Phaser’s Arcade. Then I switched to using Differ for collisions, because Phaser’s Arcade physics couldn’t handle custom shapes per tile by default. Given that I expect more requirements from the collisions/physics system, I like having more control over things instead of letting Phaser handle it all for me. After that, it was time to refactor all the code, because it was getting messy. I choosed to use ECS architecture, because I used it before and I find it very nice for these kind of games. Especially considering how big the game might grow, it’s important to keep the code clean. I was deciding between using Elias Ku’s ECX library and Kevin Leung’s ECS. Ultimately it probably doesn’t matter, but I chose Kevin’s. At this point the ECS consists of RenderSyncer, KeyboardInput, Movement, PhysicsDebugDraw, PhysicsSystem systems, and Velocity, ActorState, DifferShape, InputControllable, Position, Renderable, StaticCollidable components. This will change a lot as the work continues. Next I made a custom preprocessor for Tiled level files. I’m converting them to custom JSON that contains only the data I need, in format the game expects. This also allows for making rudimentary checks against typos and missing data. It also means I’m no longer using Phaser’s tilemap loader, and instead had to write a bit of code to populate the tilemaps myself. While this is some extra work, it allows for special handling. Last thing I did was implement depth sorting. Phaser can’t render different tiles at different depth, or allow you to insert something (like a moving character) in between tiles. If you look at the GIF on top, you see the character can move behind and in front of the tree log and the sign board. If they were part of a Phaser’s tilemap layer, it wouldn’t work. Instead, I mark the layer in Tiled as requiring depth sorting, and the game then creates individual depth sorted sprites. This way I didn’t have to change the level editing workflow and won’t need to manually handle future similar cases. Next I plan to work on some UI, changing location (loading different maps, like insides of a building), NPCs and interaction, and combat system. Subscribe to newsletter.
  4. Now it's `this.scale.resize`. The whole scale manager basically does all of this for you. Not entirely what I do though, but you can choose between scale and resizing.
  5. I have no idea how they did it, but technically it shouldn't be too difficult to get it working with the original html5. Switch does have a browser, it wouldn't be far-fetched if it supported webgl. And if not, bundling it with V8/chakra and doing some thin wrapper over opengl should also work, although that would probably require some tinkering.
  6. Think about the order of the items in the container. EDIT: And I just see it was pointless to waste time here, as you already had it solved on the Phaser forum...
  7. Could be the automatic depth sorting, implemented by heap sort iirc. Not entirely sure it's faster than insertion sort (at least at smaller counts I would expect insertion to be faster, but there it probably doesn't matter), but in either case, whenever anything is added to scene, it's pushed to the end and the child array is marked to be sorted. Then again, every other engine has to do something like that at some point too.
  8. Synthetic benches aren't very useful when it comes to big numbers. It all comes down to how the pipeline is setup, which is usually based on real-world uses and not optimizing for benchmarks.
  9. That is a bit weird. It shouldn't be happening often, maybe at most 1% of messages unless you are on very bad network. This leads me to think that the server has Nagle's algorithm enabled (TCP_NODELAY – buffering of data until there's enough to send out, it is usually enabled by default and the higher latency could make it more aggressive.). Try looking into that.
  10. Server sends message A then B. Message A gets lost along the way, client receives message B, but given how TCP works, it won't be accessible yet (head of line blocking). TCP handles resends and server sends message A again. Client receives it and supplies A and B one after another to your application. That's one very realistic option (longer the path, higher the chance for packet drops). But it can be anything that causes one message to arrive sooner or later compared to other message. Routes can change, packets can get delayed. In general, you can't depend on the rate to be perfect.
  11. They get rendered, although there is a way to cull them if you want (not always faster though, as it needs to figure out which are in bounds, but you can always make your own culling that would be faster if possible). No idea about fillrate of off-screen stuff. They do get send to GPU for rendering, but the actual fragments won't get rendered if they are outside, so I would reckon it won't affect fillrate. But I'm just guessing.
  12. Antriel

    OkijinGames Visual Fx

    Might be best to ask the man himself, pinging @OkijinGames. He did write this about it though: