Optomistic,
I'm curious as to why your concerned about the number of types and functions used. Surely, media will eatup up more disk space.
By separating your 'objects' you can employ them in other projects. Trust me, if your going to code a hobby or career, you will use your libraries in other projects.
I personally dont favor a generic object because they can easily introduce ambiguity in the data, unless you have a good means of management. Heres a generic object class I wrote that may find itself in PW3D and PPF2k4.
I'm curious as to why your concerned about the number of types and functions used. Surely, media will eatup up more disk space.
By separating your 'objects' you can employ them in other projects. Trust me, if your going to code a hobby or career, you will use your libraries in other projects.
I personally dont favor a generic object because they can easily introduce ambiguity in the data, unless you have a good means of management. Heres a generic object class I wrote that may find itself in PW3D and PPF2k4.
;A Generic Obj Class with upto 64 Properties Const OBJ_MAX%= 100 Const OBJ_PROPERTY_MAX%=64 Type obj Field id% Field name$ ;generic properties; Field offset%,label$[OBJ_PROPERTY_MAX],value$[OBJ_PROPERTY_MAX] End Type Dim obj.objID(OBJ_MAX%);id key pointer Global objcount Function objCreate(objname$) this.obj=New obj objcount=objcount+1 this\ID%=objcount objID(this\ID%)=this this\name$=objname$ Return this\id End Function Function objPropertyAdd%(ID,objpropertylabel$,objpropertyvalue$="") objID(ID)\offset=objID(ID)\offset+1 If objID(ID)\offset>OBJ_MAX% RuntimeError(objID(ID)\name+" Properties Full") EndIf objID(ID)\label[objID(ID)\offset]=objpropertylabel$ objID(ID)\value[objID(ID)\offset]=objpropertyvalue$ Return objID(ID)\offset End Function Function objNameSet(ID,objname$) objID(ID)\name=objname End Function Function objNameGet(ID) Return objID(ID)\name End Function Function objPropertyValueSet(ID,objpropertyoffset,objpropertyvalue$) objID(ID)\value$[objpropertyoffset]=objpropertyvalue$ End Function Function objPropertyValueGet(ID,objpropertyoffset) Return objID(ID)\value[objpropertyoffset] End Function Function objPropertyValueGetByLabel(ID,objpropertylabel$) For objpropertyoffset = 0 To objID(ID)\offset If objID(ID)\label[objpropertyoffset] = objpropertylabel Return objID(ID)\value[objpropertyoffset] Next End Function Function objPropertyLabelGetByOffset(ID,objpropertyoffset) Return objID(ID)\label[objpropertyoffset] End Function Function objMimic(ID,objname$) this.obj=objID(objCreate(objName)) this\offset%=objID(ID)\offset% For objpropertyoffset = 0 To OBJ_PROPERTY_MAX this\label$[objpropertyoffset]=objID(ID)\label$[objpropertyoffset] this\value$[objpropertyoffset]=objID(ID)\value$[objpropertyoffset] Next Return this\id End Function ;Create a New Ammo ammo=objCreate("Ammo") objPropertyAdd(ammo,"name","GoldBullet") objPropertyAdd(ammo,"ïd","1") objPropertyAdd(ammo,"damagepoint","5") objPropertyAdd(ammo,"damagearea","10") objPropertyAdd(ammo,"max_distance","100") ;Create a New Gun gun=objCreate("Gun") objPropertyAdd(gun,"name","Blazer3000") objPropertyAdd(gun,"ïd","1") objPropertyAdd(gun,"ammoid","1") objPropertyAdd(gun,"ammo","100") objPropertyAdd(gun,"recoil","0.5")