I'm not quite there yet, but I need to get this down. I'm am convinced that I need all my 'objects' of my game - everything that can be interacted with - need a certain set of properties.
This set of properties number a dozen or two. I'm considering how best to handle this. The properties are things like 'takeable', 'is light', 'is vehicle', 'container', 'is weapon', etc. I consider these to be universal to all my objects within the game. I'm pretty sure that they would be need to be tracked/persisted globally (their state could change - after a candle burns out it would no longer have the 'is light' property)
First, how should I construct my objects to best handle these properties? Should I subclass the Object class & add these properties (like how the Autodoor subclassed the Door script)? Or should I just create an array for each property, where the index of the array is the object number & correlate them? For example, if I have 100 objects, I would have an array 'takeable[100]', 'is_light[100]', and the index of the array would correspond to each object.
Further along these lines, after such a structure is set up & useable, I'm thinking about implementing basic, default, sanity-check said string code logic, leveraging these object properties (sort of like what I did for identifying actors - I would also have to pre-process the input string to identify what the subject is) For example:
(if(Said('light') // user input for example is 'light lamp'
(if(subject does not have light) // this logic doesn't work, but you get the idea...
Print("Preposterous! You can't light that!")
)
)
The reason behind this to handle inputs that are total nonsense - but legitimate. I would hate the alternative, which would have to check every object that is 'lightable' (or not lightable). I guess I could just handle each object that is lightable, and then the default would be the above print statement.
Sorry for the brain-dump.