Jump to content
SubSpace Forum Network

Recommended Posts

Posted

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.

Posted

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

Posted
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 ?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...