SpongePowered / SpongeAPI

A Minecraft plugin API
http://www.spongepowered.org/
MIT License
1.14k stars 342 forks source link

Decouple connections from player entities? #1183

Closed ryantheleach closed 8 years ago

ryantheleach commented 8 years ago

I have no idea how hard this would be, but one idea I've always wanted to see, was the ability to transplant connections to one player to another.

Possibilities I see this unlocking are:

  1. Mod Mode. players acting as staff appear as completely different subjects then when the players are playing as users. their previous position is saved / restored when they swap.
  2. MMO like characters / toons. You could swap your RPG character and the permissions / skill tree's would swap, even if they relate to your UUID.
  3. Combat Logging protection. After a connection ends, don't despawn the player immediately, allow them to continue to take damage and even die. If the player reconnects, use the existing entity. Would make for a smoother transition then spawn a replacement NPC in their place.

Worth pursuing?

MichaelFedora commented 8 years ago

That would be pretty cool. I don't know the complexity, but it would basically be reducing Player down to a "Controller" and then "putting" that controller on different entities/humanoids... say even different mob types? TileEntities?

I think it's possible, at least; maybe even with the current API, but I'm not sure.

JBYoshi commented 8 years ago

Might have some incompatibilities with mods. But great idea overall - might be pretty cool for a disguise plugin!

Zidane commented 8 years ago

Cutting out the connection code from EntityPlayerMP would be difficult and due to HOW it is all glued together, you would have to become the biggest liar of them all

...lying about who you are to the other clients that is.

One idea would be to synchronize your entity as a Creeper type to the other clients. The problems you'll encounter are assumptions the client makes (hitboxes/etc) but it is what it is. Another issue is some client code expects you to be an "EntityOtherPlayerMP" and if that isn't the case I'm fairly sure this will blow up in a hurry.

Of course, if you say "Well this will be running on the client" the things change but the code gets harder. Basically the job becomes fixing the above.

I'm fairly sure I could do it as a proof of concept but my TODO list is hilariously tall so I wouldn't be able to AT this time.

ryantheleach commented 8 years ago

I wasn't even thinking necessarily other entity types, just other EntityPlayerMP. Thought that disguising as a Creeper could be done by vanishing the player, and having a creeper with custom AI, and transferring damage across.

JBYoshi commented 8 years ago

@ryantheleach That would probably be a better idea. I could probably do a disguise API based on contextual data once that gets merged.

TheRaspPie commented 8 years ago

@ryantheleach I wanted to do point 3 for a long time. The issue is, that the client handles knockback and so wouldn't move at all and could even stop mid-air. If this becomes real, we have to be able to give a decoupled player entity AI.

Zidane commented 8 years ago

Closing this as its more a thought experiment and not really practical for this API.