See the Upgrade guide page for step 1, before following this page.
Many of the packages containing Worker SDK in C binaries have been slightly renamed to be more simple and concise.
Therefore, the package names will need to be updated where packages are downloaded, either in
spatialos_worker_packages.json in your worker directory (if using SPL), or in your own build system using
spatial package get (if using FPL).
Updated package names can be found here but in summary, the following
changes should be applied from SpatialOS 13:
a. For Windows packages, replace
b. For macOS, iOS and Android packages, replace
c. For Linux packages, replace
We have also made three changes to simplify the structure of the binary packages:
- Static packages (packages beginning with
c-static) no longer contain a
libfolder. Instead, the libraries are just contained in the root of the package.
- We've removed header files. Instead, you should obtain the header files from the separate
c_headerspackage. If using the SPL, you can use this as a guide to download the header files correctly.
- We've renamed the
improbable_workerto avoid ambiguity. For example, on Windows, we now ship
We have simplified the usage of
Worker_CommandResponse slightly. Now, the equivalent
Schema_Create functions no longer require a component ID or command index to be specified.
The information is now only specified in the
Worker_ objects. Note that a
command_index has been added to
Worker_CommandResponse, and this field needs to be set instead of passing the command index to
For example, sending a command request has changed from this:
Worker_CommandRequest request; update.component_id = 1234; update.schema_type = Schema_CreateCommandRequest(1234, 1); // serialize into update.schema_type. Worker_Connection_SendCommandRequest(connection, entity_id, &request, 1, NULL, NULL);
Worker_CommandRequest request; update.component_id = 1234; update.command_index = 1; update.schema_type = Schema_CreateCommandRequest(); // serialize into update.schema_type. Worker_Connection_SendCommandRequest(connection, entity_id, &request, NULL, NULL);
Schema_GetCommand*CommandIndex functions have been removed. Therefore, when receiving and processing an operation that contains a
Schema_ object, you should instead obtain the component ID and/or command index from the enclosing
Worker_ object. For example, receiving a command request (when serializing directly) has changed from this:
Worker_CommandRequest* command_request = &ops[i].command_request.request; Schema_CommandRequest* data = command_request->schema_type; Worker_ComponentId component_id = Schema_GetCommandRequestComponentId(data); Schema_FieldId command_index = Schema_GetCommandRequestCommandIndex(data); DeserializeData(component_id, command_index, data);
Worker_CommandRequest* command_request = &ops[i].op.command_request.request; Schema_CommandRequest* data = command_request->schema_type; Worker_ComponentId component_id = command_request->component_id; Schema_FieldId command_index = command_request->command_index; DeserializeData(component_id, command_index, data);
To make the C header files fully compliant with C90, we needed to remove usages of anonymous unions. This means that accesses to op data within a
Worker_Op object need to be accessed through a nested union called
op, and accesses to constraint types within a
Worker_Constraint object need to be accessed through a nested union called
For example, for
/* before */ Worker_Op* op = /* ... */; Worker_ComponentUpdate* update = &op->component_update.update; /* after */ Worker_Op* op = /* ... */; Worker_ComponentUpdate* update = &op->op.component_update.update;
/* before */ Worker_Constraint* constraint = /* ... */; constraint->entity_id_constraint.entity_id = 1234; /* after */ Worker_Constraint* constraint = /* ... */; constraint->constraint.entity_id_constraint.entity_id = 1234;
Updated about a year ago
Now return to the Upgrade guide and follow step 3.