gmod_game: gmsave, entity and physics

Revision 462
gmsave, entity and physicsAdded Files:
[ul]
[li]trunk/lua/includes/gmsave.lua[/li][li]trunk/lua/includes/gmsave/entity.lua[/li][li]trunk/lua/includes/gmsave/entity_filters.lua[/li][li]trunk/lua/includes/gmsave/physics.lua[/li][/ul]
Committed By Garry Newman

So is this the new savefile format you were developing?
Interesting.

Key values… :barf:

Oh well, its your garrysmod.org storage space :v:

What should I use?

glon.

glon is pretty bad too, i would suggest some kind of custom format with some semi-use of GLon, also make file.Write support binary mode (as a argument, the binary flag makes windows not do stupid
overrides) and file.Read support NULL chars :argh:

What’s the benefit of making a new format instead of using a format that everyone already understands and everyone knows how to access and use?

File size mainly. Example:

Encoding the DarkRP LANGUAGE table, which is a huge set of strings.

Key Values: 19766 bytes
GLon: 18422 bytes
Custom format: 14172 bytes

As you can see there is a 4 kb differance, depending on what you try to save the differance would differ

[editline]09:09PM[/editline]

And encoding times, for example:

Key values: 0.197265625
GLon: 0.037109375
Custom format: 0 (didnt catch, even timers that use QueryPerformanceCounter doesnt catch it)

This would also differ depending on what your trying to encode

I don’t think size is an issue.

:mmmsmug:

[editline]automergesucks[/editline]

I don’t see the point in KeyValues at all, save file’s don’t have to be readable do they?

Insert “that’s what she said” joke here.

But yeah, there’s not too much to gain by compression. Or making things smaller.

Edit: Damn, iRzilla beat me to it :saddowns:

I think keyvalues are fine. Maybe you could modify it to support vectors and angles and all that instead of doing __type and maybe make it so you can use anything as key names.

I don’t understand why having a small filesize is important. If you were to host it on some website you could just compress it with 7zip or something. Readability is nice.

Size could turn into a issue, but probably not, huge saves might go up to serval MB if you use KeyValues though, a custom key values writer would be best though, the current one would mess up (as it doesnt support keys or values properly)

All we have to do is compress the keyvalues then size isn’t an issue. I don’t see the problem.

well I think it’s more about how fast is it being read by the game ( the game needs to open the file, put the entire content into memory and after that apply the keyvalue class onto it etc., I don’t really want to go any deeper into this… ) rather then how big the file is ( on the other hand, the bigger the file, the longer does it take to read it’s content ) and there are ways to speed that up, but as long as you aren’t able to notice any speed loss: why bother?

If you really want to be all “OMG SMALLER NAO NAO NAO”, then BZ2.

Advantages:

  • Source natively supports it, so not much extra work required
  • Free (as in beer, and I believe as in freedom as well)
    Disadvantages:
  • Windows doesn’t natively support it, so you’ll get a lot of “hao do i opun dis”