Author Topic: How to make a sound tracker?  (Read 582 times)

Offline NilENT

  • Shy artist
  • Posts: 7
  • Gender: Male
  • Operating System: Windows 10
How to make a sound tracker?
« on: September 17, 2017, 00:48:03 »
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.
« Last Edit: September 17, 2017, 04:20:12 by NilENT »
Don't let the "Shy Artist" text fool you... Yes, I'm 14 as of writing this. Deal with it :)

Offline StarWolf3000

  • Active artist
  • *
  • Posts: 13
  • Gender: Male
  • Operating System: Windows 8.1 x64
Re: How to make a sound tracker?
« Reply #1 on: September 17, 2017, 07:14:06 »
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.

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,303
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 7 x64
Re: How to make a sound tracker?
« Reply #2 on: September 17, 2017, 11:20:26 »
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.
« Last Edit: September 17, 2017, 14:43:18 by Saga Musix »
» 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.

Offline MiDoRi

  • Active artist
  • *
  • Posts: 13
  • Gender: Male
    • BotB profile
  • Operating System: Windows 8.1 x64 and XP SP3 x86
Re: How to make a sound tracker?
« Reply #3 on: September 17, 2017, 14:08:12 »
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

Offline NilENT

  • Shy artist
  • Posts: 7
  • Gender: Male
  • Operating System: Windows 10
Re: How to make a sound tracker?
« Reply #4 on: September 17, 2017, 14:25:00 »
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.
Don't let the "Shy Artist" text fool you... Yes, I'm 14 as of writing this. Deal with it :)

Offline NilENT

  • Shy artist
  • Posts: 7
  • Gender: Male
  • Operating System: Windows 10
Re: How to make a sound tracker?
« Reply #5 on: September 17, 2017, 14:27:12 »
Also, How would I go about encrypting the tracker files and/or making my own format?
Don't let the "Shy Artist" text fool you... Yes, I'm 14 as of writing this. Deal with it :)

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,303
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 7 x64
Re: How to make a sound tracker?
« Reply #6 on: September 17, 2017, 14:42:34 »
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.

Offline NilENT

  • Shy artist
  • Posts: 7
  • Gender: Male
  • Operating System: Windows 10
Re: How to make a sound tracker?
« Reply #7 on: September 19, 2017, 03:16:29 »
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).
Don't let the "Shy Artist" text fool you... Yes, I'm 14 as of writing this. Deal with it :)