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 / How do I include media in a GDK exe?

Author
Message
Robert The Robot
17
Years of Service
User Offline
Joined: 8th Jan 2007
Location: Fireball XL5
Posted: 23rd Sep 2008 11:34
Hi guys, it's me again.

I've been upgrading my DBC program "Lightning Limbs" (you can read about it here) but owing to a couple of commands not working I think I've reached the limit of what's possible in DBC.

Anyway, I was considering porting the whole thing over to GDK (where the commands in question were fixed). But I'm wondering - in DBC there's the option to Build (compile code) and to Build Final (compile code and include all media).

Is there a way to include a media folder as a part of the finished GDK exe file?

"I wish I was a spaceman, the fastest guy alive. I'd fly you round the universe, in Fireball XL5..."
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 25th Sep 2008 11:02
The compilation/building of a DarkGDK program is done by the Visual C++ compiler and linker.. it will include your resources like icons, menus etc in files along with the release build...

Any media that your project includes thuogh, just needs to be in its correct directory structure alongside the release build, and it will find it...(i mean, if your project is saying to load an image from "\\media\thisimage.jpg" all you need to do is make sure that thisimage.jpg is in a folder called "media" under the same directory as the final EXE build file, i think this is similar to how DarkBasic works(i dont use it so not sure) -- although C++ has more than just a single EXE file, it has manifests and resource files, perhaps object files etc -- might be worth having a look through the MSDN website for some more info)

There is actually no option to "build all this media into this EXE"
from inside C++ the languages work kind of differently(I think there actually is a way you can store all of your used media in 1 file, but it is difficult, and would require extensive knowledge of c++ itself and how to work with file compression and archives).. C++ is a much lower level programming language than DarkBasic and the way in which they compile are slightly different...

If it ain't broke.... DONT FIX IT !!!
Gasilli
16
Years of Service
User Offline
Joined: 20th Sep 2008
Location: Having a party in your garage
Posted: 26th Sep 2008 02:33
I would like to do something simillar to this, because I would rather not share my media with anyone who downloads it. The only ways I can think of is using a file to store all the media, such as media.dat or something, or including it in the exe. I see that there probably isnt an easy way to include it, so does anyone know how to make a file that contains all the media?
Mike J
Retired Moderator
18
Years of Service
User Offline
Joined: 7th Jul 2006
Location: Binghamton, NY, USA
Posted: 26th Sep 2008 02:50
I would suggest that you look into using resource files. They allow you to build various kinds of media into a DLL that you can distribute with your game.

Try Googling "c++ resource files".

"The early bird may get the worm, but the second mouse gets the cheese."
Gasilli
16
Years of Service
User Offline
Joined: 20th Sep 2008
Location: Having a party in your garage
Posted: 26th Sep 2008 03:38
Thanks, now that I think about it that makes much more sense. I will also look into C# for GDK.NET.
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 26th Sep 2008 07:04
It is a good idea to deny end users access to your actual media for Games and things, stop stuff getting changed easily, protect copyrights etc...

Some of the bigger games developers use kinds of Custom Archive formats(Blizzard(World of Warcraft) use the .MPQ format) to store all of their media.
If you do a google search on .MPQ file programming libraries and tutorials you should be able to find a few different ways of achieving what you want.

If it ain't broke.... DONT FIX IT !!!
Mahoney
16
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 26th Sep 2008 07:09
Quote: "Some of the bigger games developers use kinds of Custom Archive formats(Blizzard(World of Warcraft) use the .MPQ format) to store all of their media.
If you do a google search on .MPQ file programming libraries and tutorials you should be able to find a few different ways of achieving what you want."


Lol. It didn't work for long.

Easter Sun (Massive Diablo II Mod) link:

http://miyoshino.la.coocan.jp/eswiki/?FrontPage

Windows Vista Home Premium Intel Pentium Dual-Core 1.6 Ghz 1GB DDR2 RAM GeForce 8600GT Twin Turbo
Gasilli
16
Years of Service
User Offline
Joined: 20th Sep 2008
Location: Having a party in your garage
Posted: 26th Sep 2008 07:18
MPQs aren't secure any more, take for instance all the World of Warcraft private servers, they all use extracted MPQ files.
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 26th Sep 2008 08:14
Thats true... but if you think about it, it requires some knowledge to be able to get at the data in those kinds of files, enough that the person doing it would more than likely be able to find a way to get at the data no matter what you did.. I mean, if someone wants to get at it badly enough, and can find out how, not much can stop em.. But that doesnt mean you have to just hand it straight to them(.MPQ isnt the best one for security lol .. but it makes a good example for the concepts of using archive formats, im pretty sure the best way to do it would be to use you own encryption format and you own archive format(would need knowledge of working with files and data streams in c++ though) to make it as hard as possible for anyone to decrypt the archive )

If it ain't broke.... DONT FIX IT !!!
Mahoney
16
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 26th Sep 2008 19:28
Quote: ".MPQ isnt the best one for security lol .. but it makes a good example for the concepts of using archive formats, im pretty sure the best way to do it would be to use you own encryption format and you own archive format(would need knowledge of working with files and data streams in c++ though) to make it as hard as possible for anyone to decrypt the archive"


Pretty much. But, using AES-256 encryption with a hardcoded passkey in the program would be a lot less work.

Windows Vista Home Premium Intel Pentium Dual-Core 1.6 Ghz 1GB DDR2 RAM GeForce 8600GT Twin Turbo
Gasilli
16
Years of Service
User Offline
Joined: 20th Sep 2008
Location: Having a party in your garage
Posted: 27th Sep 2008 01:32
That would work, on any sort of package system. I might look into doing that with MPQs, if you can easily use them.
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 27th Sep 2008 08:54
A hardcoded passkey that can be found when you decompile it. >.>
Mahoney
16
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 27th Sep 2008 08:57
Quote: "A hardcoded passkey that can be found when you decompile it. >.> "


True. But that's a lot of disassembly to look through. There's little to no chance that they'd find it.

Windows Vista Home Premium Intel Pentium Dual-Core 1.6 Ghz 1GB DDR2 RAM GeForce 8600GT Twin Turbo
RancidRat
16
Years of Service
User Offline
Joined: 19th Feb 2008
Location:
Posted: 27th Sep 2008 11:27
I had this crazy idea. Remember Duke Nukem 3d (which is now abandon ware and free), it had all its media in a single .grp file, it came with 2 tools, kextract and kgroup, which you could use to group your own media into one file. I was thinking of grouping all my media and then just extract them all during the game load and then on exit, just delete all the files.
Robert The Robot
17
Years of Service
User Offline
Joined: 8th Jan 2007
Location: Fireball XL5
Posted: 27th Sep 2008 11:37 Edited at: 27th Sep 2008 11:38
Hi, I've been reading your posts and I think basically the two options are to either create my own "encrypted" file format or to use these .rc files.

Unfortunately, I don't think I have the ability to create these rc files - when I followed the instrutcions on the msdn help pages, there was no "resources" tab. I did find alink to online templates through the "Add new item" tab, should I try one of these?

As for encrypting my data, I think I might be able to do that using memblocks, though it might be tricky. I was kind of hoping to tidy everything up and get the final release version in just one file, but maybe that's just not possible.

"I wish I was a spaceman, the fastest guy alive. I'd fly you round the universe, in Fireball XL5..."
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 27th Sep 2008 12:18
you need full version of VC++ (not the free one) to be able to add resources
Mahoney
16
Years of Service
User Offline
Joined: 14th Apr 2008
Location: The Interwebs
Posted: 27th Sep 2008 12:44
Quote: "you need full version of VC++ (not the free one) to be able to add resources"


Actually, you only need to full version to easily add resources. You can still do it manually with a resource.h file. Google for a tutorial.

Windows Vista Home Premium Intel Pentium Dual-Core 1.6 Ghz 1GB DDR2 RAM GeForce 8600GT Twin Turbo
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 27th Sep 2008 17:27
Quote: "True. But that's a lot of disassembly to look through. There's little to no chance that they'd find it."


If I wanted to get really paranoid about it, I'd encrypt a password, store it and then programatically decrypt it before using it.

Some years ago I wrote a program that didn't so much use a password to prevent access. When someone registered (this was before the Internet made online sales easy) I'd send them a copy of the program that would display their name as the owner. The name was encrypted inside the program by me having to recompile the source every time but it wasn't a lengthy procedure. If the program started to get passed around without paying for it, I'd know who did it. It never got popular enough to worry about.

The encryption was a simple XOR but used a key that was a bit more complex for each letter.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
nrasool
21
Years of Service
User Offline
Joined: 22nd Sep 2003
Location: Surrey Area
Posted: 27th Sep 2008 17:49
You could always use MoleBox to pack all the images, models, music in. It pretty good, and well worth the money.

A Good Programmer never blames his tools
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 28th Sep 2008 05:33
Just an idea, but I was reading through the docs for the <file> section of DarkGDK.. it actually has commands(no idea if they work or not) that create a "pak file" that can contain "whole files and directories"

The commands are dbReadFileBlock, dbReadDirBlock, dbWriteFileBlock, dbWriteDirBlock.. can use dbOpen and dbClose to open a file that is a "pak" file so the docs say, would need to read the commands a little more carefully and do some experimenting..

Perhaps just using GDK to do it, unpack you media on program start, then delete/re-pack at the end(although you would need to make sure that it would be deleted/re-packed even if the program crashed unexpectedly) .... again, I dont know if those commands would work, or how they work as I've not played with them, but assuming they do what they say, it would be an easy way around the problem... although again not the best security-wise, if it works, it would be a perfectly acceptable way of storing all of you media(3d models, images, audio etc)

If it ain't broke.... DONT FIX IT !!!
Robert The Robot
17
Years of Service
User Offline
Joined: 8th Jan 2007
Location: Fireball XL5
Posted: 29th Sep 2008 22:26
Hi guys, thanks for all your comments. I'm afraid I still can't quite follow how to go about manually creating resource files (the google tutorials aren't making much sense to me). Would someone be able to upload a sample resource.h file for me to take a look at?

"I wish I was a spaceman, the fastest guy alive. I'd fly you round the universe, in Fireball XL5..."
kBessa
17
Years of Service
User Offline
Joined: 8th Nov 2006
Location: Manaus, Amazonas, Brazil
Posted: 30th Sep 2008 05:52
Quote: "Just an idea, but I was reading through the docs for the <file> section of DarkGDK.. it actually has commands(no idea if they work or not) that create a "pak file" that can contain "whole files and directories"

The commands are dbReadFileBlock, dbReadDirBlock, dbWriteFileBlock, dbWriteDirBlock.. can use dbOpen and dbClose to open a file that is a "pak" file so the docs say, would need to read the commands a little more carefully and do some experimenting.."


I've seen that at DarkGDK docs and headers but honestly, I don't know how do they work (if they do work). It only gets the ID and the filename/directory, so where's the file being extracted to? They return no pointers, no filename (on disk), nothing!

[center][center]
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 3rd Oct 2008 04:05
@kBessa.... exactly lol... those were my thoughts aswell ...

I was kind of thinking that those commands may just use the windows "folder compression" stuff ... looks like i need to do some experimenting to see if the work or not, and how.

If it ain't broke.... DONT FIX IT !!!
kBessa
17
Years of Service
User Offline
Joined: 8th Nov 2006
Location: Manaus, Amazonas, Brazil
Posted: 3rd Oct 2008 04:15
But, with DarkGDK.NET it will be no problem!

It natively has support for it, inside tany .net assembly: exe or dll. Also, there will be my LightPackage plugin.

Both of them extract to a temp folder, load, and erase the file. This is necessary because DarkGDK does not have "memory loaders", it can only load from disk.

-Thiago

[center][center]

Login to post a reply

Server time is: 2024-09-30 07:23:00
Your offset time is: 2024-09-30 07:23:00