Pixelthief, did you find a way to make the Binary Array 3D? If so, how was it done?
Marv









Pixelthief, did you find a way to make the Binary Array 3D? If so, how was it done?
Marv
458 TGF to CTF 2.5+ Examples and games
http://www.castles-of-britain.com/mmf2examples.htm


Well, the answer is yes and no.
The binary object has a "Combine X/Y/Z coordinates" function that can be used to simulate a 3d Array. All it really does is just write the values along the 1d Array at the simulated coordinate. And I got it running up and fine! But sadly, it wasn't a terrible amount of difference. See, with the MMF2 Array method, I could get 200ish objects. With the Binary Array, I could get 300ish objects. But with the help of the newly updated xLua extension, I now have an engine that is capable of reading/writing 10000+ objects without any slowdown at all.
I've been testing it out, and I haven't managed to slow the darn thing down yet. Weeding out a few crashes, but it looks like it will be stable, fast and sleek.









Ok and thanks. Good job on xLua script.
Marv
458 TGF to CTF 2.5+ Examples and games
http://www.castles-of-britain.com/mmf2examples.htm
i think you can see why i'm always bugging the lua extension developers to add more and more interface functions, since each missing interface function you have to instead implement in the event list is a potential performance bottleneck (and a guaranteed one if you have even a couple hundred objects)Originally Posted by Pixelthief









Pixelthief, any chance sharing how you did that?
Marv
458 TGF to CTF 2.5+ Examples and games
http://www.castles-of-britain.com/mmf2examples.htm




Yeah, I would be very grateful to know as well. :grin:Originally Posted by nivram
Your work on this engine has been amazing! Glad you didn't give up.
stephen1980


Which part did you want to know? The whole rigmarole of how the entire system with its stacks of events occuring, stacks of pointers to objects, arrays of objects, 3d arrays of object properties, etc, is far too complex and confusing to explainBut for the individual parts its not terrible.
I'm not using the binary array anymore, but if you want to know how to use it, heres a little miniguide;
The whole saved binary is nothing but one very very long string of 1's and 0's, not arranged in a 2d or 3d matrix at all but just one long 1-dimensional string. So when you use the function inside the binary array object "Combine XYZ", all it does is multiply & mod the x,y & z values to create a point on the 1 dimensional list to correspond to it.
You can change the size of the X & Y axises by using the "Set virtual height & width" function. This doesn't change the set of data in any way, it just changes what the Combine XYZ gives for its result.
Combine XYZ = X + (Height * Y) + (Height * Width) * Z
So thats pretty simple even if it sounds complex. If you want a 500x300x100 array, you just set Height = 500, Width = 300. You don't have to set the Z variable because the function is open-ended, so a 500x300x100 array uses the same thing as a 500x300x200 array. You just need to remember to give it a proper amount of size for the array (resize).
But the problem was I wanted to have a (Time,ID,Property) array, where each property is an integer. But an integer takes up 4 bytes. And when it writes an integer, it writes them to a contiguous 4 bytes. So if I did them in that order, it would overwrite the first 3 bytes of the next ID, and it wouldn't work.
The trick was to just make sure to write it in reverse order, since bytes in the X category are contiguous. So for a 3 dimensional array, you should do this:
Resize(X_size * 4 * Y_size * Z_size) ex. Resize(500*4*300*100)
Write Integer(Value, Combine(X * 4, Y, Z))
Value = Read Integer Unsigned(Combine(X * 4, Y, Z))
if you don't make sure its writing in 4 byte intervals, it might overwrite the beginning of the next integer.









Thanks for that Pixelthief. Appreciate it.
Marv
458 TGF to CTF 2.5+ Examples and games
http://www.castles-of-britain.com/mmf2examples.htm




There's my problem! :grin:Originally Posted by Pixelthief
Thanks for the info. Much appreciated!
stephen1980