is there a better way top refer to assets in a game?
something like:
playwav("some_sound.wav");
is high on readability, but runs slow.
whereas something like:
playwav(36); // wav ID # 36 = some_sound.wav
runs fast, but is low on readability (without the comments), and is worse from a write-ability standpoint, because you have to look up the wav ID # for some_sound.wav in order to code it in.
one possibility is to #define some mnemonic name for each asset, such as:
#define some_sound_wav 36
or possibly use enums, perhaps one enumerated type for each type of asset. but enums would get evaluated at runtime, not compile time, right? and they have type check overhead too, correct?
so another possibility is you make the whole thing data driven, with internal or external editors. in the editors, assets are referred to by filename (for example), but are saved in the data files as ID numbers. but this would not handle non-data driven code such as:
ZeroMemory(drawinfo)
drawinfo.mesh=SPHERE
drawinfo.tex=GRANITE1
drawinfo.scale=...
drawinfo.location=...
drawinfo.flags=...
draw_it(drawinfo)
right now, i use ID numbers, so the above code might look like:
drawinfo.mesh=3;
drawinfo.tex=27;
has somebody already figured out a good solution to this, and i've just never heard of it?