Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Questions about .Dat files

Author
Message
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 9th Aug 2009 06:38
Hi! I'm working on a game and when I eventually release it I don't want to give people the opportunity to steal my resources. So I want to put my resources into a .dat file like most professional game companies do with their games, the only problem is, is that I have no idea how to do this. I've tried searching google but all I can find is stuff like "to make a .dat file change the extension of a .txt file to.dat" but that doesn't do any good. So how do I make a .dat file and how do I program my game to actually access the .dat file? Thanks! I'll be searching google in the mean time

Use Google first... it's not rocket surgery!
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 9th Aug 2009 07:52
2 good examples of different ways of doing this that you can play with are the Dawn of War/Company of Heroes .SGA format and the World of Warcraft MPQ format...

Both are similar, they store media and data in a single large, usually compressed, file. They both operate in slightly different ways though.

I wouldnt reccommend using either of those technologies, but rather using them as examples of how to achieve what you want.

Realistically though, there isnt alot you can do to stop a determined person from removing your resources from your program one way or another if they really want to. A simple solution would be to use a simple passworded ZIP file with a changed extension so it doesnt look like a zip file, then you could decompress the files you need from it as you need them and load them into memory, then delete them from the hard disk... thats kind of a cheat, but it would work

If it ain't broke.... DONT FIX IT !!!
Drowneath
15
Years of Service
User Offline
Joined: 22nd Jun 2009
Location: In your eyes
Posted: 9th Aug 2009 08:39
Is it possible to load the resources from a compressed file directly to the memory without extracting it first to our drive and read them as a stream?
If possible, how?

if(asleep) sheep++;
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 9th Aug 2009 10:32 Edited at: 9th Aug 2009 10:34
Thats how MPQ's work..... do a search on google using the words "MPQ Library" "MPQLib" "MPQ compression" and things like that.

It is a little harder than it sounds though, as the files pretty much cease to be "individual files with names and paths" as such, and becomes blocks of data thats start and end at a certain point in the large data file, its the programmers responsibility to manage the data....

SGA format works in a similar way, except it retains full filename and path information as part of the archive(mpq has that data, but its not part of the archive metadata, its contained with the actual file data itself, so requires searching to find)

Hope this makes sense, its kind of a simplified view of how they work, both a much more complex to use, for full details, do a search on google and stik the readin glasses on lol

EDIT : To answer you question specifically, yes you can, but the problem I can see is then getting that info into GDK in a way that GDK can use, for instance loading an image as pixel data, you would need to figure out a way to get that pixel data into a GDK image...

If it ain't broke.... DONT FIX IT !!!
Drowneath
15
Years of Service
User Offline
Joined: 22nd Jun 2009
Location: In your eyes
Posted: 9th Aug 2009 10:56
Quote: "EDIT : To answer you question specifically, yes you can, but the problem I can see is then getting that info into GDK in a way that GDK can use, for instance loading an image as pixel data, you would need to figure out a way to get that pixel data into a GDK image..."


Yea tell me how

Because I never heard of GDK function that loads image from raw pixel data.
We can only write the data to a temporary file first, then load it to GDK, then delete the file...

if(asleep) sheep++;
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 9th Aug 2009 11:37 Edited at: 9th Aug 2009 11:49
access the image directly...

D3DFunc is a little plugin originally for DBPro that allowed fast anti-aliased text and image manipulation, through using GDK to access directX directly, you can get the source from the author's website(look in Program Announcements for the thread re D3DFunc)

If you search these forums for the subject you should find a few methods, I know lilith, a regular forums user here, has an image manip class that she has posted somewhere around...

Ill post on here that I have lying around, I didnt write it and I dont remember who did, but if you recognise your code, cheers

ExtendedImage.h:


ExtendedImage.cpp:


Usage Example.cpp:


Just to re-iterate, I didnt write the above code, I downloaded it from these forums somewhere(although to my shame, I cant remember who the author is, and I apologise for that... if this is your code feel free to mention it)

The above should show you basically how you can access an image directly using GDK.

EDIT : After thinking about it for a bit, there is also a much easier, albiet slower way of gettnig that kind of data into GDK, using an image as an example, you would read your data into data structure of somekind, storing the relevant info, pixel color, qo-ords and the like... then you could just create a new image inside gdk and use gdk command like dbPoint to draw your own image... Doing it with media other than images would also be possible, like meshes, you could read the vertex info into a data structure from you data file, and then make a GDK memblock mesh, and copy the data into it etc......

Only reposted this as after thinking about it, accessing GDK using directx manually can be a little long winded and difficult

If it ain't broke.... DONT FIX IT !!!
prasoc
15
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 9th Aug 2009 13:26
Or you could use MoleBox to make files into .dats


Your signature has been erased by a mod

Login to post a reply

Server time is: 2024-10-01 10:38:09
Your offset time is: 2024-10-01 10:38:09