Dec 1, 2012

Hold onto your hex editors! It's time for an overhaul!

I'm going the way of reading external files. Rather than wasting time (as if I don't waste years of my life every time I post here already) typing up data structures or arrays to hold all the hard-coded values found in the CV3 ROM that I can't simplify to an algorithm, I'm storing all pertinent data inside binary files. This has a couple benefits that I can foresee:


First off, the loading time of the game will be cut. With a data structure or array, the game will have to compile everything at start-up. With a binary file, it's already compiled.


Second, and most importantly for me, a data structure or array requires typing out not just the values but also the instructions to store each of those values. Even with the copy/paste shortcut I was using in combination with "1 down backspace 2 down backspace 3 down backspace" method of quick-instructing I was using, this will be much faster. Now I can just copy/paste directly from the ROM into a binary file and keep track of the data in an external index.

Third, although it will take getting used to by anyone using my engine when eventually I release it, only those who have the index or who took the time to look through all my code would be able to easily hack the binary files. Seeing as how most of the data in the files only pertains to movement, it wouldn't be very useful to hack anyway. So although the security is laxer than data structures or arrays, there's still some extent of security.

Lastly, values can be stored in hexadecimal format but GM will read them in decimal format with no additional instructions required. Each step, you open the file to read it, read it only as often as needed, then close it until the next time it's needed. You'll just have to be sure to close it.

This method may ultimately be slower over the course of run-time, but I think it will be easier to work with in the long run.

No comments:

Post a Comment

©TheouAegis Productions™. Powered by Blogger.