WAReborn / WorldsAdriftReborn

63 stars 15 forks source link

Create LocalPlayer Serverside #15

Closed sp00ktober closed 1 year ago

sp00ktober commented 1 year ago

The LocalPlayer holds a bunch of MonoBehaviours to enable interactions, render stuff (like the character, ui elements and more). So far this object is initialized locally from mod code for testing purposes, but it should be done upon instructions from the server (that means our SpatialOS replacement).

sp00ktober commented 1 year ago

Player now gets spawned by the server but is in its "borken" or "template" state and needs to get initialised first. ebc8f4800737ddab45ac448b1a1ef6425b62205b

sp00ktober commented 1 year ago

Now that we know how to add components to game objects from the server side we are able to create a nearly complete LocalPlayer.

For now we partially do things "by hand" until we have a proper solution for struct representation on the server side and a protobuf implementation that works.

The process is rughly this:

The first two steps are done by hand and we send a predefined byte array for now.

To call the Deserialize() method we need to store the vtable array the game offers when the initial SpatialOS connection is made.

sp00ktober commented 1 year ago

Code for spawning the player and island as well as the code to add components to them needs to partially move to #24

sp00ktober commented 1 year ago

This is now all done on the basic game server that we have, implemented in b19199ecbd9d01ee40df355a40681000573e3aee The player still seems to miss some stuff and always spawns nearly naked, but can walk and grapple around normally and the above procedure is now handled by the server.