The command-line as a poor mans config files

I like command-line arguments as mentioned in an earlier post about them. In this post I’ll discuss a method to use them as simple config-files.

Let’s start of with a usage example from my own code. I have a meshviewer/particleviewer that is used for, you guessed it, viewing meshes and particle-effects. These kind of resources, at least the particle-effects, have internal paths to resources that need to be read while loading ( particles have a material to be rendered with etc ), i.e. resources from “some game” need to be found by the particle-viewer. Since reading resources is done via a VFS ( Virtual File System ) and paths is always specified via this VFS in resources we must just make sure that “some game”:s resources is mounted in the particle-viewer!

Read More

Registering command line arguments

I really like using command line arguments. I think that it is a flexible way to interact with and configure my games/engine. It is for example easier to just add a --log-verbose=resource to set all logging in the “resource”-domain to verbose or --memory-enable-stacktrace=render to enable save of stacktraces for all allocations done in the “render”-allocator than to edit some config-file somewhere. At least for things such as the ones mentioned above, that is only set once in a while.

Read More