diff options
Diffstat (limited to 'docs/love.txt')
-rw-r--r-- | docs/love.txt | 271 |
1 files changed, 0 insertions, 271 deletions
diff --git a/docs/love.txt b/docs/love.txt deleted file mode 100644 index e262ef2..0000000 --- a/docs/love.txt +++ /dev/null | |||
@@ -1,271 +0,0 @@ | |||
1 | Love makes the world go around. Though in this case, it's the name of | ||
2 | the world server, the module that directly controls what happens to the | ||
3 | content of the virtual world. | ||
4 | |||
5 | The love world server that deals with changing the world. It manages | ||
6 | the on disk representation of the world, and lets others screw with it | ||
7 | via nails pumps. Love also sends nails events on changes. | ||
8 | |||
9 | World server vs local world. | ||
10 | ---------------------------- | ||
11 | |||
12 | Extantz defaults to running a local world at start up. Lspace serves | ||
13 | the content for a networked world. They may be the same world if the | ||
14 | local world is also networked. Nails pumps commands to and from the | ||
15 | world. | ||
16 | |||
17 | Lspace just serves the results as a web server. The love world server | ||
18 | changes on disk content, Lspace checks on disk modified time stamps to | ||
19 | deal with "do you have a newer version" HTTP requests. Standard web | ||
20 | server stuff really, though a mod_nails might be useful to catch events | ||
21 | in order to invalidate any internal web caches. | ||
22 | |||
23 | For networked worlds, Extantz fetches new content from Lspace, and hooks | ||
24 | up to the nails pump of the love server for changes. For local worlds, | ||
25 | extantz would basically BE the world server? No, that duplicates | ||
26 | things, it can just run a local love server, then connect to it like | ||
27 | every one else. No need to connect to a local Lspace server, just deal | ||
28 | with the file system direct. | ||
29 | |||
30 | The local love server would be configured to listen on 127.0.0.1, and/or | ||
31 | the outside IP address. Extantz checks to see if there's one running on | ||
32 | 127.0.0.1 first before starting one if needed. | ||
33 | |||
34 | Separate vs combined. | ||
35 | --------------------- | ||
36 | |||
37 | There's two ways of doing this. The world server could be part of | ||
38 | Lspace, or they could be separate modules. What we really have is a web | ||
39 | server, backing store, and command pump. The command pump is nails, and | ||
40 | should be a library that is shared, since both ends of the protocol | ||
41 | would be needed by most modules. | ||
42 | |||
43 | Combined might be useful to conserve resources. They both need to deal | ||
44 | with the contents of the world. Lspace just serves it to the outside | ||
45 | world via HTTP, but needs to track changes. Love makes those changes, | ||
46 | and also sends changes via nails to every one. Keeping the current | ||
47 | working set in memory only once saves a lot of memory. | ||
48 | |||
49 | The down sides of combined is that one might bog down the other, and it | ||
50 | gets harder to use standard web servers. | ||
51 | |||
52 | Separated is good coz Lspace might just be any ordinary web server. | ||
53 | They already have mechanisms in place to serve dynamic data, and even | ||
54 | deal with changes to the files. This is the whole point of basing the | ||
55 | major asset shifting part of the protocol on the web, people can use all | ||
56 | the major amounts of web infrastructure that already exists and already | ||
57 | solves most of the problems that currently plague virtual worlds based | ||
58 | on SL tech. | ||
59 | |||
60 | The down side of separated is that changes might be slower propagating | ||
61 | to the web server, and there might be two copies of any given set of | ||
62 | assets in memory at once. | ||
63 | |||
64 | A third option is to be separated, but any given web server could have a | ||
65 | mod_love type module written for it. This could share memory with the | ||
66 | love server process. So tighter integration is an option, but they can | ||
67 | work apart. Changes happen in this shared memory, driven by the command | ||
68 | pump in the love server. Lspace just needs read access, and just | ||
69 | serves the current state of the world. Love server persists to disk | ||
70 | when it's ready to, though the shared memory can just be memory mapped | ||
71 | files. This is the best of both worlds, excuse the pun. | ||
72 | |||
73 | |||
74 | Thoughts about directory structure. | ||
75 | ======================================== | ||
76 | |||
77 | A major goal is to have the disk structure of a sim (and inventory) be | ||
78 | decently human readable. The assets should be stored as normal files of | ||
79 | the appropriate type, so that they can be edited with normal editing | ||
80 | software like blender, gimp, a text editor, etc. Other goals include | ||
81 | not duplicating assets, and making it easy to move assets around. | ||
82 | |||
83 | Names. | ||
84 | ------ | ||
85 | |||
86 | A major LL created problem is that in world objects can have the same | ||
87 | name, though stuff in an objects inventory is forced to have unique | ||
88 | names by automatically adding numbers to the names. In inventory you | ||
89 | can have stuff with the same name to. The same named objects don't have | ||
90 | to be the same object, they can be completely different. A simple | ||
91 | object name to file name matching, with directories for contents, just | ||
92 | wont work. Need to munge the names anyway. | ||
93 | |||
94 | All name munging should produce names that are compatible with various | ||
95 | OS file systems, compatible with URLs, add "_123" numbers at the end for | ||
96 | duplicate names in the same directory, and auto add a file extension if | ||
97 | one is missing. Probably should check the file type if there IS a file | ||
98 | extension. | ||
99 | |||
100 | Links and URLs. | ||
101 | --------------- | ||
102 | |||
103 | Any asset file could be a stuffs.lnk file, which holds a relative path | ||
104 | name or full URL pointing to the real asset. An external lspace server | ||
105 | would return the .omg file when the stuffs URL is requested, or an | ||
106 | actual asset file when those are requested. | ||
107 | |||
108 | Would have to do copy on write for editing and other state changes, not | ||
109 | including script state changes. | ||
110 | |||
111 | Probably need to store other info in the .lnk file if it's a URL, SHA-1 | ||
112 | of the original file, other web cache info. Which starts to encroach on | ||
113 | web proxy / cache territory, which we may not want to do, since we want | ||
114 | to use real ones instead of crappy LL cache. | ||
115 | |||
116 | Actually, file names / URLs in .omg files would mostly be relative to | ||
117 | the file name / URL of the sim, and all the way down, so relative to the | ||
118 | directory things are in. It's up to the client to keep track of where | ||
119 | they are and build appropriate full URL / full path file names. | ||
120 | |||
121 | UUIDS. | ||
122 | ------ | ||
123 | |||
124 | Original LL UUIDs are the usual 36 byte string representing 32 lower | ||
125 | case hex characters and some dashes, encoding a 128 bit number. I was | ||
126 | inspired by git using SHA-1 hashes for content addressable assets. | ||
127 | SHA-1 hashes are 40 character hex codes representing 160 bit numbers | ||
128 | that are calculated based on the content. So the same content will give | ||
129 | the same SHA-1 hash. Git has proved that you only need the first digits | ||
130 | of the SHA-1 hash to ensure uniqueness, so it's feasible to use only the | ||
131 | first 128 bits of SHA-1 hashes to squeeze it into a UUID for the | ||
132 | purposes of uniquely identifying assets. Precisely what git does. This | ||
133 | means it could be backwards compatible with LL's use of UUIDs. | ||
134 | |||
135 | Since the SHA-1 code of identical files is the same, we could use this | ||
136 | to reduce duplicated large assets that never change, like textures and | ||
137 | sounds. This will be a big win. | ||
138 | |||
139 | I think we can get away with not storing SHA-1 hashes permanently, just | ||
140 | use them for in memory references, but cache them to disk separately. | ||
141 | The caches can be recreated at any time, since the SHA-1 hashes can be | ||
142 | calculated based on the data in the assets. So no UUIDs stored in .omg | ||
143 | files, just relative file / URL friendly names. The UUID / SHA-1 hashes | ||
144 | are mostly for keeping in memory as keys to stuff, coz they can shrink | ||
145 | down to a long long 128 bit integer. | ||
146 | |||
147 | Each asset file, whether texture, script, mesh, text file, etc, comes | ||
148 | with a matching .sha1 file that holds the SHA-1 hash of that file. .lnk | ||
149 | files get hashed to, so that each copy of a linked stuffs gets it's own | ||
150 | SHA-1 hash, but in this case the "content" is the relative path name. | ||
151 | The .sha1 files of the real asset .lnk files point to can be found in | ||
152 | the same place the real asset file is. Hmm, this means that reference | ||
153 | counting will be needed, otherwise the one real copy of an asset can get | ||
154 | deleted while links still point to it. | ||
155 | |||
156 | There will be a .sha1 directory full of files with the SHA-1 hashes as | ||
157 | part of the name, and the rest being similar to a .lnk file, a path to | ||
158 | the asset or .lnk file. Would save love server needing to keep that all | ||
159 | in memory all the time. | ||
160 | |||
161 | If the file system date stamp for the asset file is later than the one | ||
162 | for the .sha1 file, then someone edited the file, recreate the .sha1 | ||
163 | files. | ||
164 | |||
165 | All the SHA-1 hashes can be recreated at any time, using file system | ||
166 | date stamps to tell if one is stale. They are only used internally to a | ||
167 | running system, to pass small identifiers around, and to fake LL UUIDs | ||
168 | for LSL scripts. When a SHA-1 hash is calculated for a new asset, it | ||
169 | gets stored in the .sha1, but if it already exists in .sha1, then the | ||
170 | asset is replaced by that sha1.lnk file, thus automatically | ||
171 | deduplicating assets. | ||
172 | |||
173 | Reference counting. | ||
174 | ------------------- | ||
175 | |||
176 | Dunno yet, just realised the need for this, will come up with something | ||
177 | soon. Will solve this problem when we implement links, wont need it | ||
178 | until then anyway. | ||
179 | |||
180 | Obviously the count has to be kept with the real asset file, there's a | ||
181 | few ways to go about that. I've been thinking that the .sha1 file might | ||
182 | be a good place to keep other meta data, like perhaps owner and group | ||
183 | info. So one way is to include the reference count there to. Another | ||
184 | option is a separate .ref file with the count inside. A third option, | ||
185 | just tack the count onto the end of a file name. This is likely a bit | ||
186 | quicker than updating a file. | ||
187 | |||
188 | On disk structure. | ||
189 | ------------------ | ||
190 | |||
191 | "some sim name" -> some%20sim%20name/index.omg | ||
192 | list of stuffs rezzed in the sim | ||
193 | stuffs position, size, and orientation | ||
194 | relative file / URL name pointing to the stuffs | ||
195 | no need for the in world name, those interested in that will likely grab the stuffs.omg file anyway | ||
196 | |||
197 | "a stuffs" -> a%20stuffs.omg | ||
198 | in world name, description | ||
199 | list of stuffs similar to the sim index.omg, only this is for the various meshes that make up this stuffs. | ||
200 | stuffs position, size, and orientation, relative to this stuffs | ||
201 | relative file / URL name pointing to the mesh and textures | ||
202 | extra info for each material | ||
203 | |||
204 | a%20stuffs/ directory | ||
205 | files that are the contents of this stuffs | ||
206 | could be .lnk files | ||
207 | .sha1 files | ||
208 | |||
209 | a%20stuffs/index.omg | ||
210 | used to be a list of content file names, type, and UUID | ||
211 | file names are right there in the directory | ||
212 | UUID ala SHA-1 can now be calculated based on those files | ||
213 | and stored in an asset.sha1 file | ||
214 | type can use the magic/file/MIME system to identify file types | ||
215 | can get rid of this file, though maybe have it in a .types directory, | ||
216 | coz we would want to cache the file type | ||
217 | or just use a poor mans magic/file/MIME thingy based on file extension, | ||
218 | since we only have a small number of file types | ||
219 | note cards should have a .txt, scripts a .lsl or .lua | ||
220 | |||
221 | People could even be free to use their own organising directory | ||
222 | structure. A directory for ground level, and one for each sky box for | ||
223 | instance. Relative paths inside .omg files sorts that all out. | ||
224 | |||
225 | A sims index.omg file might be constantly updated for busy sims. Could | ||
226 | generate it on the fly by the Lspace server, based on the actual | ||
227 | contents of the sim directory. Alternative Lspace servers could just | ||
228 | use a CMS system for all of this anyway. They would still use the same | ||
229 | structure for URLs and .omg files. | ||
230 | |||
231 | Avatars. | ||
232 | -------- | ||
233 | |||
234 | Storing avatars in this way isn't such a good idea? Avatars could have | ||
235 | their own avatar.omg dealing with shape, skin, clothes, attachments, | ||
236 | etc. But instead of a client asking for a list, avatar arrivals and | ||
237 | departures are driven by love. Though try to keep avatars as "just | ||
238 | ordinary object, but with a person controlling it". Still, they move | ||
239 | around a lot. | ||
240 | |||
241 | Avatar.omg would live on the users hard drive, but sent to the love | ||
242 | server on login, and after any change. | ||
243 | |||
244 | Misc. | ||
245 | ----- | ||
246 | |||
247 | Right now I'm using Lua style .omg files, but eet would be a better | ||
248 | choice I think. Saves having to write a Lua table to C structure | ||
249 | system, which eet already has, sorta. Lua tables are at least more | ||
250 | readable while I consider the design, but likely use eet instead when I | ||
251 | have to write code to read the suckers. .omg files are managed by the | ||
252 | love server, so fiddling with them is an expert thing anyway. | ||
253 | |||
254 | Should have a tool to validate a sims files and recreate the caches. | ||
255 | |||
256 | Remaining issues. | ||
257 | ----------------- | ||
258 | |||
259 | Owner / group UUID might be better dealt with elsewhere? Coz links. | ||
260 | Also, we wont replicate the LL user / group stuff exactly, but morph | ||
261 | into more standardised variations. Jabber users, jabber group rosters, | ||
262 | OS users, LDAP users and groups, web site users, etc. So just provide | ||
263 | an abstraction, and an example or two. | ||
264 | |||
265 | might be better to move compiled scripts and generated Lua source to the LuaSL server's own private store? | ||
266 | LuaSL needs to assign UUIDs to compiled script binaries, so it knows which running script is which | ||
267 | coz there might be lots of copies of scripts | ||
268 | on the other hand, each copy is uniquely named inside some objects contents, | ||
269 | even if it's a link, | ||
270 | so the UUID of the stuffs plus the UUID within the stuffs contents, for this copy / link of the script should suffice? | ||
271 | |||