Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Uses of Memblocks

Author
Message
thinkdigital
21
Years of Service
User Offline
Joined: 18th Oct 2003
Location:
Posted: 25th Nov 2004 10:44 Edited at: 25th Nov 2004 10:45
I'm rather new to memblocks and I have no idea what they might be useful for. I've heard people say stuff about cool things they used memblocks for, and so I wonder: what are some practical uses of memblocks over say, an array?

"Never put off for tomorrow what you can put off for the day AFTER tomorrow..."

eGeneric Works DB site - www.egenericworks.com
Arkheii
21
Years of Service
User Offline
Joined: 15th Jun 2003
Location: QC, Philippines
Posted: 26th Nov 2004 17:01
The most common uses for memblocks would be editing your resources, like sound, images, or models. It's fast because everything is done by manipulating the stuff in the memory directly. The catch is you'd have to study the memblock formats, and screwups are hard to find. You might also want to use if for "communicating" between two programs (like, you'd have a program done in C or VB for a level editor, and the two would communicate with and send data to each other through the memblocks.

Actually, if you think you can do fancy things by tinkering with the stuff in the memory, then memblocks are cool. Someone at LLRGT was making a small image editing library. Since using the DB commands would be too slow, he converted the image to a bitmap memblock, and sent a pointer to his image editing DLL, which does all the editing.

The only advantage I find most useful in memblocks over arrays is the use of pointers. If you have a use for pointers (usually when you use dlls or whatever), then the memblock makes editing the information faster and easier, especially for dll's. The only choice an array would have is to send its element one by one to the dll, which is slow. In a memblock, all you have to do is send the pointer to the start of the memblock to the dll, then you could read/manipulate the rest by simply adding an offset number to that pointer.

Eh. Ask the DBCe pros out there. They know better.


I spelled "disappointment" wrong. Pahintulutan ang di-inaasahang nakakahiyang pagkakamaling dulot ng kamangmangan. Have at you.
thinkdigital
21
Years of Service
User Offline
Joined: 18th Oct 2003
Location:
Posted: 28th Nov 2004 01:00
Come to think of it, they'd be a good way to send packets of information in a multiplayer game...

"Never put off for tomorrow what you can put off for the day AFTER tomorrow..."

eGeneric Works DB site - www.egenericworks.com
Chris K
21
Years of Service
User Offline
Joined: 7th Oct 2003
Location: Lake Hylia
Posted: 28th Nov 2004 01:02
They're pretty much the only way.

The others are too slow. I made a multiplayer game that sent 1 byte of info every 5 syncs.

It was pretty cool.

Login to post a reply

Server time is: 2025-05-24 16:56:30
Your offset time is: 2025-05-24 16:56:30