Saturday, 24 July 2010

Abstract base class

So, I finally made the base class of game objects abstract by making Get_Weight() and Get_Material() abstract. There was no problem in instance issues, because the class was already used like an abstract one. But I was surprised how many member functions of Get_Weight and Get_Material were missing from derived classes. Usually it's ok, because you just return some generic value for weight and material, but in this case the values were not good. You need the proper values from each object type. It was really good change, because at the same time I wrote missing data for some object types and now weight and material have correct (mostly) values for each object type.

The third essential value is size, but I have still problems to create a generic enough size table for objects. I decided to go with abstract sizes like small, huge, etc. instead of metric sizes. This was simply because it's incredibly time consuming and difficult to get (or imagine) proper metric sizes for objects. I can also use the size as least important factor in physics calculations, because I guess that's what it is in real life also.

I really need to compose myself and get the fundamental object data ready for action.

No comments:

Post a comment