-
-
Notifications
You must be signed in to change notification settings - Fork 28
Extending the API
This is directed at changes included in Spearmint, not compatibility with engine forks that can the APIs.
VM to engine calls.
After VM APIs reach major version 1, new syscalls will be able to be added without breaking compatibility. By increasing minor version when added, older engine will be aware of compatibility issue.
Currently VMs using newer API than engine supports will not be loaded. FIXME: Let VM support multiple minor versions?
It will be possible to add additional arguments at end of list without breaking compatibility. Using the API version the engine will know whether argument exists, if not can use a default value for the argument.
Using the newer API version will require passing the additional arguments. The VM choosing what the max API version is, so when updating [cg|g]_public.h / tr_types.h, [cg|g]_syscalls.[ch] will have to be updated too.
There will probably be done using a macro like VM_MINVER( minimum-major-version, minimum-minor-version, data, default ), VM_ARG( 1, 2, args[5], 0 )
. FIXME: Add support for this.
Engine to VM calls.
FIXME: How does engine know if VM supports a call? More version magic?
The engine cannot extend it's sharedEntityState_t and sharedPlayerState_t which could be a problem in the future. FIXME: tell engine what size they are so it knows if supports 'new' fields?
VMs are able to extend entityState_t and playerState_t as it wants.
entityState_t is currently required to network all fields (except number
field which engine fills in). This could be a problem in the future. It interferes with CGame's ability to support old demos. FIXME: Check number in cgame/game instead of engine.
The following structure can have new fields added to the end without breaking the API.
- uiClientState_t
- gameState_t
- glconfig_t
- vmSnapshot_t
- refdef_t
- refEntity_t
- fontInfo_t
The following were decided not worth extending, and cannot be without adding new syscalls.
- polyVert_t
- polyBuffer_t