Closed Alexejhero closed 1 year ago
When socket is not connected on startup, the player is forced to walk down forever.
When socket is not connected on startup, the player is forced to walk down forever.
That was on purpose to test the movement handler, but it's been removed since.
The python side has not been updated to integrate with the new socket serialization system anyway.
Im curious, if you are going to send partial strings anyways, why not make a data class and then send that as json then decode as json on python side?
Im curious, if you are going to send partial strings anyways, why not make a data class and then send that as json then decode as json on python side?
JSON has a lot of fluff (for example the name of the keys is repeated in every object) so it's very inefficient for socket purposes. Additionally, since we want to be saving this data to a file, we want the file to be as small as possible.
maybe can do something like this on python side, com protocol is currently sending zero data from the client, so might want to fix that first.
from dataclasses import dataclass
from numpy import byte
from bytechomp import Reader
@dataclass
class PositionData:
TotalDistance: float
NextNodePositionX: float
NextNodePositionY: float
@dataclass
class DeadBodyData:
ParentId: byte
LastSeenPositionX: float
LastSeenPositionY: float
FirstSeenTime: float
NearbyPlayersCount: byte
NearbyPlayers: list[byte]
@dataclass
class DoorData:
position: PositionData
IsOpen: bool
@dataclass
class VentData:
position: PositionData
ConnectingVentsCount: byte
ConnectingVents: list[PositionData]
@dataclass
class OtherPlayerData:
id: byte
LastSeenPositionX: float
LastSeenPositionY: float
LastSeenTime: float
TimesSawVent: byte
RoundTimeVisible: float
GameTimeVisible: float
@dataclass
class Frame:
seenBodiesCount: byte
seenBodies: list[DeadBodyData]
DidKill: bool
SabotageUsed: byte
DoorsUsed: byte
DidReport: bool
DidVent: bool
NearbyDoorsCount: byte
NearbyDoors: list[DoorData]
NearbyVentsCount: byte
NearbyVents: list[VentData]
LastSeenCount: byte
LastSeen: list[OtherPlayerData]
def read(stream):
print("Creating frame from byte array")
reader = Reader[Frame]().allocate()
if reader << stream.read(512):
# construct dataclass
my_struct = reader.build()
reader.clear()
return my_struct
This PR will be ready for a re-review once I've added deserialization on the python side
idk probably fine
Vedal let me out please it's cold down here
Changes made in this pull request
PathfindingHandler
a singleton and run it on separate threadVisionHandler
intoOtherPlayersRecorder
andDeadBodiesRecorder
monobehavioursImpostorHandler
intoMapDataRecorder
and other excluded classGameStarted
,MeetingStarted
andMeetingEnded
events so we dont need 100 patches for the same thingInteractionsHandler
❗ Neural network broken, pls fix
Co-authored by @alekso56
Closes #14 Closes #29 Closes #36