Sign in to follow this  
sordid

Sending script-based data between C & S

Recommended Posts

I'll try to explain this the best I can.. I'm wrestling with trying to figure out how to effectively send data between client and server, when that data is contained within script (Lua, in this case). As an example, I have an Entity object within C++ that is the chief object thrown to the spatial partioner, and holds basic information such as position, rotation, related matrices, and mesh data. *All* actual actor logic is contained within scripts that, for all intensive purposes, "extend" this C++ base class. I accomplish this with just associating a table containing the extended object with the base C++ object. At any rate, this Lua table contains extra data that is not known to the C++ object. Some of this data needs to be sent to the client, or vice versa. The only method I can think of is to have a table within the lua extension of the entity that contains the data to send to the client. This table must then be serialized and then sent. When it's received by the client, the data is reconstructed into a Lua table and given to the lua entity's OnUpdateFromServer() function (just as an example). Essentially, the same process would be involved with filling a UI control with server-defined data (think EVE-Online with its UI). I was looking through the Far Cry SDK since it's the only other source (as partial as it is) that has all logic done within a script, and just so happened to be the same language. However, I cannot find anything in there regarding entity data transfer to a client, which must be for reasons of security and the open source nature of the SDK. However, any pointers on how I would go about accomplishing this transfer of Lua-specific data between client and server would be greatly appreciated.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this