Main menu:
Within MMFusion, the programmer is given a wide choice of ways to save including but not limited to the Array Object, Dynamic Array Object, Binary Tree Object, INI Object and INI++ objects. Out of the listed objects, two are of the most fundamental with regards to saving; the Array object and the INI object.
One definition of an array is as follows:
"An array is a series of elements of the same type placed in contiguous memory locations that can be individually referenced by adding an index to a unique identifier"
For those new to arrays or programming, an array can simply be thought of as a table or list where all the data elements are the same type (all integers, booleans, strings, etc...). The tables below represent string arrays of different sizes. Essentially anything that makes sense to add as a column or row in a table could be added as another dimension in an array. This concept applies to any kind of array.
Name |
Mario |
Donky Kong |
The Doctor |
Link |
Name | Age (in years) |
Mario | 28 |
Donkey Kong | 34 |
The Doctor | 1200 |
Link | 19 |
Name | Age (in years) | Favorite Meal |
Mario | 28 | Mushrooms |
Donkey Kong | 34 | Bananas |
The Doctor | 1200 | Yogurt |
Link | 19 | Potions & Soup |
The Array Object in MMFusion supports a maximum of 3 dimensions; X, Y, and Z dimensions. The dimensional length of each array can be any positive integer. Arrays that use all 3 dimensions can quickly use a large amount of memory. Exceeding a 2GB limit will cause a warning message to appear so try to limit the dimensional lengths.
MMFusion arrays are either number arrays or text arrays. If you array may contain text and numbers, set the array to be a "text array" so you can use the Val() function to convert numbers in string/text format to numbers in numeric format.
The norm for programmers is to use a 0-based index; meaning that numbers start at 0 instead of 1. Most extensions that use indices in MMFusion are 0 based indices so it is recommended against checking the "Based 1 index" property for consistency and uniformity.
Finally, arrays in MMFusion can be global. A global array means that the data of the object is retained throughout frames. If this property is enabled, all Array Objects that share the same name as the global array will be global. As such, you can have multiple global arrays across the application.
Using the Array Object is fairly straightforward. You write string or numerical data to a specified index. Additionally, you can also load or save an array via a filename expression or a file selector.
Special Notes:
The files the Array Object creates are only readable by MMFusion. The filename generated by the object can any type of file extension to it.
There is a way increase the dimensional size of an array during runtime. Simply write data (it can be a blank string or 0) to an address outside of current dimension of the array. For example, if you saved "John" to (99,99) in a 0-based 3 x 3 array, the 3 x 3 array would increase to 100 x 100 array.
The only way to decrease the dimensional size of an array is to leave the frame and come back or restart the frame. This will cause the array to revert to its original size. This will only work if the array is not global. Global arrays cannot be reduced in sized.
| X Indices (data of the same type lie on the same X-Index) | ||||||||||||||||||
0 (represents Character Name) | 1 (represents Character Age) | 2 (represents Favorite Meal) | 3 (represents symoblic clothing) | ||||||||||||||||
Y-Indices (related data lie on the same Y-index) | 0 | Mario | 28 | Mushrooms | Red hat | ||||||||||||||
1 | Donkey Kong | 34 | Bananas | DK Tie | |||||||||||||||
2 | The Doctor | 1200 | Yougurt | Sonic Screwdriver | |||||||||||||||
3 | Link | 19 | Potions & Soup | Green tunic |
No way to decrease size of array during runtime through actions
Concept of arrays difficult to grasp for newcomers and those unfamiliar
Large arrays can take up increasingly huge amounts memory
Indices are only addressable by numbers (not so much of a disadvantage, but takes time to get used to)
Below is one among many definitions for an INI,
"The INI file format is an informal standard for configuration files for some platforms or software. INI files are simple text files with a basic structure composed of 'sections' and 'properties' "
Simply put, INI files typically hold configurations/settings. If you have a Windows computer, you see this for yourself. Open Notepad, click "Save as" then type in a name with the extension '.ini' such as "Settings.ini". Then view this file in the Windows Explorer (Windows key + E) and you will see in the description that the Window classifies it as configurations. Keep in mind that adding the '.ini' extension does not add any kind of extra or special code to the text file; the INI file is still a plain empty text file.
As stated before, the norm is for the data within .ini files be used to "personalize" a piece of software to its user(s). There are four sections in a plain INI file.
The only property the INI Object contains asks for the name of the initial INI file. Any filepath is a valid value for this field. If the "Create INI file in Application Data folder" is checked, then a folder with the same name as the application will be created in the application data folder and the INI Object's initial file is saved and loaded from there.
Similar to the Array Object, using the INI Object is fairly straight forward. You can choose the set the current group and current item which will write the next set of data to the chosen group and/or item. The Load/Save Object Position saves the name of the chosen object and the selected X/Y Positions of the chosen object. No alterable values or alterable strings are saved with this action. These two actions can be useful in level editors, but it is recommended to use a custom-built saving routine. This is recommended because a custom-built saving routine will be much more flexible to suit your needs in applications.
Human-friendly format
Personalized structure in groups (different groups can have different sizes)
INI files can be as big or as small as you need it to be
INI concept easy to grasp
Arrays and INI files are two out of a vast number of options to save data in applications. Using both objects is fairly straightforward; you specify where you want to save the data and write said data to the file. The Array Object should be used over the INI Object in most cases. Such reasons why you would use the Array object over the INI object include if you need the data to be illegible to users, need a small file size, or have a table-like structure. The INI Object should be used over the Array Object if you wish the data to be editable by the users or have an inconsistent data structure. An example flow chart, below, shows compares the uses of both objects
Each object has its advantages and disadvantages, but it is up to you, the programmer, to make the best out of both!