I am coding a rhythm game and one of the things I really want to keep in mind is the integrity of an artist's license and copyright. I appreciate artists giving me copyright license to use in my game but I don't want people to use my game as a way of getting their music for free.
Part of the idea is to distribute the game with 1-2 songs and they can download as many as they want from my website (to keep the installer size small so people with bandwidth limits can download the game without having to worry about size limits).
What I would like to do is have a file for instance a .dbf which when double clicked will move itself to my game directory (e.g C:/Program Files/Dashie's Sky Games/Rhythms/) as a .dbf, each .dbf will essentially contain two files (the .mp3 and the .drf), the .drf will contain the things such as where the notes would be, difficulty level, where the UberDash is and so on, this would be unencrypted however only editable via the ingame editor (not around yet).
I don't want people to be able to just rename the .dbf into .zip and be able to access the .mp3
I kinda want it so that the game will open the .dbf, decrypt it or whatever and store the .mp3 and .drf into memory (or in some very obscure temporary directory). I am using bass.dll for the music library. Any ideas at all?
Very much appreciated.
End of the day if the song is stored as an MP3 or other popular format then no matter how you package it someone will in theory be able to get it.
In my opinion your best option is to zip them and change the extension (maybe not zip zip, but 7zip or rar or a not so "default" compression mechanism) and then let your program unpackage the songs. I think you have to accept that if your program can unpackage the file then a human being will be able to as well, but assume that if someone wants a song, trying to decrypt your song storage mechanism won't be their preferred way of doing so (bittorrent will be, let's be honest). You could also include a "Get this song!" button in your application which would take the user to iTunes or what have you, allowing the user to get the song legally. If Warner, EMI and the RIAA can't stop people from pirating music, you most certainly won't be able to. Just try to make it easier for the user to get the song legally.
Related
I am quite new in game development with Unity and was wondering how the "export game" function of unity works. I not yet used this function in unity, but I've read that it will generate some .exe file from your complete game. I also read that it will create a "data" folder or something like that.
My question is: What exactly is stored in this "data" folder? And how can I write logic to save my own files (e.g. files which contain save states, settings, configurations, etc.) in some file inside this directory (which is then shipped with the complete game / created in the local game directory after the user e.g. saved his game the first time? Can i e.g. save those files in a relative path (e.g. ./MyGame/data/savegames)?
And which types of files can I create? Text / Binary? Or can I even use some relational Database (some small one like HSQLDB)?
And how are things like models, sounds, animations and other assets treated? Are they all packaged within the .exe file which is my complete game? Or do i have some seperate folders with the shipped game for them?
Thank you!
The data folder (named the same as the exe file, but _Data on the end instead of .exe, which can be safely renamed to just Data) contains all of the dlls that actually run the game (even a blank Unity project will have them! The unity engine itself compiles to several dlls) as well as any Resources you might have (tip: stop using resources and use Asset Bundles instead).
Omitting this folder would be very bad indeed!
As for reading/writing other data from the hard disk (which is not possible on all platforms--looking at you web deployment) I would recommend using your own folder, eg. RuntimeData which could contain external audio, image, or video files as well as mutable data such as save games or screenshots. Pretty much anything you'd be ok with your users modifying without seriously breaking stuff (modding is "in" these days).
As for the types of file: well, that's up to you, really! Creating text files (of any extension: xml, html, dat, qqq...) is very easy. Images tend to be done through a 3rd party script (do you really want to write your own JPG converter? Video, same thing). You can also create binary files following a format of your own choosing. The only difficulty is writing the serializer and deserializer for the data, which would scale in difficulty as the complexity of the data scales.
You have full file system access* so you can realistically read or write anywhere. This is C# we're talking about. But with great power comes great responsibility.
*Note: Mobile devices heavily frown on that sort of thing and will deny access to folders outside the one explicitly given to that application.
Ok so there are a couple inherent understandings
1) I know the SoundPlayer class, despite being able to load System.IO.Stream interfaces, is 100% incapable of playing more than one sound at once, despite all the multithreading and multiple-property usage.
2) I know WMPLib is the go to answer for playing multiple files. Sadly, it requires a URL, and according to MSDN, that URL cannot point to a resource. WindowsMediaPlayer class is also incapable of loading IO.Stream interfaces.
3) I saw a hack where you write out a temporary audio file to disk and have WMPlib play that, and to that I say "polite pass"
Simply put, I do not want users messing with the source audio files. I intend to distribute just the executable and not a zip containing a tonn of files. This is why I opted for the .resx
Is there not another audio player available to C# that can take an IO.Stream that is capable of playing more than one thing at a time?
My little program is a text adventure, and I intend to have a little ambient loop playing in the background while some sound effects play to reflect what's happening on the screen.
I'm making an XNA game, which uses a lot (currently ~2800) of small resource files. It has become a problem to move them around from place to place unarchived, so I thought maybe I could just zip them and make the game unzip them automatically, into memory, preferably. I don't need the writing capability yet, right now only reading.
Is there an easy way to unzip a folder into memory and access those files just like, or as simple as the regular files on disk?
I've been reading some similar questions and I see many people say that the OS (Windows in my case) can handle file caching better than a ram drive. I'm just going for unzipping and reading files for now, but in future I might need to modify or create new files, and I'd like it to be quick and seamless for the user. Maybe I should take a different approach at solving my current problem, taking in account my future goal?
I haven't personally tried this but if you want to be able to zip/unzip in memory, you could just use a MemoryStream and pass that into a library (eg https://github.com/icsharpcode/SharpZipLib). Things you'll probably need to remember, are you just moving a bottleneck to a different bottleneck?
You could also try something like the approach with Sprites in HTML. You combine all your Zip's into 1 with an Index to where in the file they are. Then you move your FileStream.Position to the location for the resource you are looking for, read (the amount you need) then do what you need with it. You'd need to make sure that if you rebuild any you make something rebuild all your combining indexes etc. Then you just would be copying 1 file around, it just so happens that inside that file you have ~2800 smaller segments of interest.
Given the path of a string i want to wipe out the contents of a file. The natural way I thought (which maybe incorrect) was to open a FileStream to the file and write gibberish (random data perhaps taken from a RNGCryptoServiceProvider) to it. And then perhaps do this several times and then delete the file.
My problem is that while this may look logically correct, i read up on another blog that Windows might actually choose to write the file to a different place in the hard disk.
Is that the case in Windows Mobile? Will this actually be a problem? Does this writing to a different location in the hard disk apply to even flash based (SD etc) cards ?
I've not personally done this, but you will probably need to use the low-level FLASH driver IOCTLs to do this correctly.
http://msdn.microsoft.com/en-us/library/aa927166.aspx
I think IOCTL_FMD_RAW_WRITE_BLOCKS looks particularly useful.
-PaulH
Another possibility that may work would be to erase the file normally, then use the defragment APIs to wipe ALL of the freespace on your flash. Since you're wiping everything, it won't be necessary to know exactly where on the disk your file was. But, this will wear out your flash drive more quickly. The C# method is detailed in this blog post: http://blogs.msdn.com/b/jeffrey_wall/archive/2004/09/13/229137.aspx
I want to make a program that takes an MP3 file and breaks it into many smaller mp3 files based on 1-2 seconds of no sound (silence).
What is the easiest way to do this in c#?
Bass library. Bass has everything you need. It can access, record and edit media streams like mp3s, allowing you to sample the volume at different time points. It has a .net api, so you can use it in c#. Unfortunately it does cost money if you are using it for a commercial application, but they do provide a free non-commercial license.
Sox is a command-line tool which has an option to split an mp3 on n seconds of silence. You could always use the system command to call sox from c#.
Other related links.
Ripping a CD to mp3 in C# - third party component or api out there?
Audio Libraries for MP3 editing
How do I merge/join mp3 files with c#
This code shows a way to make a CD
ripper in C#. There are APIs from some
vendors that allow reading audio CD
tracks but it is also possible to do
it using APIs that allow low level
access to CD drives such as ASPI from
Adaptec or IOCTL control codes. The
latter method is used in this case,
because there is no need to install
any third party software, it is
completely covered by Win32 API
functions.
http://www.codeproject.com/KB/cs/csharpripper.aspx
Splitting the MP3 stream will be difficult to do with any degree of precision. The compressed MP3 data exists as sequential chunks of audio data comprised of many samples. The easiest way to perform this would be to decode the stream either progressively or in its entirety, perform your manipulation, then re-encode it (which as I understand is how most jukebox software does it)
Having a solid knowledge of the file's binary format would be a good place to start. That done, you'll know what silence looks like in the file. You may have to define exactly what silence is. Presuming that, like most audio, it started from an analog source, there's almost certainly some noise buried in the "silence". What will your tolerance for ambient/background noise be?
Once you know what you're looking for, just scan through the file, looking for "it".
Simple ...
A program to do this already exists:
http://mp3splt.sourceforge.net/mp3splt_page/home.php