Samapico Posted July 21, 2008 Report Posted July 21, 2008 Some major improvements are coming that will cut down memory usage AND be more efficient... Basically, DCME has a couple of 1024x1024 boolean arrays; and booleans in VB6 are actually integers, which mean they take 2 bytes. I made a class that handles a boolean array with bytes, which cuts down memory usage by 2x. Additionnaly, we can do copy/move and set/reset operations MUCH quicker (pretty much instantly) using APIs such as CopyMemory and FillMemory (memcpy and memset equivalent in c++) I just added this to the eLVL regions. Each region now takes 1MB of memory instead of 2MB. (I also fixed a undo/redo problem in regions I noticed on the way) Drake was working on pushing this a bit further, by making a class that works with a field of bits. Technically, a single bit is enough for boolean values, and we could fit up to 8 booleans in one single byte. That means 8x less memory usage than my improvement (or 16x less than how it was before that). This technique is more complex, because when handling memory, you can only work with full bytes. So if you have a 32x32 array, and want to copy the values from 2,2 to 18,18; you have to copy the bytes that are complete, but then you have to check each side of the area and handle the incomplete bytes (i.e. change only the bits you want). That probably would be easier to understand with pics, but whatever. This will probably be a tiny bit slower than the byte implementation, but it probably won't be noticeable. Eventually, we'll be implementing it on everything that is using an array and it will speed things up considerably. Quote
Sketter Posted July 21, 2008 Report Posted July 21, 2008 so basicly the next update will be built for speed. sounds good.i want to ask u something, but ill ask in game. Sketter Quote
Drake7707 Posted July 21, 2008 Report Posted July 21, 2008 The bit array partially works. Setting and getting bits is no problem, but it seems there still are some bugs in setrectangle and moverectangle, that not all bits are set or something. I've tried to correct it but i find it pretty hard BitArray.rar Quote
Samapico Posted July 21, 2008 Author Report Posted July 21, 2008 How else could you live a happy life anyway? DCME is your salvation Quote
Samapico Posted July 25, 2008 Author Report Posted July 25, 2008 Got the SetRectangle working correctly; it still had small offsets... But dude... Drake... I just realised... Dunno if you thought about this before, but moving and copying will be almost impossible... What are full bytes at the source won't be full bytes at the destination (well, 7/8 of the time)... so... we'd have to offset each byte... wtf no way. If there was a bit shift operator, it would be much easier, but... bleh :/ Unless we make some small c++ dll for this lol, we give it pointers and it does the job for us Can c++ bitshift large portions of memory? ... Unless someone comes with a brilliant idea, or if I missed something (being tired and all), I'm giving up on the bitArray, and will work on the byteArray instead Quote
Drake7707 Posted July 25, 2008 Report Posted July 25, 2008 What are full bytes at the source won't be full bytes at the destination (well, 7/8 of the time)... so... we'd have to offset each byte... wtf no way. Yeah ... that's true ... !@#$%^&* :/ And using setBit on a 1024x1024 area is too slow ? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.