RTS 'complex' commands & input caching questions


Hi All,

My goal is to send RTS ‘complex’ commands such as SpawnUnit, MoveUnit, AttackUnit etc over the network when required. I’ve searched and seen other discussions on this topic but I have further questions still. I see that there is a way to set byte data for inputs that I could use to contain this command data. However, looking at the TrueSync Input API I’m confused about what will go on behind the scenes.

1) Does Truesync cache data for TrueSyncInput keys? If I set key 0 to some bytedata and then don’t set it again will it only transfer Input for key 0 one time? If it sends it all the time and the value is not changing that’s obviously not ideal, depending on the data size.

2) Is there a way to ask the TrueSyncInput API if an input of a certain key has been modified? I imagine I would want to check this in the OnSyncedUpdate function. If TrueSync does cache values but doesn’t tell you if they’ve been modified I may have to add further keys to say if values were modified or not rather than deserialising complex commands every frame.

3) Is there currently or are there any plans to have a Push/Pop input API rather than a Set/Get? This would probably be more intuitive to my RTS command style usecase.

Thanks

Comments

  • OK, I should have done some testing before asking as no caching of data is done (at the API level at least), which is great.

    If I don't set a keys byte data on the next frame it just returns null in OnSyncedUpdate when I try to access it. That's good.

    I think my questions can be closed. It seems straightforward how to proceed to make an RTS input command pattern at this point.

    It was just confusing looking at the tutorials which seem to set data for keys even if they are not pressed.