Multiplayer & fast-moving bullets...

0 favourites
  • 7 posts
From the Asset Store
This pack contains 10 types of bullet effects, with different shapes and colors.
  • I hope someone out there might be able to point me in the right direction here....? I am experimenting with the multiplayer plugin (which is excellent, of course) but I have encountered a limitation (of multiplayer with lag and, possibly, a limitation of my c2 dev skills).

    The problem: The host runs all of the bullet collision checks, but the lag experienced by a peer makes host bullet collisions look rather awful (bullets are destroyed before they appear to hit walls) and it can spoil action game-play (bullets appear to hit a peer before the peer sees the hit take place - a peer dodging out of the way can be impossible at high bullet speeds etc). Even with a LAN 60 Hz update rate, the slight lag you can expect has confounded me so far.

    I imagine that a way to solve this problem, for hits on inanimate objects at least, would be to check for a collision in the host and then flag a bullet for destruction at a particular X and Y position, before then destroying it when it gets to within a certain range of that position on the peer's machine (effectively a destroy delay). For hits on moving peers, I imagine that a similar flag would be required (although I am not sure what, if any, lag compensation might be required here).

    I have an aspiration to making an action platformer, but I am not sure that the physics limitations of even a LAN can be accommodated effectively. Before I embark on trying to make this work, I would be grateful for any advice for alternative methods and if anyone has any lessons they would like to share regarding solving this problem.

    Thanks!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • There is no bullet......

  • Here's an example of what it looks like:

    Shooting as the host:

    ...and being shot, as a peer:

  • Thanks newt - I love that raycasting plugin but I don't see how to effectively use it in this case. I think I needed to post the gifs first...

  • First of all don't use the bullets collision.

    Second don't make the hit effect at the collision, do it at the target.

    You get the distance of expected collision from the raycast, and time it that way.

    If a bullet moves at 1 pixel a second, and the object is 10 pixels away you would destroy the bullet after 10 seconds... given it has constant speed.

    Likewise for the object being hit. In fact I would say it's more important to time it's fake collision than it would be for the bullet, since bullets frame skip a lot anyway.

    #timerbehavior

    Also the bullet behavior has a distance method, but I think timing would be better here.

  • Thank you newt - that's some really good advice. Back to the drawing board for me, then, but in a good way...

  • It's not too bad.

    You just have to send the client the time,and the id of the target.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)