GPWiki.org
GPWiki.org
It is currently Sat May 25, 2013 7:28 am

All times are UTC




Post new topic Reply to topic  [ 12 posts ] 
Author Message
PostPosted: Sun Jan 04, 2009 6:30 pm 
i am trying to use one file that contains all my image files

i'm using dx8, 2D

thanx in advance


Top
  
 
 Post subject:
PostPosted: Mon Jan 05, 2009 1:53 pm 
King Code Monkey
User avatar

Joined: Wed Sep 01, 2004 3:05 pm
Posts: 11182
Location: Abingdon, MD
And....?

edit: read this before posting.

_________________
Bored? Head on over to my blog and see what I'm up to.

Microsoft XNA MVP


Last edited by Machaira on Mon Jan 05, 2009 3:00 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 05, 2009 1:56 pm 
Corpse Bride
User avatar

Joined: Tue Jul 01, 2008 11:44 pm
Posts: 2217
Location: England
Machaira wrote:
And....?


c'mon Machaira, obviously he wants to know how to do it. I never use resource files so I can't advise here.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 05, 2009 3:02 pm 
King Code Monkey
User avatar

Joined: Wed Sep 01, 2004 3:05 pm
Posts: 11182
Location: Abingdon, MD
That's a very broad question though that could contain a lot of smaller problems - how to create the custom resource file, how to load the resources in the file, what are the resources being used for, etc. "how to do it" is a meaningless question.

_________________
Bored? Head on over to my blog and see what I'm up to.

Microsoft XNA MVP


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 05, 2009 3:55 pm 
Funky Monkey

Joined: Mon Aug 16, 2004 2:48 pm
Posts: 1604
Location: Minneapolis, MN USA
Back when I was using VB6, I made an encryption-and-packaging tool ... you can still find it at one of my old web pages: http://www.mwgames.com/brickcnp.htm

It has a tool to package your resources, data file, etc., into a single data file, and a DLL with functions and methods for working with those files. Feel free to make use of that if you'd like. I'm happy to answer questions via e-mail or PM on it if you need it.

I made it after reading this old-school tutorial at the original "Lucky's VB Gaming Site": http://www.rookscape.com/vbgaming/tutS.php

HTH,
-Bryk

_________________
www.mwgames.com ... Dicey Curves, Space Mission, Jump Gate, Gem Raider, DareBase, Castle Danger, Keeps & Moats Chess


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 06, 2009 1:29 am 
ok lets, say i use the brickcnp or any other tool,
how would i code it?
i now use this code to load an image

Set Texture = D3DX.CreateTextureFromFileEx(D3DDevice, App.Path & "\Gfx\something.bmp", Val(Menu(State).Width), Val(Menu(State).Height), D3DX_DEFAULT, 0, Compression, D3DPOOL_MANAGED, D3DX_FILTER_POINT, D3DX_FILTER_POINT, &HFF00FF00, ByVal 0, ByVal 0)


how would it look and what would i use?


Top
  
 
 Post subject:
PostPosted: Tue Jan 06, 2009 1:36 am 
Rookie

Joined: Mon Jan 05, 2009 10:00 am
Posts: 3
hmm the way i see it brickpack creates a temp folder then just extracts the files to it, making an reference to the file to it can be used.

this would work, but it would leave the posibility to "borrow" the images
(open temp folder, take images)

is there a more secure way of doing this?



btw im having trouble with the getting the engine to show the image part :), also thanx guys :D


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 06, 2009 2:46 am 
Funky Monkey

Joined: Mon Aug 16, 2004 2:48 pm
Posts: 1604
Location: Minneapolis, MN USA
thijs wrote:
this would work, but it would leave the posibility to "borrow" the images
(open temp folder, take images)

is there a more secure way of doing this?

You would need to do things in 3 steps:

1> Unpack item from resource file into temporary file
2> Load item
3> Delete temporary file

The DLL I listed has "clean up" functions for doing that sort of things for you.

Quote:
btw im having trouble with the getting the engine to show the image part :), also thanx guys :D

You're having probably displaying the item you're loading from file? There are a lot of possible reasons for that ... can you give some sample code?

-Bryk

_________________
www.mwgames.com ... Dicey Curves, Space Mission, Jump Gate, Gem Raider, DareBase, Castle Danger, Keeps & Moats Chess


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 06, 2009 11:03 am 
Rookie

Joined: Mon Jan 05, 2009 10:00 am
Posts: 3
hmm do you have any stats of how fast it loads and of how fast it can delete the files?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 06, 2009 11:35 am 
Bibliotherapist
User avatar

Joined: Wed Dec 21, 2005 6:23 pm
Posts: 6210
Location: Manchester, UK
The problems with a 'secure' method are:
1) No matter how fast it is, someone could write a program that waits for the file to be created and copy it then
2) If the resource file isn't encrypted, they can just open that in a binary editor and figure out the format (isn't normally very difficult with most resource files)
3) If the resource file IS encrypted, then they just need to pull the key and algorithm out of your loader, decrypt it and go to problem 2
4) They could just grab the loaded data from memory anyway

Basically you can't secure the files if you want people to play the game as the data needs to be unpacked and read at some point. The only real reason for using a resource file is that you can potentially make some loading speed optimisations using it (load the resource file for a level into memory, takes 1 file read rather than potentially hundreds).

_________________
God must love stupid people, he made so many.
theraje: 'God doesn't love stupid people, they're just easier to make'
http://sharedillusions.blogspot.com


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 06, 2009 12:12 pm 
Rookie

Joined: Mon Jan 05, 2009 10:00 am
Posts: 3
alright thanx guys :)

going to use the brick system then :P


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 06, 2009 2:54 pm 
Funky Monkey

Joined: Mon Aug 16, 2004 2:48 pm
Posts: 1604
Location: Minneapolis, MN USA
thijs wrote:
hmm do you have any stats of how fast it loads and of how fast it can delete the files?


Nope. It deletes things as fast as your hard disk allows for it.

File operations, in general, are very slow compared to in-memory operations ... so, even if you go with separate files for each resource item, you will want to do your load/save in places where there isn't a need-for-speed -- between levels, during a "loading" screen, etc. Having a single file packed with all of your resources won't have much of an noticeable impact if you're doing your file-handling work in that manner.

If you want to see a game that makes use of it, you can download and play the demo for Gem Raider ... see if you have any game-killing delays due to file ops. ;)

-Bryk

_________________
www.mwgames.com ... Dicey Curves, Space Mission, Jump Gate, Gem Raider, DareBase, Castle Danger, Keeps & Moats Chess


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group