Guys, i have some problem with objects in array
ue lost them between functions events…
hope somebody help me with that(
Guys, i have some problem with objects in array
ue lost them between functions events…
You shouldn’t be sending the object directly to your save game or bouncing them from server to client.
Use a simplified struct to represent the inventory item contents and send that. It’s also easier to serialize for the savegame.
you mean item object before sending convert to structure and save, and when i want to get them from save file(DB maybe after) a need construct them again from structure?
The moment the item is picked up it should be converted to a struct and actor destroy. This struct representation is what should be on the server inventory slot. During the save procedure you need to gather an array of these structs and send them to the save procedure.
You also need a function to rebuild the actor from the struct once you want to place it back into the world upon dropping the item.
The struct is basically what you would call a POCO representation of the actor. The struct will also reduce the strain on the network as fewer parameters are sent to describe the object.
object now is constructing in Pickup Item from structure in DT(or DA leter)
and after i working with this object transfer from inventory to inventory (it was builded inventory system already with equipment and other stuff, but without multiplayer)
and there was everywhere item objects
and now i want to rebuild it from 0 t omultiplayer version and as you see have some issues(
i choose objects becouse i have different types of items( and every type have own structure( and in inventory array couldn’t add different structures(
You can have a base struct with common attributes (things that all items have) and then an array of more elaborate struct descriptors if needed.
that was my problem(
even if i resolve problem with different sub structures i couldn’t make in item inside item list(backpack or some container) thats why i try to use objects
i have few idias how to build it with structures but it’s to complicated system(