[TOWER DEFENDERS] Feedback On Teleport System

Hey devs! Owner & creator of Tower Defenders. :grin:

I am currently having some issues with my current system of teleporting players from a lobby place to the arena place (within the same universe).

The process works like this;

  1. Players fill up a party, the process is now initiated and party will be teleported after a 5s intermission

  2. Intermission over, lobby server tries up to 5 times to open up a reserved server every 1s interval (I read somewhere that reserving a server can fail)

  3. Using Messaging Service I premeditatively subscribe to the server initialization topic that is unique to the reserved server code (this subscription is disconnected if initialization fails or after it succeeds) This process can be annoying if it stalls too long for the subscription to be made

  4. Lobby server then tries to teleport the party up to 5 times over 15s using TeleportToPrivateServer, in which the reserved server opens and begins to ping the lobby server until they both connect This process is reportedly an issue, it can take a very long time for players to finally get teleported

  5. Lobby server then tries up to 10 times over 10s to send configuration data to the reserved server (reserved server sometimes takes longer to listen than the first couple pings, but this is expected)

  6. Reserved server pings a last time confirming the initialization completed and all configuration data was received (such as # of players, game-mode, etc, etc)

  7. This interaction is then disconnected on both ends and the cycle starts anew for the next party

This process works near-seamlessly most of the time. And is super secure But then thereā€™s reports of step 3 and/or 4 being painfully slow or unresponsive sometimes.

The Consensus

After careful analysis I can really only place this on an unreliable SubscribeAsync yield or TeleportService being slow and unpredictable. My money is on TeleportService. I have played many games that use TeleportService that can be heavily varying (or faulty) in how long it takes for teleportation to work. From instantaneously to 30s long to completely breaking, Iā€™ve seen it all.

My entire process is strategically wrapped in pcalls and I have webhooks set up so that I would get reports of any errors during this process. But there are none reported. Itā€™s just super slow sometimes.

Most of the time this works really smoothly and I appreciate how secure it is. But as a perfectionist most of the time isnā€™t good enough for me.

Hereā€™s the game if you want to see how it works for yourself.

Asking for help & constructive criticism. :^)
Have a good day! :wave: :slightly_smiling_face:

1 Like

Hi I remember testing your game a long time ago and recently came back to it and played it a lot. (Iā€™ve gotten to like level 49 or something)


Anyways Iā€™ve seen your teleport system fail so many times in ways that other games just didnā€™t.

I think you should avoid looping the ReserverServer as it yields the thread. A loop will have some negative effects on the script. I think you should Reserve the server immediately when the lobby fills up and then over the course of the intermission, you should be testing if the Reserve Server was even reserved.

If something goes wrong then please for the love of Chad give these errors to your players. Your game never really tells us when itā€™s broken and it would be nice instead of just freezing and having us leaving the lobby after x time. Itā€™d be at least better to show that something went wrong rather than me leaving the lobby, joining the lobby again, only to have it repeat the same process all over again. Iā€™d think itā€™d be better to show us there was an internal error so we know the game is broken.

Ranting aside, I think your system feels like youā€™re trying to brute force your way around the errors rather than trusting it enough to stall for more than a few seconds. Try connecting a function to TeleportService.TeleportInitFailed that tries to teleport the player(s) again and if it still canā€™t then relay that to the player(s).


Basically:
Player Joins Lobby > Reserve Server and wait until it's either failed or succeeded > Messaging Service Subscribe > Intermission is over > Teleport Players

Or you should wait for the players to actually join the reserved server and then do the messaging service subscribe and stuff. Iā€™d feel much better knowing that Iā€™m actually in the server and waiting a little bit for it to load all of the configurations rather than sitting in the lobby wondering why Iā€™m even existing.

Also as someone who has put quite the time into your game, I can assuredly tell you that most of the time is very marginal and this seems to be relatively often

2 Likes

I did end up revising the system to where it prepares each lobby with a reserved server before launch. And then subscribes during intermission with disconnects ready should it succeed, fail or the party is dropped.

So far all issues are gone. (All except teleporting is unpredictable on how long takes to tp players).

Thanks for the advice! :^)

1 Like