TCLProject / ArsMagica2-5

Ars Magica 2.5
15 stars 8 forks source link

[Bug] Game freezes when using Gateways for extreme distances #7

Open DarianLStephens opened 1 year ago

DarianLStephens commented 1 year ago

I don't know how or why. The code looks fine, like it just sets a new position part-way between the destination and source, but for some reason, the server just hangs. The game continues running, but TPS completely stops. The internal server has frozen. Attempting to quit to the main menu just ends up crashing the game after a few seconds.

This is me assuming the gateway doesn't have the power for the full transport, since it's over 100k blocks away. Speaking of, would it be possible to allow us to configure the power drain, and max distance, or general equation, for teleporting with the gateway? I'd like to make them more viable for extreme distances, but still have the danger.

DarianLStephens commented 1 year ago

Maybe it's due to the way it's being calculated, with complex mathematical operations working on a huge number? I wonder why it doesn't just lerp between the vectors, considering it doesn't add any deviation to the angle or anything?

DarianLStephens commented 1 year ago

Oh, it's doing some loop to find an air block. Maybe it's not finding one? Why not just use the top block map? I guess so you can end up in caves?

I wonder... if the chunk doesn't load fast enough, could the loop get above the world, and then never find an air block because it's higher than world height where blocks don't exist?

TCLProject commented 1 year ago

That shouldn't happen because the portals should always be chunkloaded. Does this only happen with the "hazardous gateways" option enabled, or does it happen regardless with large distances?

TCLProject commented 1 year ago

I have added a 100 block limit to the Y loop, to prevent it from looping indefinitely. Try it and see if it helps. If it doesn't, I still need the answer to the question above

TCLProject commented 1 year ago

Closing issue as there has been no reply for 2 months.

DarianLStephens commented 1 year ago

I haven't had any way to test it, there's been no new release or anything.

TCLProject commented 1 year ago

Oh, sorry, my bad. Here's an experimental latest build you can test: https://www.mediafire.com/file/rgugonbm7z70kb6/AM2-1.5.0-hotfix1.jar/file Additionally, please answer the previous question:

Does this only happen with the "hazardous gateways" option enabled, or does it happen regardless with large distances?

DarianLStephens commented 1 year ago

Okay, I finally got around to testing this, and it looks like that may be issue solved! Well, sort of.

The server no longer hangs indefinitely, but partial teleportations are now ending with the player ending up some 300 blocks in the air. Which makes sense here, because you're terminating the loop after 100 blocks, and this particular test is being done at ~Y200. So my guess is the chunk isn't loading fast enough, or at all, when you're trying to check for it being an air block. Is there anything you can do about that? Appearing 100 blocks above your starting Y isn't an ideal solution, though it is certainly better than a full server hang.

TCLProject commented 9 months ago

I will not answer any of your further questions until you answer the question I asked you twice. This is petty behavior (sorry!) on my part but I feel this is the only way I can get you to answer it.

DarianLStephens commented 9 months ago

The 'hazardous gateways' question? Does that mean I'd need to go back to a version before this fix was implemented?

DarianLStephens commented 9 months ago

One reason I've been avoiding it is because I don't want to have to wait for the batteries to fill up. Is there a creative infinite etherium source I've missed?

AirBurn0 commented 9 months ago

One reason I've been avoiding it is because I don't want to have to wait for the batteries to fill up. Is there a creative infinite etherium source I've missed?

image Yup, it is. You can also break the half-filled one and clone it, then put into world and merge. My addon also has a spell for such situations, Mana Conduction (with some buff-power modifiers). In earlier versions, you can try dupe it using appropriation spell.