How to make a sound tracker?

Started by dustboxed727, September 17, 2017, 00:48:03

Previous topic - Next topic

dustboxed727

Recently, I've been quite curious about how I would go about making a simple soundtracker like OpenMPT (not that OpenMPT is, but I'm hoping for mine to start off simple). The main reason I would like to do this is because I am currently in the process of developing a game, and I want some way to make a somewhat tamper-proof file format. While, yes, there might be encryption algorithms for files like this, I am a budding software developer, and I'm a very curious person (isn't every software developer ;D ). I'm currently using Visual Studio 2017, and I'm planning to use C++.

The info I need is: The recommended C++ libraries, how I would make a functional tracker UI, what I need to know before doing this, and, if possible, some code examples to get me started.
There are two kinds of people in this world; ones who are having a stroke and ones who are speaking Dutch.

StarWolf3000

I'm just curious about why'd you want to create your own tracker with your own file formats, when you can use the existing ones which provide everything you need for composing music and in case of OpenMPT even have a playback library (libopenmpt) to be used by external software.

To make sure only your game can access your music files, you could use a not-so-common container format with some sort of encryption.

Saga Musix

#2
I also think that making your own tracker would be completely over-the-top for what you want to achieve - especially since the musician making music for your game would have to learn a new tool, which most people are not willing to do. Of course if you have some revolutionary idea that is not possible with existing tools, you'd have to write your own or adapt an existing tracker.
If it's only about hiding the files from the users, there are many things you can do, such as a custom container with simple xor "encryption". Whatever you do, it won't stop determined people from ripping the music from your game, and quite honestly I wouldn't try too hard to stop them, because why not let people listen to your game music if they like it? It's basically a free advertisment.
Writing a complete tracker from scratch is a lot of work so if you still think you need a custom module format, I'd rather recommend hacking an existing tracker such as OpenMPT to output your own file format, and then modify the module decoder (e.g. libopenmpt) to support that format as well.
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

Midori Mizuno

Preventing users from accessing those files isn't a good idea, and most people who are interesed in extracting/deciphering that data will eventually find their way to do this. Also some like the ability of being able to listen to fav VGM outside of the game, why would you take this opportunity away from anyone? This is fairly innocent as is, but reminder how awfully bad DRMs can get https://en.wikipedia.org/wiki/Sony_BMG_copy_protection_rootkit_scandal

dustboxed727

You guys actually make some good points, tbh :P I kind of expected this response, but, fine by me :) I have heard DRMs are pretty horrible.
There are two kinds of people in this world; ones who are having a stroke and ones who are speaking Dutch.

dustboxed727

Also, How would I go about encrypting the tracker files and/or making my own format?
There are two kinds of people in this world; ones who are having a stroke and ones who are speaking Dutch.

Saga Musix

Well, that is a rather broad question... "making your own format" is definitely a lot more complicated and it depends on what kind of features of the original format you want to support, and if you can remove any other features... I would absolutely not recommend going that route, especially since it requires a deep understanding of the internal workings of tracker formats that you would probably have to acquire first. You'd be better off investing that development time into your actual game instead.

It is typical for games to put all their assets into one container file, or a small number of container files. Typically those files have a very simple layout (just a collection of filenames, pointers to the data in the container and file size), or they are in fact just renamed zip files. The latter would be very simple to implement, and you could even password-protect the zip file. But don't expect this to be a serious obstacle to anyone with a disassembler at hand. Since your game needs to know how to extract the zip file, the encryption key must be stored somewhere in your executable, so it's just a matter of finding it, then everyone else can extract it as well.

I know there's a certain "coolness factor" associated with this kind of stuff for young (or inexperienced) developers - I've been there myself! - but in the end I think that the time spent on this stuff would better be invested in the actual game engine.
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

dustboxed727

You guys all make some great points, to be honest. I thought back to this a few days after posting and realized how large of a task I'd be investing in. All in all, I think it would come across a lot smoother if I just kept the files the way they are, and let people freely listen to my music. While, yes, I might release a paid OST at the end of development, you'd guess that people would want to support the developer either way (although some people just want games/music/software/etc. rather than a happy developer :P).
There are two kinds of people in this world; ones who are having a stroke and ones who are speaking Dutch.