blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 25 Jul 2013 08:07 PM |
| What is the easiest way to replicate raw data to the client from the server and back? |
|
|
| Report Abuse |
|
|
bohdan77
|
  |
| Joined: 10 Aug 2008 |
| Total Posts: 7944 |
|
|
| 25 Jul 2013 08:11 PM |
| I'd give you a answer, But someone else would give you a better answer. |
|
|
| Report Abuse |
|
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 25 Jul 2013 08:15 PM |
| Maybe I should just fill models up with value objects |
|
|
| Report Abuse |
|
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 25 Jul 2013 08:19 PM |
But string value objects values terminate with null character so i cant do it
i feel so restricted, its making me depressed |
|
|
| Report Abuse |
|
|
|
| 25 Jul 2013 08:23 PM |
| Use Anaminus' Cure's networking module for hassleless network replication stuff. |
|
|
| Report Abuse |
|
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 25 Jul 2013 08:26 PM |
| But it doesn't seem like it can do tables :( |
|
|
| Report Abuse |
|
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 25 Jul 2013 08:29 PM |
| Any type of value I come across, except probably userdata |
|
|
| Report Abuse |
|
|
|
| 25 Jul 2013 08:31 PM |
> But it doesn't seem like it can do tables :(
That's incorrect. It can do arrays and arrays that contain other arrays:
> ### dataValue > > May be any value for which a Value object exists (i.e. IntValue). > > It may also be an array containing dataValues, including more arrays. |
|
|
| Report Abuse |
|
|
|
| 25 Jul 2013 08:32 PM |
| It is completely impossible to replicate userdata, functions and threads. Everything else can be replicated. |
|
|
| Report Abuse |
|
|
noliCAIKS
|
  |
| Joined: 08 Mar 2010 |
| Total Posts: 917 |
|
|
| 26 Jul 2013 05:35 AM |
@ColorfulBody That's incorrect. You can write a Lua Virtual Machine in Lua and send functions over using string.dump. You can also detect the type of most userdatas Roblox uses and serialize them (for example CFrames and Vector3s). You can also use the appropriate value type Roblox offers for userdatas, such as ObjectValues and BrickColorValues. My networking script actually works the following way: it uses a StringValue with an ID defining the recipient and the number of arguments in the name and a piece of Lua code as the value. The types of the arguments passed are detected using a combination of `type(value)' and a couple of protected calls that check for properties in userdata values. Values of the appropriate type are inserted in the original StringValue and these are put in a table by a script on the recipient's side. Then the function generated by loadstring is safely called with a yielding protected call (ypcall) and the table is unpacked and passed as arguments to the function. An example of how to use this would be: `Network.Transmit(Network.GetIdFromPlayer(player), [[Instance.new("Part", Workspace.CurrentCamera).CFrame = (...)]], cframe)' |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 26 Jul 2013 05:36 AM |
serializing cframes
cframe:components()
or whatever the method name is
vector3 needs a method like that too... |
|
|
| Report Abuse |
|
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
|
| 26 Jul 2013 10:01 AM |
@Oysi
I mean something like
local cfcomponents = {CFrame:Components()}
local v3components = {Vector3:Components()}
where the Vector3 method would get the X, Y and Z. |
|
|
| Report Abuse |
|
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
|
| 26 Jul 2013 10:04 AM |
oh, sorry.
I thought you meant something different.
But:
local v3components = {Vector3:Components()}
is easier to type imo than
local v3components = {Vector3.X, Vector3.Y, Vector3.Z} |
|
|
| Report Abuse |
|
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
|
| 26 Jul 2013 03:57 PM |
> That's incorrect. You can write a Lua Virtual Machine in Lua and send functions over using string.dump.
I knew someone would bring up this objection. I just knew it would happen. I thought they might have removed string.dump, but I don't think they did (they probably didn't). I know it's possible to do this, but this would just be... excessive. I mean, if you *really* want to replicate functions and if your life depends on it, then sure, but in all other cases, this would just be an excess.
> You can also detect the type of most userdatas Roblox uses and serialize them (for example CFrames and Vector3s). You can also use the appropriate value type Roblox offers for userdatas, such as ObjectValues and BrickColorValues.
Yes, but you cannot replicate all userdata, which was my point. Of course it's possible to serialize and then de-serialize some of them. |
|
|
| Report Abuse |
|
|
noliCAIKS
|
  |
| Joined: 08 Mar 2010 |
| Total Posts: 917 |
|
|
| 26 Jul 2013 04:03 PM |
I just mentioned it because you said it was *completely* impossible. That only goes for threads, although it might be possible to create a special thread class with future scripting abilities. Besides that, I completely agree with you. |
|
|
| Report Abuse |
|
|
|
| 26 Jul 2013 04:39 PM |
@noliCAIKs
It *is* completely impossible. For userdata, it is only possible with some specific ROBLOX userdata, meaning it is completely impossible to be able to replicate any userdata and for functions, it is impossible to replicate the actual function value: one can only create a wrapper function that runs the code loaded by a bytecode loader in Lua. Furthermore, even if this is considered as a complete replication, it is still impossible to replicate some functions, if only because some of them may have threads in their environment, and since these threads cannot be replicated. |
|
|
| Report Abuse |
|
|
noliCAIKS
|
  |
| Joined: 08 Mar 2010 |
| Total Posts: 917 |
|
|
| 26 Jul 2013 04:47 PM |
And you can't dump C(++) functions either. However, what you say depends on how you interpret "complete". I interpret it to mean that there is no way to replicate any of the data at all. You seem to mean that it is completely impossible to replicate *some* of the data. |
|
|
| Report Abuse |
|
|