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