edrickhong / Cu

Game engine I am working on my free time
MIT License
2 stars 0 forks source link

Component format should do a search by string #10

Closed edrickhong closed 6 years ago

edrickhong commented 6 years ago

Currently the format does a search by hash. This makes it inflexible cos this means we cannot change the hash algorithm during development. Instead, we will store component string names and only convert them to a hash only lookup at ship time

edrickhong commented 6 years ago

@findcylim you can give this one a try. It's actually pretty easy.

In game.cpp GameComponentWrite:

//comp name hash FWrite(outfile,&out_comp.comp_name_hash,sizeof(out_comp.comp_name_hash));

//type hash FWrite(outfile,&entry->type_hash,sizeof(entry->type_hash));

//name hash FWrite(outfile,&entry->name_hash,sizeof(entry->name_hash));

Instead of writing the hash, just write the full name string

In game.cpp ComponentRead:

MetaGetTypeByNameHash

MetaSetValueByNameHash

replace them w their string equivalents. You'll need to make a new OBJ.comp file

Test by removing OBJ.comp and creating some objects in the engine. Save to a new OBJ.comp file by rebuilding the project on the cmdline while the engine is running.

When this issue is fixed, either close it yourself or you can reference it in a commit message like this "#". Try to get this one done ASAP since this can be done in less than a day