specs for CNC ARRAY format?
Hello everyone, long time no see. Please excuse the long introduction, but it's important to get to my point, so read on :)
It's been many years since I've made a game with a Clickteam product, but earlier in the summer I tried to restart it again for a little mascot competition where the prize was a copy of MMF2. Now, I still have interest in finishing the game, even though I didn't get near finishing it at that time. However, in the process of building I have come up against several hurdles.
In my game, the character uses force vectors to collide with objects and provide realistic bouncing angles against background objects and shaped enemies. It also uses a tile engine to dynamically load the levels at runtime. The tilemap creation software was programmed in another language (.NET), to provide automated features which would have been very difficult to achieve using MMF fast loops.
However, the size of the levels required and the fact I couldn't simply use background objects for the collisions I wanted (since I not only need to check IF the character collided with a tile, but WHAT KIND of tile they collided with) meant that loading all the tiles into memory at once would be quite impossible for MMF to do. Some quick calculations showed potentially over 500,000 tiles on a medium sized stage, which is unacceptable.
I recently came up with a novel way around this problem, and that is to dynamically load small pieces of the level at runtime outside of the frame, and unload them when they are beyond a certain culling distance. However, the implementation of this plan would be a LOT easier with 2d array support, since I could reference the general area around the character directly in an intuitive manner rather than relying on MMF code and fastloops to constantly re-parse a string in memory. MMF's built in Array object would be perfect for this job.
I've dealt with CNC ARRAY objects before a lot in my earlier games, and it's a really simple way to store a lot of data. However, I've never really tried to access these files outside of MMF, nor do I know what kind of files they actually are. Before I go and waste a lot of time reverse-engineering the format so I can get my VB.NET tilemapper to spit out CNC ARRAY files, I was hoping that someone else had maybe done it before me, or if clickteam had a readable spec on the format for developers.
Thanks a lot for the help, and any information on the format will be useful. If no spec is available, just a few tips to get me started parsing the file would be nice! (Delimiters, header chunk sizes, etc)
Re: specs for CNC ARRAY format?
CNC Arrays are uber simple.
I'm pretty sure this is right, but if any problems with it, correct me.
Code:
offset type details
-----------------------
- HEADER CHUNK -
0000 ascii "CNC ARRAY"
0009 byte Null
000A dword Always '2' for some reason. Maybe version number?
000E dword X dimension size
0012 dword Y dimension size
0016 dword Z dimension size
001A dword Settings (see note 1)
001E (Data chunks follow from here)
- DATA CHUNK (number array) -
0000 dword value of this item in the array.
This repeats for every element in the array, until it reaches
the end of the file. There is one dword per element.
- DATA CHUNK (text array) -
0000 dword Length of text
0004 ascii Stored text
- Note 1 (Flags/Settings) -
This shows the meaning of the various bits in the flag byte:
-------- -------- -------- ----gbtn
g = Global Array (1 = yes)
b = 1-Based Array (1 = yes)
t = Text Array (1 = yes)
n = Number Array (1 = yes)
- = Bit is not used.
Re: specs for CNC ARRAY format?