.bin files?

Forum for general chit-chat or off-topic discussion.

Moderators: CEGUI MVP, CEGUI Team

Nomonkeybusiness
Not too shy to talk
Not too shy to talk
Posts: 45
Joined: Wed Sep 09, 2009 11:20

.bin files?

Postby Nomonkeybusiness » Tue Apr 06, 2010 09:12

Good morning.
As some of you may know, I'm working as a GUI-coder on a start-up project, and we're using CEGUI for our gui-handeling.
When I started the game today I noticed that our loading-time is cirka 10 seconds, just for the gui-files.
This got me thinking. Would it be faster to parse binary-data instead of XML, and is this maybe something that CE has thought of? In that case, why isn't it implemented, and will it ever be?
It's not only loading-times that bothers me. Say we would like to distribute our game, we wouldn't want the end-users to be able to fuck around in our .layout-files. This can of course be avoided
with other methods, but it would be kind of insuring to keep the data so that no one could read them.

Is this a moot topic, if so, why?

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: .bin files?

Postby Jamarr » Tue Apr 06, 2010 16:49

I do not see the point in creating a binary language for resource files. Can you imagine trying to replicate every single xml node in binary? It's a waste of time for minimal benefit.

Since the binary format would have to be standard, it would be very easy to write a binary->xml converter; meaning there is no real security. The only benefit would be the reduced file-size, and this can be achieved with far easier means. For example, you may want to look at the recently added MinizipResourceProvider.

If you want compression and security, it should not be too hard to add zip-password protection to the MinizipResourceProvider; or even to add your own encryption. In addition, you could also extend the ResourceProvider to load embeded files from the executable (at least on windows; assuming lin/mac would be just as easy); this way the data is read from the executable instead of from a separate file.

But then we are moving away from the point of xml and non-embeded resources: giving the user the option to customize their gui. If this is a goal, then ideally CEGUI would have an XML->code conversion utility (similar to wxWidgets). With this, you could cut out the data reading and parsing processes, leaving only object creation. This would be ideal for those who want to embed their gui and/or those who want optimal loading times.
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: .bin files?

Postby CrazyEddie » Wed Apr 07, 2010 09:19

My opinion is that binary file formats are evil and to be avoided. I'm not saying that XML is the answer to all the issues - it's definitely not; in fact we may have gone a bit over board in CEGUI Mk-2!! This said, I think it's doubtful that the XML parse itself causing the delay - it's more likely the creation of the various objects based on the XML content; these objects would still have to be created from a binary file too - so no gain there.

I think restricting what your users can do with your product is not the way to go. Take the commercially available DRM solutions - they've all been broken. Take binary file formats for existing games and applications, largely they've all been broken. By doing this kind of thing you make your own life more difficult, frustrate users initially who will invariably find a way to do what they want anyway. Allow your users the freedom to fully explore your product - support and embrace the openness :D

It's (generally) possible to create via code everything that the XML parsers create - so you are free to implement functions that take a binary file format of your choosing and create CEGUI objects in response. There are no plans to implement any thing like this directly in CEGUI. As far as certain other details go - with regards to ResourceProviders and such - Jamarr is right on the money.

Going slightly off at a tangent, one interesting point is that for the Mac, they actually have the concept of an app 'bundle' - or package - which is basically a directory structure that, for all intents and purposes, behaves like a single file - so we're already able to bundle the data files with the app and make use of the existing DefaultResourceProvider to load the files directly from within the app packages Resources subdir - we do this with the CEGUI samples (actually the resources are just symlinked to save space) and the editor tools too. For those who don't know, to install on the Mac, you just drag a single file to your system or local 'Applications' directory and away you go, and to uninstall you just drag it out again into the trash. Really cool stuff, and saves all the install/uninstall BS you get on Windows and Linux.

CE


Return to “Offtopic Discussion”

Who is online

Users browsing this forum: No registered users and 2 guests