Moving resources from human viewable to binary?

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

wearymemory
Chaos Rift Junior
Chaos Rift Junior
Posts: 209
Joined: Thu Feb 12, 2009 8:46 pm

Re: Moving resources from human viewable to binary?

Post by wearymemory »

avansc wrote:I'm not going to get involved in this argument, but I will say this.

If I understand you correctly, you are talking about something called serialization(donno if someone has already mentioned that), and I for one am in favor for it. Now I'm not going to comment on the things like speed and size, even though there are implications, more so for the prior. I will say that it does make it harder, not impossible, for people to get your resources, and or change em, and secondly, why I am in favor for it, is that it makes it much easier to deal with resources, there is some "pre backing" that takes place, but in the end you cut down the file interaction time significantly.

It's also a lot nicer to have something like (and the extension should say a lot) resources.WAD, then do have level1.bsp dude.png etc. for ever single resource.

Anyways, if nothing else, look into it for the experience.

On a semi germane note, Java has a fantastic serialization implementation.
Serialization - depending on how it's implemented - can provide a powerful mechanism for handling persistence or the transmission of stateful objects (typically not - in my experience - resource bundles that can include sprites, scripts, and audio files like the OP intended), and whether someone should implement serialization in this context should be carefully reconsidered. Due to the complexities that serialization is capable of introducing - and any of its purposes not withstanding - its use may not be advisable.

A major cost of serializing an object's physical representation is that it drastically alters one's ability to improve or edit code, thus hindering backwards compatibility which could potentially result in program failures or the need to completely replace "WADs" of client data. Obviously, serialization is most effective on a structure that will remain unmodified in its code, and stay true to its physical form. One may be able to resolve such issues with more code, however, a caveat of implementing such counter-measures might be the visible blemishes left within the code, hence hindering maintainability. In addition to the matters regarding maintenance, testing should be dramatically increased when utilizing or changing a serialized object's representation in order to avoid any issues that may occur.

Therefore, one should think long and hard before serializing, as you say, "WADs" of object data. The disadvantages to this approach may not be apparent at first, but they may become rather harsh realities in the future. It may prove more effective, and certainly worth the time to resort to preexisting APIs or file formats when needing to represent data with little or no hassle, especially when a project requires its physical representation to change or update over time.

On a semi jewishe note: Java's default serialized form may perform expensive computations and resource-intensive tasks, consume a large quantity of time and space, and introduce bugs and security holes if the decision to use it isn't made or implemented thoughtfully. As you said, Java's Serialization API does offer the java.io.Externalizable interface, which one may implement in order to provide their own encoding methods. Of course, one should usually only provide custom methods if a class requires it for security or specificity, or the default form does not perform reasonably on your class.

In summation, utilize serialization judiciously, and make a conscious decision on whether or not its conventions apply to your project.
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: Moving resources from human viewable to binary?

Post by avansc »

And now that we have a wiki page summarized...

just use common sense.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
wearymemory
Chaos Rift Junior
Chaos Rift Junior
Posts: 209
Joined: Thu Feb 12, 2009 8:46 pm

Re: Moving resources from human viewable to binary?

Post by wearymemory »

avansc wrote:And now that we have a wiki page summarized...
I'm not going to apologize for disagreeing with you. You're obviously jealous of my ability to effectively synthesize data into a coherent argument. However, it could have benefitted both of us if you had responded more maturely, but I respect your right to showcase your stupidity.

I didn't use Wikipedia. Not that you asked before making a fool out of yourself.
avansc wrote:just use common sense.
That's what I said, copy-cat! ;)
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: Moving resources from human viewable to binary?

Post by avansc »

Yes you are so right... I am jealous of someone I dont know on the internet, my life is just so empty now.. Your intellect and wit have shamed me, I think I'll just leave now..
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
User avatar
eatcomics
ES Beta Backer
ES Beta Backer
Posts: 2528
Joined: Sat Mar 08, 2008 7:52 pm
Location: Illinois

Re: Moving resources from human viewable to binary?

Post by eatcomics »

I wish I was cool like you guys... But seriously I've thought about doing this same thing and I came to find its more trouble than its worth for indie hobbyist programmer games.
Image
Post Reply