Problem with respawning player

0 favourites
  • 9 posts
From the Asset Store
Players follower. use it for anything which follows the player
  • Hey dear constructers!,

    i'm working on an topdown tank shooter/mining game.

    now, when a player dies, i want to just have the tank stopped, create a crater and wreck, and display a respawn button which, once clicked starts the respawn countdown. after the countdown reaches zero the player is respawned at his base.

    what happens:

    when i have no timer it all goes fine, BUT!, it seems that the player isn't actually destroyed but just moved across the map (which results in him being stuck if there's a mountain on the way) except from that all is fine. the player and all of its parts are destroyed instantly on server an clients the crater and wrecks are built instantly as well.

    as soon as i have the respawn button in it (or a wait x seconds action), the player doesnt disappear instantly. merely it's car behaviour, rolls him out of the crater and is still steerable. it then takes about 1.5 seconds for the servers destroy signal to take action. after that the respawn button appears, the player disappears and spawning works fine. the wreck though is built just at the time the player respawns and not the moment he dies or the moment his visuals disappear.

    oh yeah, on the server everythings fine! this just happens on the client!

    does anyone know about such issues? are objects somehow kept alive for a short time to save the engine from unnecessary destroy/spawn actions?

    what can be done about it?

    for the moment i don't have a simple capx to post, but i no one has a fast idea on what might be going on i might be forced to replicate it, or at least cut some screenshots of the actions together.

    thank you all for taking the time,

    Matt

  • Well, the one piece of advice I could offer without seeing the code would be trying an immediate "Set Car Behavior Disabled" Action on 'destruct'

  • now all i can say is... am i really that blind that i didnt see the "disable"? cause i was looking for it. because it made sense.

    still... if set car max speed to 0 and stop car didnt work i dont have much hope for disable...

    but i will try .

    thank you!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • well as i feared, it happened. it works half the way 5 out of 20 times.

    but even then the tank is almost out of the crater and it still takes the same time for the respawn button to appear, the tank to disappear and the wreck is still just created as the player respawns.

    the only beneft so far is knowing that disable car actually exists and that the tank sometimes at least stops.

    but i figure i've gotta go for some screenshots or a replica(which is gonna be very hard because there are soo many objects synced and depending on each other already.)

  • Honestly, what's stopping you from attaching the full .capx?

  • just from what i've seen on the forum so far when looking up something, i never saw someone putting such a huge capx up.

    and i'm not understanding how you would see my content anyhow qith no images.

    but maybe i'm just getting something wrong on how to upload it anyway...?

    would i have to put my project somewhere? you know like dropbox or something? i think of all the content in it. just a capx doesnt contain any sprites right?

    I was stripping my project down over the last two hours kickin everything out that was not related to my problem.

    Now at least i figured out the problem with the wrecks not appearing.

    it had to do with the scaling of the created wrecks.

    you see the working solution in the attachment.

    before that i directly scaled the wrecks. and then every tick set the scaling again to Self.S which was of course "0" so the wrecks became invisible.

    stupid error.

    gonna try to figure out the problem with the tank not destroying properly now.

    you see the code for that as well on the attachment.

    any ideas still welcome!

    and thanks so far because you got me to strip down the project, which helped me solve the first problem .

  • Including a .capx brings along everything but fonts: images, sound, etc.

    And you would just include the .capx as an attachment. (as I have in this post)

  • oh! well thank you it's good to know that! even though i wonder what the subfolders in project folder are for if the images are stored in the capx?

    i finally figured out the problem. seems to be not my fault but merely a bug in construct or a necessity i dont understand.

    the delay on destroying objects on the client is depending on the "associate with multiplayer.peerid".

    -if you do that (which you have to if you go for multiplayer), you get that delay which sucks hell.

    -if you don't there's no delay but also no multiplayer.

    i'd really like to hear a statement from ashley or someone also that knows whats going on.

    check out the capx in the attachment and try enabling/disabling the associate actions on event sheet1.

    tnx for the help and little hints anyway unnatural!

    edit!: i forgot! use the UP arrow to accelerate the smoke then switch to the host window (2 browsers needed!) and press K the destroy it.

    you will see that on the client window the smoke lives much longer

    edit2!: just found out that what makes it delaying is the association on the player object on the host side.

    the other 3 object associations dont matter.

  • hello anyone?

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