Quantcast
Channel: FreeOrion
Viewing all articles
Browse latest Browse all 387

Programming • Re: Content optimization

$
0
0
Yes, it should be available with extra lookup steps, but for me it looks like we need some tag for building content type marking it's a colony building and condition to check if building has a mark.
both string prefixes and own tags on the BuildingType sound ok to me.

For the condition though it would still make sense to memoize/build a reverse-index on those. So a set of building-type-ids which have that prefix/tag and one can simply query if the prefix/tag is contained.
Details: Maybe make that set shared per universe. The datastructure might also be something else but a set in order for faster contains check; e.g. a yes/no array or an ordered set.

If we do that, prefixes would be probably the more powerful version and would need less scripting infrastructure.

rough sketches:
1) per universe have a map of prefixes to content-type-ids; on parsing if a condition uses a prefix, check the map if the prefix exists, else create one; if one exists use it in the condition. After parsing the content type names are known so the prefix map gets filled with content-type-id-sets for each prefix.

or
2) per universe have a map of prefixes to content-type-ids; on parsing if a condition uses a prefix, remember the prefix. After parsing the content type names are known. (In a further step or) on execution of the condition, the condition queries the central thingy, which builds and registers prefix sets and returns the result to the condition.

Statistics: Posted by Ophiuchus — Wed Mar 05, 2025 1:30 pm



Viewing all articles
Browse latest Browse all 387

Trending Articles