Serialize std::vector

#1
Hi. I am wondering if there is a way, and if there is, then how to achieve that? It does not matter if it's rmi or aspect. I do it with aspects.
I have declared vector:

Code: Select all

std::vector<string> vector1;
and I am trying to send it from server to client in NetSerialize (like usual variable)

Code: Select all

ser.Value("vector1", vector1);
The code crashes at this point in ISerialize.h. Is there a way to do it properly?
Cryengine tutorial videos on my Youtube channel! Check it out !
https://www.youtube.com/user/MusicForLifePL20

Re: Serialize std::vector

#4
i search ser.value in source code.
i find ser.Value(“Pos”,ref.m_vPos)

and SerializeBits.h

SSerializeVec4H template.

void CEntity::Serialize(TSerialize ser, int nFlags)

SerializationTypes.h
Thanks for this. This worked exactly as expected.
Last edited by Omaima56 on Tue Jul 30, 2019 4:58 am, edited 1 time in total.

Re: Serialize std::vector

#5
CE only supports serialization for select standard types, as seen in SerializationTypes.h

CE for aspects does not support serialization of variable-size/length arrays/vectors/maps/etc.
You can loop over each entry in the vector and serialize them, provided it's the same size every time (for aspect)
e.g. a fixed-size vector filled with dummy values.
Only the values that change get sent over network anyways, thanks to deltas/etc.
(Although I've yet to figure out how their delta process works)

For RMI's sizing doesn't matter. Send whatever you want as long as it becomes one of those basic types.

Who is online

Users browsing this forum: No registered users and 2 guests