prixt wrote:Is it possible to register custom classes that don't use libraries you mentioned? I prefer to create classes on a case by case basis, so don't use outside libraries.
It depends on how exactly you use it. Bitser has to heuristically detect how the class works and how to construct instances when loading. If the class is the metatable of instances, for example, it would work no problem, because bitser would think you're using hump.class. When registering a class you can also give a classkey and deserializer:
Code: Select all
bitser.registerClass('YourClass', YourClass, 'classkey', function(instance, class) return --[[make instance an instance of class]] end)
pgimeno wrote:The fact that it outputs to binary only is a problem for me to adopt it, though. I'm not a big fan of obscurity in savegames in most situations. One should not need to use a savegame editor just to make a few changes.
That's a good point. That's maybe a good idea for another library, that maximizes readability at the expense of size, speed and security. Originally I wrote Lady for that, but Lady is not very readable, making hand-editing it less fun.
pgimeno wrote:However, I like the idea for complex games where there's a lot of data and storing it in a compact way is best.
Yeah, that's more the intended use case.
ingsoc451 wrote:does small int work like variable int in protobuf (uses less bytes for small integers)
Yes. Integers from -27 to 100 are stored in the type byte.