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.

DarkBASIC Discussion / is it possible to make a data file to hold models in?

Author
Message
Xarshi
19
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 11th Jan 2006 00:30
is it possible to make a really simple data file that holds model data?or would i have to go through great lenghts to get this done,because i want all my maps for my game to be in folders people cant open(at least for a while)

HARK!
Kevin Picone
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 11th Jan 2006 00:46
Yes. You can build your own 'custom' Pack format. Which is nothing more than spooling all the files you wish to hide into one big file. Your pack file of course includes some header information about what files are stored within it and where abouts their sitting within the pack.

But there's a few issues. One major one is that In order to load a file, then you need to first extract to a temporary copy of the file to disc, load it (ie Load object ), then delete the temp copy. As to ensure you don't leave the temp files (your models etc) sitting around for somebody to grab..

The worse part about this approach, is it's not only slow to load for the Player it's no more secure..

SimSmall
20
Years of Service
User Offline
Joined: 7th Aug 2004
Location: United Kingdom
Posted: 11th Jan 2006 13:12 Edited at: 11th Jan 2006 16:03
Not true about having to store it temporarily. an old way I did it:


This will read a number to see how many objects are in this file, then read a memblock containing a mesh, another memblock containing an image, an object is made from this mesh and given this texture. Finally a junk byte is thrown in to confuse other programs that tried to read my file

Whatever you're trying to store, put them in a memblock first, then dump the memblock in a file, additionally, put some junk in, just make sure your program knows to ignore it!

This is by no means secure, but the average user now can't get to your media... A determined user will still be able to get through though

...maybe one day I'll finish a project
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 11th Jan 2006 15:00
SimSmall's code only works with the enhanced version of DBC.
But, it's also the only way you can use to encrypt objects properly.

If you want to make your objects full proof, you can encrypt and decrypt each byte internally. Save that information to a chosen file, and no one will be able to decrypt it.

I suggest you use random values. (You specify a seed value and use randomize seed). The seed is used for the very complex formulas to create the "random values". Which means, that if you use the same seed every time, the same formula is used and thus the same random sequence too.
These sequences can be used for encrypting.

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.

Login to post a reply

Server time is: 2025-05-23 02:22:05
Your offset time is: 2025-05-23 02:22:05