View Single Post
nosoop
Veteran Member
Join Date: Aug 2014
Old 06-30-2018 , 22:51   Re: (fake) Classes/Objects in SourcePawn
Reply With Quote #3

I'd probably go with the native KeyValues in most cases myself. It's a bit slower than StringMaps (2.5x IIRC), but you get weak typing with every single type it supports (which, depending on your viewpoint, may be a pro or a con), you get nested maps, but more importantly, you get serialization capabilities through exporting / importing. There are a few KV-specific quirks you need to be aware of (subkey access, case insensitivity), but there's nothing to worry about otherwise.

Heck, I wrote my server's web API backend with optional KeyValues output instead of JSON for server interop; it's quite nice.

StringMaps are great for temporary mappings that should last as long as the plugin, but the serialization is very much DIY.

Only thing I feel that we're really missing is a library that does fully custom properties that are linked to entity lifetimes.
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)

Last edited by nosoop; 07-01-2018 at 00:49.
nosoop is offline